Zoran Knezevic - 282 - Apr 9, 2014

Hey Demis,

Could you take a look at http://stackoverflow.com/questions/22974417/servicestack-iis-express-error  

Thanks

Any chance you could provide a repro on: 
https://github.com/ServiceStack/Issues

Like what would I need to do from a blank ASP.NET project to see the issue?

Zoran Knezevic:

I cannot do the repo as my work machine is locked down.  But I have rewritten the question with steps to reproduce. 

http://stackoverflow.com/questions/22974417/servicestack-redis-serialization-error

This is definitely a breaking change in 4.0.16 based on my test.  Please let me know as soon as you have a fix.  Thanks!

ok cool, was able to repro thx. Deploying a fix to MyGet now, will test then push a new NuGet release.

Yep all good, deploying v4.0.17 to NuGet now, available in 15mins

Zoran Knezevic:

Great.  Thanks
__________

Zoran Knezevic:

Can you tell me what the issue was or comment on the StackOverflow question?  

It was due to resolving an IDisposable dependency during initialization (i.e. not at runtime) which means the HttpContext.Items doesn’t exist so disposables were being tracked in the CallContext’s LogicalData store, which apparently in an IIS Express host doesn’t support non-serializable items. So I’ve added a new Container.Exists<T> api to check for IOC existence so we no longer have to resolve items internally (in ServiceStackHost), we’re also not tracking items in RequestContext during App initialization.

Zoran Knezevic:

Interesting, so why was it only throwing issues when I tried to use Redis?

because there’s defautl logic that if you haven’t registered an ICacheClient it will first check to see if you have Redis registered in which case it will register it as an ICacheClient otherwise it will register a MemoryCacheClient instead, code is at:
https://github.com/ServiceStack/ServiceStack/blob/master/src/ServiceStack/ServiceStackHost.cs#L376

Originally it was resolving the instance to check for existence, now it uses the new Exists method that checks without resolving an instance.

Zoran Knezevic:

Cool.  Thanks for the explanation.