Possibly swallowed exception in missing map

16 views
Skip to first unread message

Michael Powell

unread,
Sep 18, 2016, 4:12:05 PM9/18/16
to AutoMapper-users

I am using v4.2.1 (latest v4, AFAIK).

Here is the raw response I get from the server, which does not get raised at all in the debugger, but does cause a 500 error.

 The 500 is correct, because the mapping indeed was not there. However, I don't know why I didn't get the exception in my VS debugging session.

Here is the raw, but which took me a RestEasy Chrome extension to find that out:

Host: localhost:7881


500 Internal Server Error
Date: Sun, 18 Sep 2016 20:06:20 GMT
Server: Microsoft-IIS/10.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Content-Type: text/html; charset=utf-8
Cache-Control: private
X-SourceFiles: =?UTF-8?B?RDpcU291cmNlXEtpbmdkb20gU29mdHdhcmVcRm9vdGJhbGxTaW11bGF0b3JcV29ya2luZ1xzcmNcRm9vdGJhbGwuV2ViLkFzcE5ldFxUcmFpbmluZ1xCZWdpbg==?=
Content-Length: 14660
<!DOCTYPE html>
<html>
    <head>
        <title>Missing type map configuration or unsupported mapping.<br><br>Mapping types:<br>Player -&gt; InternalGetPlayerInfoViewModel<br>Football.Models.Player -&gt; Football.Web.AspNet.Models.Training.InternalGetPlayerInfoViewModel<br><br>Destination path:<br>InternalGetPlayerInfoViewModel<br><br>Source value:<br>Football.Models.Player (cac2cae6-14da-4f53-8743-a67f00cc9c73)</title>
        <meta name="viewport" content="width=device-width" />
        <style>
         body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} 
         p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
         b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
         H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
         H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
         pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}
         .marker {font-weight: bold; color: black;text-decoration: none;}
         .version {color: gray;}
         .error {margin-bottom: 10px;}
         .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
         @media screen and (max-width: 639px) {
          pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; }
         }
         @media screen and (max-width: 479px) {
          pre { width: 280px; }
         }
        </style>
    </head>

    <body bgcolor="white">

            <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>

            <h2> <i>Missing type map configuration or unsupported mapping.<br><br>Mapping types:<br>Player -&gt; InternalGetPlayerInfoViewModel<br>Football.Models.Player -&gt; Football.Web.AspNet.Models.Training.InternalGetPlayerInfoViewModel<br><br>Destination path:<br>InternalGetPlayerInfoViewModel<br><br>Source value:<br>Football.Models.Player (cac2cae6-14da-4f53-8743-a67f00cc9c73)</i> </h2></span>

            <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">

            <b> Description: </b>An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

            <br><br>

            <b> Exception Details: </b>AutoMapper.AutoMapperMappingException: Missing type map configuration or unsupported mapping.<br><br>Mapping types:<br>Player -&gt; InternalGetPlayerInfoViewModel<br>Football.Models.Player -&gt; Football.Web.AspNet.Models.Training.InternalGetPlayerInfoViewModel<br><br>Destination path:<br>InternalGetPlayerInfoViewModel<br><br>Source value:<br>Football.Models.Player (cac2cae6-14da-4f53-8743-a67f00cc9c73)<br><br>

            <b>Source Error:</b> <br><br>

            <table width=100% bgcolor="#ffffcc">
               <tr>
                  <td>
                      <code><pre>

Line 46:              * No need to follow up with another one. */
Line 47: 
<font color=red>Line 48:             var internalViewModel = _mapper.Map&lt;Player, InternalGetPlayerInfoViewModel&gt;(
</font>Line 49:                 player, opts =&gt; opts.AfterMap((s, d) =&gt; d.User = IdentityUser));
Line 50: </pre></code>

                  </td>
               </tr>
            </table>

            <br>

            <b> Source File: </b> d:\Source\Kingdom Software\FootballSimulator\Working\src\Football.Web.AspNet\Controllers\TrainingController.cs<b> &nbsp;&nbsp; Line: </b> 48
            <br><br>

            <b>Stack Trace:</b> <br><br>

            <table width=100% bgcolor="#ffffcc">
               <tr>
                  <td>
                      <code><pre>

