Skip to content
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.

TaskCancelledException discovering tests #2982

Closed
rynowak opened this issue Oct 15, 2015 · 5 comments
Closed

TaskCancelledException discovering tests #2982

rynowak opened this issue Oct 15, 2015 · 5 comments
Assignees
Milestone

Comments

@rynowak
Copy link
Member

rynowak commented Oct 15, 2015

DTH is throwing every time while trying to load an assembly for test discovery. I hit this consistently with MVC.NoFun.sln and DNX 1.0.0-rc1-15899

Exception: System.AggregateException: One or more errors occurred. ---> System.InvalidOperationException: System.AggregateException: One or more errors occurred. ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at Microsoft.Dnx.Compilation.DesignTime.DesignTimeHostProjectCompiler.CompileProject(CompilationProjectContext projectContext, Func`1 referenceResolver, Func`1 resourcesResolver)
   at Microsoft.Dnx.Compilation.LibraryExporter.<>c__DisplayClass17_0.<ExportProject>b__0(CacheContext ctx)
   at Microsoft.Dnx.Compilation.Caching.CacheExtensions.<>c__DisplayClass0_0`1.<Get>b__0(CacheContext ctx)
   at Microsoft.Dnx.Compilation.Caching.Cache.CreateEntry(Object k, Func`2 acquire)
   at Microsoft.Dnx.Compilation.Caching.Cache.<>c__DisplayClass5_0.<AddEntry>b__0()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at System.Lazy`1.get_Value()
   at Microsoft.Dnx.Compilation.Caching.Cache.Get(Object key, Func`2 factory)
   at Microsoft.Dnx.Compilation.Caching.CacheExtensions.Get[T](ICache cache, Object key, Func`2 factory)
   at Microsoft.Dnx.Compilation.LibraryExporter.ExportProject(ProjectDescription project, String aspect)
   at Microsoft.Dnx.Compilation.LibraryExporter.GetExport(LibraryDescription library, String aspect)
   at Microsoft.Dnx.Compilation.LibraryExporter.GetExport(String name, String aspect)
   at Microsoft.Dnx.Compilation.LibraryExporter.GetExport(String name)
   at Microsoft.Dnx.Runtime.Compilation.RuntimeLibraryExporter.GetExport(String name)
   at Microsoft.Dnx.TestHost.TestServices.CreateTestServices(IServiceProvider applicationServices, Project project, ReportingChannel channel)
   at Microsoft.Dnx.TestHost.Program.<>c__DisplayClass2_0.<<Main>b__0>d.MoveNext()
---> (Inner Exception #0) System.Threading.Tasks.TaskCanceledException: A task was canceled.<---

   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Web.UnitTest.TestAdapter.Discovery.HostExtensions.GetTests(IHost host, ITestCaseDiscoverySink discovery, IMessageLogger logger, KRuntimeConfiguration testConfiguration)
   at Microsoft.VisualStudio.Web.UnitTest.TestAdapter.KUnitTestDiscoverer.GetTestCases(IEnumerable`1 sources, IMessageLogger logger, ITestCaseDiscoverySink discoverySink)
