2

I have a web API application, and I get this error:

at System.Collections.Generic.List`1.Enumerator.MoveNext()
at System.Linq.Enumerable.<ConcatIterator>d__58`1.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at System.Web.Http.Services.DefaultServices.GetServices(Type serviceType)
at System.Web.Http.ServicesExtensions.GetServices[TService](ServicesContainer services)
at System.Web.Http.ModelBinding.ModelBinderAttribute.GetModelBinderProvider(HttpConfiguration configuration)
at System.Web.Http.ModelBinding.ModelBinderAttribute.GetModelBinder(HttpConfiguration configuration, Type modelType)
at System.Web.Http.ModelBinding.ModelBinderAttribute.GetBinding(HttpParameterDescriptor parameter)
at System.Web.Http.ModelBinding.DefaultActionValueBinder.GetParameterBinding(HttpParameterDescriptor parameter)
at System.Array.ConvertAll[TInput,TOutput](TInput[] array, Converter`2 converter)
at System.Web.Http.ModelBinding.DefaultActionValueBinder.GetBinding(HttpActionDescriptor actionDescriptor)
at System.Web.Http.Tracing.Tracers.ActionValueBinderTracer.System.Web.Http.Controllers.IActionValueBinder.GetBinding(HttpActionDescriptor actionDescriptor)
at System.Web.Http.Controllers.HttpActionDescriptor.get_ActionBinding()
at System.Web.Http.Controllers.ApiControllerActionSelector.ActionSelectorCacheItem..ctor(HttpControllerDescriptor controllerDescriptor)
at System.Web.Http.Controllers.ApiControllerActionSelector.GetInternalSelector(HttpControllerDescriptor controllerDescriptor)
at System.Web.Http.Controllers.ApiControllerActionSelector.SelectAction(HttpControllerContext controllerContext)
at System.Web.Http.Tracing.Tracers.HttpActionSelectorTracer.<>c__DisplayClass2.<System.Web.Http.Controllers.IHttpActionSelector.SelectAction>b__0()
at System.Web.Http.Tracing.ITraceWriterExtensions.TraceBeginEnd(ITraceWriter traceWriter, HttpRequestMessage request, String category, TraceLevel level, String operatorName, String operationName, Action`1 beginTrace, Action execute, Action`1 endTrace, Action`1 errorTrace)
at System.Web.Http.Tracing.Tracers.HttpActionSelectorTracer.System.Web.Http.Controllers.IHttpActionSelector.SelectAction(HttpControllerContext controllerContext)
at System.Web.Http.ApiController.ExecuteAsync(HttpControllerContext controllerContext, CancellationToken cancellationToken)
at System.Web.Http.Tracing.Tracers.HttpControllerTracer.<ExecuteAsyncCore>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Tracing.ITraceWriterExtensions.<TraceBeginEndAsyncCore>d__18`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()

No part of my code is shown here. How can I debug this?

I've done a global exception handler via AppDomain.CurrentDomain.UnhandledException and it's not hit. I've added a customized ExceptionFilter to web API, and again, it's not executed for this error.

I have no idea how to debug this. Could you help please?

  • what's the inner exception ? you have more info in the inner exception regarding the actual exception that was thrown from with in a task construct(which is what your seeing) it swallows the exception and wraps it in it's own. it is not thrown unleas instructed to – eran otzap Feb 13 '17 at 11:12
  • 1
    @eranotzap, that's why I asked **how to debug**. This is all I get. I call a service, a simple get service, and the yellow page of death comes with this message. Nothing in event viewer, nothing in my global exception handler or in ExceptionFilter. – Armin kheirkhahan Feb 13 '17 at 11:14
  • i never used the exception filter... you said your application registered to AppDomain.CurrentDomain.UnhandledException event correct ? ooo.. now i get it. you said that it's not hit . – eran otzap Feb 13 '17 at 11:15
  • 1
    TaskScheduler.UnobservedTaskException place this as well. your exception comes from with in a task – eran otzap Feb 13 '17 at 11:17
  • Just based on the stacktrace, it kind of looks like something in dependency injection.. Have you registered services with the standard DI container? – juunas Feb 13 '17 at 11:21
  • What *Is* the exception thrown? – rene Feb 13 '17 at 11:26
  • @rene, OP says that this is ALL he sees. – Saeed Neamati Feb 13 '17 at 12:27
  • There must be an exception name, i.e. class name like "ArgumentException", "OutOfMemoryException" etc. – Thomas Weller Feb 13 '17 at 18:55
  • Have you tried attaching a debugger or [taking a crash dump](http://stackoverflow.com/questions/24874027/how-do-i-take-a-good-crash-dump-for-net)? – Thomas Weller Feb 13 '17 at 18:58

0 Answers0