title: Where is this System.MissingMethodException occurring? How can I tell?
body: <p>I am a newbie to ASP.NET MVC (v2), and I am trying to use a strongly-typed view tied to a model object that contains two optional multi-select listbox objects.  Upon clicking the submit button, these objects may have 0 or more values selected for them.</p>
  
  <p>My model class looks like this:</p>
  
  <pre><code>using System;
  using System.Web.Mvc;
  using System.Collections.Generic;
  namespace ModelClasses.Messages
  {
      public class ComposeMessage
      {
          public bool is_html { get; set; }
          public bool is_urgent { get; set; }
          public string message_subject { get; set; }
          public string message_text { get; set; }
          public string action { get; set; }
          public MultiSelectList recipients { get; set; }
          public MultiSelectList recipient_roles { get; set; }
  
          public ComposeMessage()
          {
              this.is_html = false;
              this.is_urgent = false;
              this.recipients = new MultiSelectList(new Dictionary&lt;int, string&gt;(), "Key", "Value");
              this.recipient_roles = new MultiSelectList(new Dictionary&lt;int, string&gt;(), "Key", "Value");
          }
      }
  }
  </code></pre>
  
  <p>My view looks like this:</p>
  
  <pre><code>&lt;%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage&lt;ModelClasses.Messages.ComposeMessage&gt;" %&gt;
  &lt;asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"&gt;Compose A Message
  &lt;/asp:Content&gt;
  &lt;asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"&gt;
  &lt;h2&gt;
   Compose A New Message:&lt;/h2&gt;
   &lt;br /&gt;
  &lt;span id="navigation_top"&gt;
  &lt;%= Html.ActionLink("\\Home", "Index", "Home") %&gt;&lt;%= Html.ActionLink("\\Messages", "Home") %&gt;&lt;/span&gt;
  &lt;% using (Html.BeginForm())
   { %&gt;
  &lt;fieldset&gt;
  &lt;legend&gt;Message Headers&lt;/legend&gt;
  &lt;label for="message_subject"&gt;
  Subject:&lt;/label&gt;
  &lt;%= Html.TextBox("message_subject")%&gt;
  &lt;%= Html.ValidationMessage("message_subject")%&gt;
  &lt;label for="selected_recipients"&gt;
  Recipient Users:&lt;/label&gt;
  &lt;%= Html.ListBox("recipients") %&gt;
  &lt;%= Html.ValidationMessage("selected_recipients")%&gt;
  &lt;label for="selected_recipient_roles"&gt;
  Recipient Roles:&lt;/label&gt;
  &lt;%= Html.ListBox("recipient_roles") %&gt;
  &lt;%= Html.ValidationMessage("selected_recipient_roles")%&gt;
  &lt;label for="is_urgent"&gt;
  Urgent?&lt;/label&gt;
  &lt;%= Html.CheckBox("is_urgent") %&gt;
  &lt;%= Html.ValidationMessage("is_urgent")%&gt;
  &lt;/fieldset&gt;
  &lt;fieldset&gt;
  &lt;legend&gt;Message Text&lt;/legend&gt;
  &lt;%= Html.TextArea("message_text") %&gt;
  &lt;%= Html.ValidationMessage("message_text")%&gt;
  &lt;/fieldset&gt;
  &lt;input type="reset" name="reset" id="reset" value="Reset" /&gt;
  &lt;input type="submit" name="action" id="send_message" value="Send" /&gt;
  &lt;% } %&gt;
  &lt;span id="navigation_bottom"&gt;
  &lt;%= Html.ActionLink("\\Home", "Index", "Home") %&gt;&lt;%= Html.ActionLink("\\Messages", "Home") %&gt;&lt;/span&gt;
  &lt;/asp:Content&gt;
  &lt;asp:Content ID="Content3" ContentPlaceHolderID="Scripts" runat="server"&gt;
  &lt;/asp:Content&gt;
  </code></pre>
  
  <p>I have a parameterless ActionResult in my MessagesController like this:</p>
  
  <pre><code>    [Authorize]
      public ActionResult ComposeMessage()
      {
          ModelClasses.Messages.ComposeMessage FormData = new ModelClasses.Messages.ComposeMessage();
          Common C = (Common)Session["Common"];
          FormData.recipients = new MultiSelectList(C.AvailableUsers, "Key", "Value");
          FormData.recipient_roles = new MultiSelectList(C.AvailableRoles, "Key", "Value");
          return View(FormData);
      }
  </code></pre>
  
  <p>...and my model-based controller looks like this:</p>
  
  <pre><code>    [Authorize, AcceptVerbs(HttpVerbs.Post)]
      public ActionResult ComposeMessage(ModelClasses.Messages.ComposeMessage FormData)
      {
          MyUserClass CurrentUser = (MyUserClass )Session["CurrentUser"];            
          Common C = (Common)Session["Common"];
      //... (business logic)
      return View(FormData);
      }
  </code></pre>
  
  <p>Problem is, I can access the page fine before a submit.  When I actually make selections and press the submit button, however, I get:</p>
  
  <p><code>
      Server Error in '/' Application.
      No parameterless constructor defined for this object.
      Description: 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.
      Exception Details: System.MissingMethodException: No parameterless constructor defined for this object.
      Source Error:
      An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
      Stack Trace:
      [MissingMethodException: No parameterless constructor defined for this object.]
      System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean&amp; canBeCached, RuntimeMethodHandle&amp; ctor, Boolean&amp; bNeedSecurityCheck) +0
      System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) +86
      System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) +230
      System.Activator.CreateInstance(Type type, Boolean nonPublic) +67
      System.Activator.CreateInstance(Type type) +6
      System.Web.Mvc.DefaultModelBinder.CreateModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Type modelType) +307
      System.Web.Mvc.DefaultModelBinder.BindSimpleModel(ControllerContext controllerContext, ModelBindingContext bindingContext, ValueProviderResult valueProviderResult) +495
      System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +473
      System.Web.Mvc.DefaultModelBinder.GetPropertyValue(ControllerContext controllerContext, ModelBindingContext bindingContext, PropertyDescriptor propertyDescriptor, IModelBinder propertyBinder) +45
      System.Web.Mvc.DefaultModelBinder.BindProperty(ControllerContext controllerContext, ModelBindingContext bindingContext, PropertyDescriptor propertyDescriptor) +642
      System.Web.Mvc.DefaultModelBinder.BindProperties(ControllerContext controllerContext, ModelBindingContext bindingContext) +144
      System.Web.Mvc.DefaultModelBinder.BindComplexElementalModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Object model) +95
      System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +2386
      System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +539
      System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor) +447
      System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor) +173
      System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +801
      System.Web.Mvc.Controller.ExecuteCore() +151
      System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +105
      System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +36
      System.Web.Mvc.&lt;>c__DisplayClass8.b__4() +65
      System.Web.Mvc.Async.&lt;>c__DisplayClass1.b__0() +44
      System.Web.Mvc.Async.&lt;>c__DisplayClass8<code>1.&lt;BeginSynchronous&gt;b__7(IAsyncResult _) +42
      System.Web.Mvc.Async.WrappedAsyncResult</code>1.End() +140
      System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +54
      System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40
      System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +52
      System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +36
      System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8677678
      System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +155
      Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3082 
  </code></p>
  
  <p>This error shows up before I can trap it.  I have no idea where it's choking, or what it's choking on.  I don't see any point of this model that cannot be created with a parameterless constructor, and I can't find out where it's dying... Help is appreciated, thanks.</p>
  
  <p>-Jeremy</p>