Automated-Fact-Checking-Resources icon indicating copy to clipboard operation
Automated-Fact-Checking-Resources copied to clipboard

Exception when installed as .msi, works fine otherwise

Open FletcherJohnsonZ opened this issue 4 years ago • 2 comments

Bug Report / Support Request Template

This is detailed in https://stackoverflow.com/questions/69591896/serilog-wpf-based-app-works-but-not-when-installed-as-an-exe - "Serilog WPF based app works but not when installed as an EXE"

Please clearly describe what the SQL Sink is doing incorrectly:

It runs perfectly when running after doing a build. If I generate a .MSI file and install from that, it does not log to the SQL server. All other logging works and there is no issue communicating with the server.

The frustrating part is that it is harder to debug as an exe. I have downloaded the sink code and am trying to find the code that causes the issue.

Please clearly describe the expected behavior:

That it logs to the server even when installed as a .msi

List the names and versions of all Serilog packages used in the project:

See Stackoverflow link

Target framework and operating system:

[ ] .NET Core 2.0 [ X] .NET Framework 4.7 [ ] .NET Framework 4.6.x [ ] .NET Framework 4.5.x OS:

Provide a simple reproduction of your Serilog configuration code:

See Stackoverflow link for code

Provide a simple reproduction of your Serilog configuration file, if any:

Not used

Provide a simple reproduction of your application code:

See Stackoverflow link for code

FletcherJohnsonZ avatar Oct 18 '21 16:10 FletcherJohnsonZ

The problem is due to the use of Microsoft.Data.SqlClient instead of System.Data.SqlClient. When I downloaded the source and changed it to use the older library, all worked as expected. The StackOverflow posting has also been updated.

FletcherJohnsonZ avatar Oct 19 '21 21:10 FletcherJohnsonZ

Just an update. I have posted an update on this to the Microsoft.Data.SqlClient - testing the released version of 4.0.0 of their library.

The Sink library seems to work fine when using the System.Data.SqlClient. I downloaded the source and when I changed the usings to use System.Data.SqlClient, the code worked.

I would be happy to work with someone on this, but I don't have time to learn the library well enough to debug it on my own.

It does appear that the problem is related to a NullReferenceException in the modules mentioned in the StackOverflow posting (https://stackoverflow.com/questions/69591896/serilog-wpf-based-app-works-but-not-when-installed-as-an-exe/69637676#69637676).

Fletcher

FletcherJohnsonZ avatar Dec 29 '21 22:12 FletcherJohnsonZ

Hi @FletcherJohnsonZ! Sorry for the long silence. We have updated the version of Microsoft.Data.SqlClient in the recent release 5.8.0 and then once more in the newest release 6.0.0. Can you try to update the sink to one of those releases? Possibly the problem you face is fixed by that.

ckadluba avatar Nov 16 '22 22:11 ckadluba