---> (Inner Exception #0) System.InvalidOperationException: System.AggregateException: One or more errors occurred. ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at Microsoft.Dnx.Compilation.DesignTime.DesignTimeHostProjectCompiler.CompileProject(CompilationProjectContext projectContext, Func`1 referenceResolver, Func`1 resourcesResolver)
   at Microsoft.Dnx.Compilation.LibraryExporter.<>c__DisplayClass17_0.<ExportProject>b__0(CacheContext ctx)
   at Microsoft.Dnx.Compilation.Caching.CacheExtensions.<>c__DisplayClass0_0`1.<Get>b__0(CacheContext ctx)
   at Microsoft.Dnx.Compilation.Caching.Cache.CreateEntry(Object k, Func`2 acquire)
   at Microsoft.Dnx.Compilation.Caching.Cache.<>c__DisplayClass5_0.<AddEntry>b__0()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at System.Lazy`1.get_Value()
   at Microsoft.Dnx.Compilation.Caching.Cache.Get(Object key, Func`2 factory)
   at Microsoft.Dnx.Compilation.Caching.CacheExtensions.Get[T](ICache cache, Object key, Func`2 factory)
   at Microsoft.Dnx.Compilation.LibraryExporter.ExportProject(ProjectDescription project, String aspect)
   at Microsoft.Dnx.Compilation.LibraryExporter.GetExport(LibraryDescription library, String aspect)
   at Microsoft.Dnx.Compilation.LibraryExporter.GetExport(String name, String aspect)
   at Microsoft.Dnx.Compilation.LibraryExporter.GetExport(String name)
   at Microsoft.Dnx.Runtime.Compilation.RuntimeLibraryExporter.GetExport(String name)
   at Microsoft.Dnx.TestHost.TestServices.CreateTestServices(IServiceProvider applicationServices, Project project, ReportingChannel channel)
   at Microsoft.Dnx.TestHost.Program.<>c__DisplayClass2_0.<<Main>b__0>d.MoveNext()
---> (Inner Exception #0) System.Threading.Tasks.TaskCanceledException: A task was canceled.<---
<---

========== Discover test finished: 0 found (0:00:01.356003) ==========
@avanderhoorn
Copy link
Member

This is blocking debugging from VS :( I'm on dnx 1.0.0-rc1-15904 from the CI feed.

Application startup exception: System.IO.FileLoadException: Could not load file or assembly 'Glimpse.AgentServer.Mvc.Sample' or one of its dependencies. General Exception (Exception from HRESULT: 0x80131500)
File name: 'Glimpse.AgentServer.Mvc.Sample' ---> System.AggregateException: One or more errors occurred. ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at Microsoft.Dnx.Compilation.DesignTime.DesignTimeHostProjectCompiler.CompileProject(CompilationProjectContext projectContext, Func`1 referenceResolver, Func`1 resourcesResolver)
   at Microsoft.Dnx.Compilation.LibraryExporter.<>c__DisplayClass17_0.<ExportProject>b__0(CacheContext ctx)
   at Microsoft.Dnx.Compilation.Caching.CacheExtensions.<>c__DisplayClass0_0`1.<Get>b__0(CacheContext ctx)
   at Microsoft.Dnx.Compilation.Caching.Cache.CreateEntry(Object k, Func`2 acquire)
   at Microsoft.Dnx.Compilation.Caching.Cache.<>c__DisplayClass5_0.<AddEntry>b__0()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at System.Lazy`1.get_Value()
   at Microsoft.Dnx.Compilation.Caching.Cache.Get(Object key, Func`2 factory)
   at Microsoft.Dnx.Compilation.Caching.CacheExtensions.Get[T](ICache cache, Object key, Func`2 factory)
   at Microsoft.Dnx.Compilation.LibraryExporter.ExportProject(ProjectDescription project, String aspect)
   at Microsoft.Dnx.Compilation.LibraryExporter.GetExport(LibraryDescription library, String aspect)
   at Microsoft.Dnx.Compilation.LibraryExporter.GetExport(String name, String aspect)
   at Microsoft.Dnx.Compilation.CompilationEngine.LoadProject(Project project, FrameworkName targetFramework, String aspect, IAssemblyLoadContext loadContext, AssemblyName assemblyName)
   at Microsoft.Dnx.Runtime.Loader.ProjectAssemblyLoader.Load(AssemblyName assemblyName, IAssemblyLoadContext loadContext)
   at Microsoft.Dnx.Runtime.Loader.ProjectAssemblyLoader.Load(AssemblyName assemblyName)
   at Microsoft.Dnx.Host.LoaderContainer.Load(AssemblyName assemblyName)
   at Microsoft.Dnx.Host.DefaultLoadContext.LoadAssembly(AssemblyName assemblyName)
   at Microsoft.Dnx.Runtime.Loader.AssemblyLoaderCache.GetOrAdd(AssemblyName name, Func`2 factory)
   at Microsoft.Dnx.Runtime.Loader.LoadContext.LoadAssemblyImpl(AssemblyName assemblyName)
   at Microsoft.Dnx.Runtime.Loader.LoadContext.ResolveAssembly(Object sender, ResolveEventArgs args)
   at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)
---> (Inner Exception #0) System.Threading.Tasks.TaskCanceledException: A task was canceled.<---

   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Microsoft.AspNet.Hosting.Startup.StartupLoader.FindStartupType(String startupAssemblyName, IList`1 diagnosticMessages)
   at Microsoft.AspNet.Hosting.Internal.HostingEngine.EnsureStartup()
   at Microsoft.AspNet.Hosting.Internal.HostingEngine.EnsureApplicationServices()
   at Microsoft.AspNet.Hosting.Internal.HostingEngine.BuildApplication()


Hosting environment: Production
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.

@muratg muratg added this to the 1.0.0-rc1 milestone Oct 16, 2015
@muratg
Copy link
Contributor

muratg commented Oct 16, 2015

Troy will be investigating this today.

@troydai
Copy link
Contributor

troydai commented Oct 18, 2015

Found the problem. I'm going to submit a PR soon in which I'll explain the cause.

@mrahhal
Copy link

mrahhal commented Oct 18, 2015

Finally 👍

@troydai
Copy link
Contributor

troydai commented Oct 19, 2015

Fixed in a383e20

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants