Error while unloading appdomain

971 views
Skip to first unread message

Josh Coffman

unread,
Mar 28, 2012, 1:08:47 PM3/28/12
to httpf...@googlegroups.com
Hi,

  I've been getting an error unloading AppDomain in one of my tests which uses Fiddler Core. It happens when I start fiddler and perform an HTTP Get on a simple page and then shutdown fiddler. If I don't perform the GET, it works fine. The Get operation works fine in another set of tests which don't use FiddlerCore.

  I found an article that mentions having to ensure unmanaged resources are released. Is there unmanaged code in FiddlerCore? Do I need to make sure they are getting cleaned up? If so, how?

Thanks,
Josh


Error:
Test 'M:MyTests.WebFilter.MonitorTests.can_start_monitor' failed: Error while unloading appdomain. (Exception from HRESULT: 0x80131015)
System.CannotUnloadAppDomainException: Error while unloading appdomain. (Exception from HRESULT: 0x80131015)
at System.AppDomain.Unload(AppDomain domain)
at Xunit.ExecutorWrapper.Dispose()
at Xunit.Runner.TdNet.TdNetRunner.TestDriven.Framework.ITestRunner.RunMember(ITestListener listener, Assembly assembly, MemberInfo member)
at TestDriven.TestRunner.AdaptorTestRunner.Run(ITestListener testListener, ITraceListener traceListener, String assemblyPath, String testPath)
at TestDriven.TestRunner.ThreadTestRunner.Runner.Run()


Failing Test: 

[Fact]

        public void can_start_monitor()
        {
            MonitorService mon = new MonitorService();
            mon.Start();
            var client = new ApiClient(ApiTests.BASE_URL);
            client.Ping(); //performs a HTTP GET call
            System.Threading.Thread.Sleep(3000);
            mon.Stop();
        }



Passing Version of Test:

[Fact]

        public void can_start_monitor()
        {
            MonitorService mon = new MonitorService();
            mon.Start();
            var client = new ApiClient(ApiTests.BASE_URL);
            //client.Ping();
            System.Threading.Thread.Sleep(3000);
            mon.Stop();
        }


EricLaw

unread,
Mar 28, 2012, 1:30:25 PM3/28/12
to httpf...@googlegroups.com

Unloading an AppDomain with an outstanding network request seems likely to fail. It may help to call Abort() on any outstanding requests (or even allow some lengthy timeout after calling Stop()), but generally speaking I wouldn't expect an AppDomain hosting a proxy to cleanly unload.

Reply all
Reply to author
Forward
0 new messages