[AutoMapperMappingException: Missing type map configuration or unsupported mapping.

Mapping types:
Player -&gt; InternalGetPlayerInfoViewModel
Football.Models.Player -&gt; Football.Web.AspNet.Models.Training.InternalGetPlayerInfoViewModel

Destination path:
InternalGetPlayerInfoViewModel

Source value:
Football.Models.Player (cac2cae6-14da-4f53-8743-a67f00cc9c73)]
   AutoMapper.MappingEngine.Map(ResolutionContext context) +997
   AutoMapper.Mapper.MapCore(Object source, Type sourceType, Type destinationType, MappingOperationOptions options) +220
   AutoMapper.Mapper.AutoMapper.IMapper.Map(TSource source, Action`1 opts) +410
   Football.Web.AspNet.Controllers.TrainingController.GetTrainingResultsAsync(Player player, Func`2 getJsonString) in d:\Source\Kingdom Software\FootballSimulator\Working\src\Football.Web.AspNet\Controllers\TrainingController.cs:48
   Football.Web.AspNet.Controllers.&lt;Begin&gt;d__7.MoveNext() in d:\Source\Kingdom Software\FootballSimulator\Working\src\Football.Web.AspNet\Controllers\TrainingController.cs:72
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +13892036
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61
   System.Runtime.CompilerServices.TaskAwaiter.GetResult() +28
   System.Threading.Tasks.TaskHelpersExtensions.ThrowIfFaulted(Task task) +81
   System.Web.Mvc.Async.TaskAsyncActionDescriptor.EndExecute(IAsyncResult asyncResult) +166
   System.Web.Mvc.Async.&lt;&gt;c__DisplayClass37.&lt;BeginInvokeAsynchronousActionMethod&gt;b__36(IAsyncResult asyncResult) +93
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +79
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +187
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +136
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +76
   System.Web.Mvc.Async.AsyncInvocationWithFilters.&lt;InvokeActionMethodFilterAsynchronouslyRecursive&gt;b__3d() +164
   System.Web.Mvc.Async.&lt;&gt;c__DisplayClass46.&lt;InvokeActionMethodFilterAsynchronouslyRecursive&gt;b__3f() +549
   System.Web.Mvc.Async.&lt;&gt;c__DisplayClass33.&lt;BeginInvokeActionMethodWithFilters&gt;b__32(IAsyncResult asyncResult) +75
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +79
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +187
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +136
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +76
   System.Web.Mvc.Async.&lt;&gt;c__DisplayClass2b.&lt;BeginInvokeAction&gt;b__1c() +114
   System.Web.Mvc.Async.&lt;&gt;c__DisplayClass21.&lt;BeginInvokeAction&gt;b__1e(IAsyncResult asyncResult) +306
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +75
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +176
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +72
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +60
   System.Web.Mvc.Controller.&lt;BeginExecuteCore&gt;b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +70
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +135
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +176
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +72
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +51
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +66
   System.Web.Mvc.Controller.&lt;BeginExecute&gt;b__15(IAsyncResult asyncResult, Controller controller) +60
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +98
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +176
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +72
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +51
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +60
   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +60
   System.Web.Mvc.MvcHandler.&lt;BeginProcessRequest&gt;b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +70
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +135
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +176
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +72
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +51
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +59
   System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +178
</pre></code>

                  </td>
               </tr>
            </table>

            <br>

            <hr width=100% size=1 color=silver>

            <b>Version Information:</b>&nbsp;Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.118.0

            </font>

    </body>
</html>
<!-- 
[AutoMapperMappingException]: Missing type map configuration or unsupported mapping.

Mapping types:
Player -&gt; InternalGetPlayerInfoViewModel
Football.Models.Player -&gt; Football.Web.AspNet.Models.Training.InternalGetPlayerInfoViewModel

Destination path:
InternalGetPlayerInfoViewModel

Source value:
Football.Models.Player (cac2cae6-14da-4f53-8743-a67f00cc9c73)
   at Football.Web.AspNet.Controllers.TrainingController.GetTrainingResultsAsync[TResponseViewModel](Player player, Func`2 getJsonString) in d:\Source\Kingdom Software\FootballSimulator\Working\src\Football.Web.AspNet\Controllers\TrainingController.cs:line 48
   at Football.Web.AspNet.Controllers.TrainingController.<Begin>d__7.MoveNext() in d:\Source\Kingdom Software\FootballSimulator\Working\src\Football.Web.AspNet\Controllers\TrainingController.cs:line 72
--- 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.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at System.Threading.Tasks.TaskHelpersExtensions.ThrowIfFaulted(Task task)
   at System.Web.Mvc.Async.TaskAsyncActionDescriptor.EndExecute(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<BeginInvokeAsynchronousActionMethod>b__36(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
   at System.Web.Mvc.Async.AsyncResultWrapper.End[TResult](IAsyncResult asyncResult, Object tag)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
   at System.Web.Mvc.Async.AsyncResultWrapper.End[TResult](IAsyncResult asyncResult, Object tag)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<>c__DisplayClass2b.<BeginInvokeAction>b__1c()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
   at System.Web.Mvc.Async.AsyncResultWrapper.End[TResult](IAsyncResult asyncResult, Object tag)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult)
   at System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
   at System.Web.Mvc.Async.AsyncResultWrapper.End[TResult](IAsyncResult asyncResult, Object tag)
   at System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag)
   at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
   at System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
   at System.Web.Mvc.Async.AsyncResultWrapper.End[TResult](IAsyncResult asyncResult, Object tag)
   at System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag)
   at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
   at System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult)
   at System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
   at System.Web.Mvc.Async.AsyncResultWrapper.End[TResult](IAsyncResult asyncResult, Object tag)
   at System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag)
   at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
   at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result)
   at System.Web.HttpApplication.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar)
-->

Jimmy Bogard

unread,
Sep 19, 2016, 10:36:15 AM9/19/16
to automapper-users
Hmmmmm the only exception I ever swallowed was the NullReferenceException as part of resolving. Is it a debug setting in Visual Studio maybe?

--
You received this message because you are subscribed to the Google Groups "AutoMapper-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to automapper-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Powell

unread,
Sep 19, 2016, 10:48:38 AM9/19/16
to AutoMapper-users


On Monday, September 19, 2016 at 10:36:15 AM UTC-4, Jimmy Bogard wrote:
Hmmmmm the only exception I ever swallowed was the NullReferenceException as part of resolving. Is it a debug setting in Visual Studio maybe?

Everything User-handled is enabled. I suppose I could enable Thrown CLR exceptions, for example.

Well, NRE could potentially be it, since it is trying to resolve a mapping that isn't there.
 
To unsubscribe from this group and stop receiving emails from it, send an email to automapper-use...@googlegroups.com.

Michael Powell

unread,
Sep 19, 2016, 11:05:20 AM9/19/16
to AutoMapper-users


On Monday, September 19, 2016 at 10:48:38 AM UTC-4, Michael Powell wrote:


On Monday, September 19, 2016 at 10:36:15 AM UTC-4, Jimmy Bogard wrote:
Hmmmmm the only exception I ever swallowed was the NullReferenceException as part of resolving. Is it a debug setting in Visual Studio maybe?

Everything User-handled is enabled. I suppose I could enable Thrown CLR exceptions, for example.

Another observation, this is happening in an "async Task<ActionResult>" Controller action, from the controller/response perspective; i.e. I see a 500 error, and buried within the response is the exception. However, nothing that "ASP.NET MVC" "sees", per se, so no exception screen or anything like that.
Reply all
Reply to author
Forward
0 new messages