title: How to resolve System.Reflection.TargetInvocationException' error?
body: <p>I'm using the MVVM Light libraries in my application which provides an Ioc container, called the ViewModelLocator. But when I set up a second property in the locator for a new View Model, I get a <code>System.Reflection.TargetInvocationException</code> </p>
  
  <p>I debugged this by looking at the inner exception, and it seems that this error is thrown as I didn't specify that a parameter is being passed into the other VM, in my locator.</p>
  
  <p>Does anyone know how I can set up my <code>ViewSubjectGradeViewModel</code> property in the locator class to account for the ScoreModel parameter that is passed into that model?</p>
  
  <p>This is the ViewModelLocator for reference:</p>
  
  <pre><code>namespace LC_Points.ViewModel
  {
      /// &lt;summary&gt;
      /// This class contains static references to all the view models in the
      /// application and provides an entry point for the bindings.
      /// &lt;/summary&gt;
      public class ViewModelLocator
      {
          public ViewModelLocator()
          {
              ServiceLocator.SetLocatorProvider(() =&gt; SimpleIoc.Default);
  
              SimpleIoc.Default.Register&lt;MainViewModel&gt;();
              SimpleIoc.Default.Register&lt;ViewSubjectGradeViewModel&gt;();    
          }
  
          public MainViewModel MainPage
          {
              get { return ServiceLocator.Current.GetInstance&lt;MainViewModel&gt;(); }
          }
  
          public ViewSubjectGradeViewModel ViewSubjectGradePage
          {
              get { return ServiceLocator.Current.GetInstance&lt;ViewSubjectGradeViewModel&gt;(); }
          }
  
          public static void Cleanup()
          {
              // TODO Clear the ViewModels
          }
      }
  }
  </code></pre>
  
  <p>And this is the new VM that I want to set a property for in the locator class:</p>
  
  <pre><code>namespace LC_Points.ViewModel
  {
      public class ViewSubjectGradeViewModel 
      {
          public ViewSubjectGradeViewModel(IEnumerable&lt;ScoreModel&gt; addedSubjectGradePairs)
          {
              this.AddedSubjectGradePairsCopy = addedSubjectGradePairs;           
          }
  
          //Property for collection passed from MainViewModel
          public IEnumerable&lt;ScoreModel&gt; AddedSubjectGradePairsCopy { get; set; }         
      }
  }
  </code></pre>