launchdarkly / dotnet-server-sdk

LaunchDarkly Server-Side SDK for .NET
https://launchdarkly.com
Other
54 stars 25 forks source link

Client never initializes on .NET Framework 4.8 MVC Application #184

Open rkajbaf-experientgroup opened 7 months ago

rkajbaf-experientgroup commented 7 months ago

Is this a support request? No,

Describe the bug Fails to ever initialize in a .NET Framework 4.8 Web Application on the latest version (8.0). Downgrading to 7.1 resolves the problem.

To reproduce Try on a .NET Framework MVC Application. Client will never initialize.

Expected behavior Should initialize.

Logs If applicable, add any log output related to your problem.

SDK version 8.0

Language version, developer tools .NET Framework v4.8

OS/platform Windows

Additional context Downgrading to 7.1 resolves the problem.

tanderson-ld commented 6 months ago

Hello @rkajbaf-experientgroup and thank you for your feedback. Are you able to collect any logs? Could you please provide a code snippet of your configuration and call to start the SDK? Thank you!

tanderson-ld commented 6 months ago

Another theory is that a cache or lockfile is holding a version of a library or dependency. Have you tried a clean build and/or do you use a package lockfile?

pgeorge-costacoffee commented 5 months ago

I am also having this problem; unrelated to the individual who posted this originally. I even opened a Stack Overflow post a couple months ago:

https://stackoverflow.com/questions/77869557/launchdarkly-example-doesnt-work-in-net-class-library-but-does-in-a-consoleapp

pgeorge-costacoffee commented 5 months ago

Here is the console output related to launch darkly:

'my.exe' (CLR v4.0.30319: my.exe): Loaded 'C:\my-project\bin\x64\buildconfig\LaunchDarkly.CommonSdk.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'my.exe' (CLR v4.0.30319: my.exe): Loaded 'C:\my-project\bin\x64\buildconfig\LaunchDarkly.ServerSdk.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'my.exe' (CLR v4.0.30319: my.exe): Loaded 'C:\my-project\bin\x64\buildconfig\LaunchDarkly.InternalSdk.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'my.exe' (CLR v4.0.30319: my.exe): Loaded 'C:\my-project\bin\x64\buildconfig\LaunchDarkly.Logging.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 2024-04-12 15:45:06.506 -05:00 [LaunchDarkly.Sdk] INFO: Starting LaunchDarkly client 8.3.0 'my.exe' (CLR v4.0.30319: my.exe): Loaded 'C:\my-project\bin\x64\buildconfig\LaunchDarkly.EventSource.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 2024-04-12 15:45:06.630 -05:00 [LaunchDarkly.Sdk.DataSource] INFO: Connecting to LaunchDarkly stream 2024-04-12 15:45:06.643 -05:00 [LaunchDarkly.Sdk] INFO: Waiting up to 10000 milliseconds for LaunchDarkly client to start... 2024-04-12 15:45:06.929 -05:00 [LaunchDarkly.Sdk.DataSource] ERROR: Unexpected error in stream processing: System.IO.FileLoadException: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) 2024-04-12 15:45:07.455 -05:00 [LaunchDarkly.Sdk.DataSource] INFO: Waiting 853 milliseconds before reconnecting... 2024-04-12 15:45:08.462 -05:00 [LaunchDarkly.Sdk.DataSource] ERROR: Unexpected error in stream processing: System.IO.FileLoadException: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) 2024-04-12 15:45:08.979 -05:00 [LaunchDarkly.Sdk.DataSource] INFO: Waiting 1064 milliseconds before reconnecting... 2024-04-12 15:45:10.199 -05:00 [LaunchDarkly.Sdk.DataSource] ERROR: Unexpected error in stream processing: System.IO.FileLoadException: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) 2024-04-12 15:45:10.715 -05:00 [LaunchDarkly.Sdk.DataSource] INFO: Waiting 2966 milliseconds before reconnecting... 2024-04-12 15:45:13.829 -05:00 [LaunchDarkly.Sdk.DataSource] ERROR: Unexpected error in stream processing: System.IO.FileLoadException: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) 2024-04-12 15:45:13.830 -05:00 [LaunchDarkly.Sdk.DataSource] INFO: Waiting 5497 milliseconds before reconnecting... 2024-04-12 15:45:16.657 -05:00 [LaunchDarkly.Sdk] WARN: Timeout encountered waiting for LaunchDarkly client initialization 2024-04-12 15:45:26.143 -05:00 [LaunchDarkly.Sdk.Evaluation] WARN: Flag evaluation before client initialized; data store unavailable, returning default value 2024-04-12 15:45:26.226 -05:00 [LaunchDarkly.Sdk.DataSource] ERROR: Unexpected error in stream processing: System.IO.FileLoadException: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) 2024-04-12 15:45:26.745 -05:00 [LaunchDarkly.Sdk.DataSource] INFO: Waiting 10881 milliseconds before reconnecting...

pgeorge-costacoffee commented 5 months ago

Based on the output, above dug in some more. Was able to resolve it following the steps here:

https://stackoverflow.com/a/78331233/16276333