Open statler opened 1 year ago
Hi @statler, could you provide us with the connection string?
also, what are you using for generating the MSI?
I'm having the exact same problem. I'm using Microsoft's Setup project in VS2019 and VS generates the MSI when I build the solution.
PS.. The program runs fine from the VS IDE but when I install it (on the same computer running the IDE) it fails to run. It creates 2 errors in the event log. 1 says the source is .net Runtime and that it is a NullReferenceException at Microsoft.Data.SqlClient.SqlConnectionEncryption.op_Implicit(Boolean). the 2nd says the "Faulting module name" is KERNELBASE.dll version 10.0.19041.2846 Exception code 0xe0434352 and the Faulting Application is my executable's name.
Describe the bug
When deployed as an MSI (but not when run locally or when deplyed with ClickOnce), Microsoft.Data.SqlClient throws a null reference exception when accessing the ConnectionString property. This problem goes away when I clone the Microsoft.Data.SqlClient and directly include it in the project. It only occurs when using the library as a reference from Nuget, and only when deployed as an MSI.
This leads me to think it may be some kind of reference issue. Both the library where the exception is thrown, and the master project have reverences to Microsoft.Data.SqlClient and Microsoft.Data.SqlClient.SNI
To reproduce
This is quite a specific edge case - I am hoping this is relatively straight forward to the authors. It would take my whole project to demsontrate I think, and that is huge :(
Expected behavior
The application should run under MSI deployment like it does under ClickOnce, and under local.
Further technical details
Microsoft.Data.SqlClient version: (found on the nuget or Microsoft.Data.SqlClient.dll) 5.01 .NET target: Framework 4.7.1 SQL Server version: (e.g. SQL Server 2017) SQL 2019 Operating system: Win10