KeyNotFoundException: __disposables in ServiceStackHost.Release on Mono 3.2.8


When enabling log4net, i get this error on my application.

Im Running AppSelfHostBase on Mono 3.2.8. On Debugger i don’t see this error, but as soon as i put it on Mono 3.2.8 on a Debian distribution, i see this with every web request.

Tried switching between SelfHostBase / Pool / Smart, etc… but it doesn’t matter.
How can i find out what it’s missing, and how that’s caused?


2017-03-03 09:23:02,404 ERROR [STP SmartThreadPool Thread #0] ServiceStackHost.Release
    System.Collections.Generic.KeyNotFoundException: __disposables
      at System.Collections.Concurrent.ConcurrentDictionary`2[System.Object,System.Object].GetValue (System.Object key) [0x00000] in <filename unknown>:0 
      at System.Collections.Concurrent.ConcurrentDictionary`2[System.Object,System.Object].get_Item (System.Object key) [0x00000] in <filename unknown>:0 
      at System.Collections.Concurrent.ConcurrentDictionary`2[System.Object,System.Object].System.Collections.IDictionary.get_Item (System.Object key) [0x00000] in <filename unknown>:0 
      at ServiceStack.RequestContext.ReleaseDisposables () [0x00000] in <filename unknown>:0 
      at ServiceStack.Service.Dispose () [0x00000] in <filename unknown>:0 
      at ServiceStack.ServiceStackHost.Release (System.Object instance) [0x00000] in <filename unknown>:0

Mono 3.2.8 is a very old version and at least you need to update mono and run your code on recent stable version (mono 4.6+) to be sure that this issue is not due to old ConcurrentDictionary implementation in mono, which was updated to .NET implementation in most recent version.

By the way, there is ServiceStack.Core package, which works on .NET Core platform and it works much faster than running on mono. The .NET Core platform is supported well from Microsoft in contrary to mono and can be used on most popular Linux distributions including Debian. So the recommended way to running ServiceStack on Linux is running it on .NET Core

1 Like

Sure, will try to update Mono first!

Yep… running Mono 4.8, no errors.

I really want to use .net core, but due to some dependencies on some older dll’s, i cannot (just yet).