Hi,
If a disposable class is registered (reuse scope: none) using a container and then i try to resolve it, then new app domain creation (in a separate thread) doesn’t work and shows the following exception:
Type is not resolved for member ‘ServiceStack.DispsableTracker,ServiceStack, Version=4.0.56.0, Culture=neutral, PublicKeyToken=null’.
I would appreciate any assistance.
thanks
public class Global : System.Web.HttpApplication
{
public class TestDisposible : IDisposable
{
public void Dispose()
{
}
}
/// <summary>
/// Create your ServiceStack web service application with a singleton AppHost.
/// </summary>
public class HelloAppHost : AppHostBase
{
/// <summary>
/// Initializes a new instance of your ServiceStack application, with the specified name and assembly containing the services.
/// </summary>
public HelloAppHost() : base("Hello Web Services", typeof(HelloService).Assembly) { }
/// <summary>
/// Configure the container with the necessary routes for your ServiceStack application.
/// </summary>
/// <param name="container">The built-in IoC used with ServiceStack.</param>
public override void Configure(Container container)
{
//Register user-defined REST-ful urls. You can access the service at the url similar to the following.
//http://localhost/ServiceStack.Hello/servicestack/hello or http://localhost/ServiceStack.Hello/servicestack/hello/John%20Doe
//You can change /servicestack/ to a custom path in the web.config.
Routes
.Add<Hello>("/hello")
.Add<Hello>("/hello/{Name}");
container.RegisterAutoWired<TestDisposible>().ReusedWithin(ReuseScope.None);
}
}
protected void Application_Start(object sender, EventArgs e)
{
(new HelloAppHost()).Init();
new Thread(new ThreadStart(() =>
{
// Following test works
Test();
var d = HelloAppHost.Instance.Container.Resolve<TestDisposible>();
// Following execution fails
Test();
})).Start();
}
private void Test()
{
var domain = AppDomain.CreateDomain("Test");
var list = domain.GetAssemblies();
AppDomain.Unload(domain);
}