Change in sql server location causes Event 1026 .Net Runtime

entity-framework-6 sql-server xaf

Question

I am connecting an application to a different SQL Server database and find the following error in the windows event log

The only change is the database server

Event 1026, .NET Runtime

Application: My.MyApp2.Win.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ArgumentException
   at System.Data.Common.DbConnectionOptions.ConvertValueToBooleanInternal(System.String, System.String)
   at System.Data.SqlClient.SqlConnectionString..ctor(System.String)
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(System.String, System.Data.Common.DbConnectionOptions)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(System.Data.Common.DbConnectionPoolKey, System.Data.ProviderBase.DbConnectionPoolGroupOptions, System.Data.Common.DbConnectionOptions ByRef)
   at System.Data.SqlClient.SqlConnection.ConnectionString_Set(System.Data.Common.DbConnectionPoolKey)
   at System.Data.SqlClient.SqlConnection.set_ConnectionString(System.String)
   at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Dispatch[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.__Canon, System.Action`2<System.__Canon,System.__Canon>, System.__Canon, System.Action`3<System.__Canon,System.__Canon,System.__Canon>, System.Action`3<System.__Canon,System.__Canon,System.__Canon>)
   at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.SetConnectionString(System.Data.Common.DbConnection, System.Data.Entity.Infrastructure.Interception.DbConnectionPropertyInterceptionContext`1<System.String>)
   at System.Data.Entity.Infrastructure.SqlConnectionFactory.CreateConnection(System.String)
   at System.Data.Entity.Internal.LazyInternalConnection.Initialize()
   at System.Data.Entity.Internal.LazyInternalConnection.get_Connection()
   at System.Data.Entity.Database.Exists()
   at DevExpress.ExpressApp.EF.EFObjectSpaceProvider.CheckDatabaseSchemaCompatibilityCore(System.Object)
   at DevExpress.ExpressApp.EF.EFObjectSpaceProvider.CreateObjectContext(System.Collections.Generic.IList`1<System.IDisposable>)
   at DevExpress.ExpressApp.EF.EFObjectSpaceProvider.Init(System.Type, DevExpress.ExpressApp.DC.ITypesInfo, DevExpress.ExpressApp.EF.EFTypeInfoSource, System.Data.Common.DbConnection, System.String, System.String, System.String)
   at DevExpress.ExpressApp.EF.EFObjectSpaceProvider..ctor(System.Type, System.String)
   at My.MyApp2.Shedule.MyApp2Schedule.application_CreateCustomObjectSpaceProvider(System.Object, DevExpress.ExpressApp.CreateCustomObjectSpaceProviderEventArgs)
   at System.EventHandler`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Invoke(System.Object, System.__Canon)
   at DevExpress.ExpressApp.XafApplication.OnCreateCustomObjectSpaceProvider(DevExpress.ExpressApp.CreateCustomObjectSpaceProviderEventArgs)
   at DevExpress.ExpressApp.XafApplication.CreateObjectSpaceProviders(System.String)
   at DevExpress.ExpressApp.XafApplication.Setup()
   at MyApp2.Win.Program.Main()

When I enabled diagnostic actions in XAF I got

Application: My.MyApp2.Win.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Data.SqlClient.SqlException
   at System.Data.SqlClient.SqlConnection.OnError(System.Data.SqlClient.SqlException, Boolean, System.Action`1<System.Action>)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(System.Data.SqlClient.TdsParserStateObject, Boolean, Boolean)
   at System.Data.SqlClient.TdsParser.TryRun(System.Data.SqlClient.RunBehavior, System.Data.SqlClient.SqlCommand, System.Data.SqlClient.SqlDataReader, System.Data.SqlClient.BulkCopySimpleResultSet, System.Data.SqlClient.TdsParserStateObject, Boolean ByRef)
   at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(System.String, Boolean, Int32, Boolean)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(System.Threading.Tasks.TaskCompletionSource`1<System.Object>, System.String, Boolean, Int32, Boolean ByRef, Boolean, Boolean)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Dispatch[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.__Canon, System.Func`3<System.__Canon,System.__Canon,Int32>, System.__Canon, System.Action`3<System.__Canon,System.__Canon,System.__Canon>, System.Action`3<System.__Canon,System.__Canon,System.__Canon>)
   at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.NonQuery(System.Data.Common.DbCommand, System.Data.Entity.Infrastructure.Interception.DbCommandInterceptionContext)
   at System.Data.Entity.SqlServer.SqlProviderServices+<>c__DisplayClass52_0.<CreateDatabaseFromScript>b__0(System.Data.Common.DbConnection)
   at System.Data.Entity.SqlServer.SqlProviderServices+<>c__DisplayClass60_0.<UsingConnection>b__0()
   at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy+<>c__DisplayClass2_0.<Execute>b__0()
   at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Func`1<System.__Canon>)
   at System.Data.Entity.SqlServer.SqlProviderServices.UsingMasterConnection(System.Data.Common.DbConnection, System.Action`1<System.Data.Common.DbConnection>)
   at System.Data.Entity.SqlServer.SqlProviderServices.CreateDatabaseFromScript(System.Nullable`1<Int32>, System.Data.Common.DbConnection, System.String)
   at System.Data.Entity.SqlServer.SqlProviderServices.DbCreateDatabase(System.Data.Common.DbConnection, System.Nullable`1<Int32>, System.Data.Entity.Core.Metadata.Edm.StoreItemCollection)
   at System.Data.Entity.Migrations.Utilities.DatabaseCreator.Create(System.Data.Common.DbConnection)
   at System.Data.Entity.Migrations.DbMigrator.EnsureDatabaseExists(System.Action)
   at System.Data.Entity.Migrations.DbMigrator.Update(System.String)
   at System.Data.Entity.Internal.DatabaseCreator.CreateDatabase(System.Data.Entity.Internal.InternalContext, System.Func`3<System.Data.Entity.Migrations.DbMigrationsConfiguration,System.Data.Entity.DbContext,System.Data.Entity.Migrations.Infrastructure.MigratorBase>, System.Data.Entity.Core.Objects.ObjectContext)
   at System.Data.Entity.Database.Create(System.Data.Entity.Internal.DatabaseExistenceState)
   at System.Data.Entity.CreateDatabaseIfNotExists`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].InitializeDatabase(System.__Canon)
   at System.Data.Entity.Internal.InternalContext.PerformInitializationAction(System.Action)
   at System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization()
   at System.Data.Entity.Internal.RetryAction`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].PerformAction(System.__Canon)
   at System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(System.Action`1<System.Data.Entity.Internal.InternalContext>)
   at System.Data.Entity.Internal.InternalContext.ForceOSpaceLoadingForKnownEntityTypes()
   at System.Data.Entity.DbContext.System.Data.Entity.Infrastructure.IObjectContextAdapter.get_ObjectContext()
   at DevExpress.ExpressApp.EF.EFObjectSpaceProvider.CreateObjectContext(System.Collections.Generic.IList`1<System.IDisposable>)
   at DevExpress.ExpressApp.EF.EFObjectSpaceProvider.Init(System.Type, DevExpress.ExpressApp.DC.ITypesInfo, DevExpress.ExpressApp.EF.EFTypeInfoSource, System.Data.Common.DbConnection, System.String, System.String, System.String)
   at DevExpress.ExpressApp.EF.EFObjectSpaceProvider..ctor(System.Type, System.String)
   at My.MyApp2.Shedule.MyApp2Schedule.application_CreateCustomObjectSpaceProvider(System.Object, DevExpress.ExpressApp.CreateCustomObjectSpaceProviderEventArgs)
   at System.EventHandler`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Invoke(System.Object, System.__Canon)
   at DevExpress.ExpressApp.XafApplication.OnCreateCustomObjectSpaceProvider(DevExpress.ExpressApp.CreateCustomObjectSpaceProviderEventArgs)
   at DevExpress.ExpressApp.XafApplication.CreateObjectSpaceProviders(System.String)
   at DevExpress.ExpressApp.XafApplication.Setup()
   at MyApp2.Win.Program.Main()

The connection string is read from connections.config:

<connectionStrings>
    <add name="ConnectionString" 
         connectionString="Server=MYSERVER;Database=MYDATABASE;Integrated Security=false;MultipleActiveResultSets=True;user=myuser;pwd=mypassword;"
         providerName="System.Data.SqlClient" />
</connectionStrings>

The working server was running

Microsoft SQL Server 2017 (RTM-CU16) (KB4508218) - 14.0.3223.3 (X64) Jul 12 2019 17:43:08
Copyright (C) 2017 Microsoft Corporation
Express Edition (64-bit) on Linux (Ubuntu 16.04.6 LTS)

The new server is running

Microsoft SQL Server 2019 (RTM-CU2) (KB4536075) - 15.0.4013.40 (X64) Feb 3 2020 16:40:57
Copyright (C) 2019 Microsoft Corporation
Express Edition (64-bit) on Linux (CentOS Linux 8 (Core))

I can connect to the new server with SSMS

The Winforms program has been developed using the Dev Express XAF framework.

App.config has

<connectionStrings configSource="connections.config" />

Target framework is .NET Framework 4.7.2

I tried removing Integrated Security=false; from the connection string and it made no difference.

I tried using an invalid user name and I did get an error as expected then.

The program simply stops running without any error message.

I see the XAF loading icon but the XAF login screen does not appear.

eXpressAppFramework.log has

11.04.20 19:21:04.119   ================================================================================
11.04.20 19:21:04.135   Trace Log for My.MyApp2.Win.exe is started
11.04.20 19:21:04.135   ================================================================================
11.04.20 19:21:04.135   System Environment
    OS Version: Microsoft Windows NT 6.2.9200.0
    .Net Framework Versions: v4.0.30319
    CLR Version: 4.0.30319.42000
    eXpressApp Version: 19.1.8.0
    eXpressApp File Version: 19.1.8.0

Application config
    Modules=
    NewVersionServer=
    EnableDiagnosticActions=True
    ClientSettingsProvider.ServiceUri=

11.04.20 19:21:04.197   Initialize application
=======================
11.04.20 19:21:04.197       Command line arguments: 
        C:\MyMyApp2\My.MyApp2.Win.exe
11.04.20 19:21:04.354   The ValueManagerType is initialized by the default value: SimpleValueManager.
11.04.20 19:21:04.369   Stack trace:
   at DevExpress.Persistent.Base.ValueManager.CreateValueManager[ValueType](String key)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at DevExpress.Persistent.Base.ValueManager.GetValueManager[ValueType](String key)
   at DevExpress.ExpressApp.ReportsV2.ApplicationReportObjectSpaceProvider.set_ContextApplication(XafApplication value)
   at DevExpress.ExpressApp.ReportsV2.ReportsModuleV2.Setup(XafApplication application)
   at DevExpress.ExpressApp.ModuleList.OnInsert(Int32 index, Object value)
   at System.Collections.CollectionBase.System.Collections.IList.Add(Object value)
   at MyApp2.Win.MyApp2WindowsFormsApplication.InitializeComponent() in D:\dev\SBD.MyMyApp2\MyApp2.Win\WinApplication.Designer.cs:line 78
   at MyApp2.Win.MyApp2WindowsFormsApplication..ctor() in D:\dev\SBD.MyMyApp2\MyApp2.Win\WinApplication.cs:line 48
   at MyApp2.Win.Program.Main() in D:\dev\SBD.MyMyApp2\MyApp2.Win\Program.cs:line 30
1
0
4/11/2020 9:41:38 AM

Popular Answer

I think the issue is that I have two dbcontexts in the application and the database for one is missing. I will be able to test this tomorrow.

0
4/11/2020 9:52:18 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow