title: Dependency Injection Constructor doesn't sees object
body: <p>In fresh MAUI.NET I have registered the singletons in MauiProgram.cs</p>
  <pre><code>builder.Services.AddSingleton&lt;InformationView&gt;();
  builder.Services.AddSingleton&lt;InformationViewModel&gt;();
  </code></pre>
  <p>I have public empty class InformationViewModel and I have default ContentView (XAML) item with the .cs part content like this:</p>
  <pre><code>    public InformationViewModel viewModel;
      public InformationView(InformationViewModel viewModel)
      {
          InitializeComponent();
          viewModel = viewModel;
      }
  </code></pre>
  <p>in MainPage.cs I try to get my registered singletons like that:</p>
  <pre><code>    public MainPage()
      {
          InitializeComponent();
          InformationView view = new InformationView(InformationViewModel informationViewModel);
      }
  </code></pre>
  <p>I have look for a <code>MonkeyFinder</code> sample application provided by Microsoft and its training by Gerald Versluis. It seems that <code>MonkeyService</code> is done in same way and is working while I get this errors in the above line of MainPage.cs:</p>
  <blockquote>
  <p>Error CS1729  'InformationView' does not contain a constructor that takes 2 arguments
  Error   CS1003  Syntax error, ',' expected<br />
  Error   CS0119  'InformationViewModel' is a type, which is not valid in the given context<br />
  Error   CS0103  The name 'informationViewModel' does not exist in the current context</p>
  </blockquote>
  <p>What should I do to fix it?</p>
  <p><strong>Edit</strong></p>
  <p>Following seems to be working and &quot;singleton&quot; properties are handled - I got always the same instance whenever I call it.</p>
  <pre><code>InformationViewModel informationViewModel = new InformationViewModel();
  InformationView view = new InformationView(informationViewModel);
  </code></pre>
  <p><strong>Edit 2</strong>
  It wasn't obvious for me, that you need to trigger &quot;the first object in hierarchy of construction&quot; by DI and this would happen. I was expecting that if I create a &quot;new instance&quot; it would not &quot;fire&quot; the whole DI for internal dependencies. So <code>MauiWinUIApplication.Current.Services.GetService&lt;InformationView&gt;();</code> would do all DI I was expecting.</p>