Upon downloading the nuget package into a brand new C# project and adding the appropriate app.UseCompressionModule() code, I start my self hosted server and get the following error:
System.TypeInitializationException was unhandled by user code
HResult=-2146233036
Message=The type initializer for '<StartupCode$Owin-Compression>.$CompressionModule' threw an exception.
Source=Owin.Compression
TypeName=<StartupCode$Owin-Compression>.$CompressionModule
StackTrace:
at Owin.OwinCompression.get_DefaultCompressionSettings()
at Owin.CompressionExtensions.UseCompressionModule(IAppBuilder app)
at AspNetSelfHostDemo.Startup.Configuration(IAppBuilder app) in {{path-to-project-hidden}}\Startup.cs:line 52
InnerException:
FileName=FSharp.Core, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
FusionLog==== Pre-bind state information ===
LOG: DisplayName = FSharp.Core, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
(Fully-specified)
LOG: Appbase = file:///{{path-to-project-hidden}}/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : Owin.Compression, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: {{path-to-project-hidden}}\bin\Debug\AspNetSelfHostDemo.vshost.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: FSharp.Core, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
LOG: Attempting download of new URL file:///{{path-to-project-hidden}}/bin/Debug/FSharp.Core.DLL.
LOG: Attempting download of new URL file:///{{path-to-project-hidden}}/bin/Debug/FSharp.Core/FSharp.Core.DLL.
LOG: Attempting download of new URL file:///{{path-to-project-hidden}}/bin/Debug/FSharp.Core.EXE.
LOG: Attempting download of new URL file:///{{path-to-project-hidden}}/bin/Debug/FSharp.Core/FSharp.Core.EXE.
HResult=-2147024894
Message=Could not load file or assembly 'FSharp.Core, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Source=Owin.Compression
StackTrace:
at <StartupCode$Owin-Compression>.$CompressionModule..cctor()
InnerException:
Downloading the FSharp.Core nuget package fixes the error. Are you assuming your user has FSharp installed on their machine? Seems like a poor assumption or one that should be mentioned in your documentation somewhere.
Also begs the question why should I have a dependency on FSharp.Core in my C# project....