title: Strange VB.Net performance issue on start up
body: <p>My exe (vb project) when launched takes a minute to show the main form. On investigation, I found the below. It may appear unbelievable but it is happening. Even lot of googling didn't help.</p>
  
  <p>Happens only in exe and not when run from Visual Studio.
  Happens only in Released mode.
  Happens on all machines. Already happening in production for all users.
  Connecting to a different database does not make any difference(Not a data loading issue).
  SQL Server profiler shows no activity for that one minute.</p>
  
  <p>Logging revealed that the culprit seems to be the following line:</p>
  
  
  
  <pre class="lang-vb prettyprint-override"><code>gfrmMain = New frmMain 'frmMain is a windows form
  </code></pre>
  
  <p>Further logging revealed that one minute delay happens before InitializeComponent() is called in frmMain constructor.</p>
  
  <pre class="lang-vb prettyprint-override"><code>Public Sub New()
      MyBase.New()
  
      'Reached this line after a minute - what???
      InitializeComponent()
      ...
  End Sub
  </code></pre>
  
  <p>Process monitor revealed that there was no registry, file system, network activity for the process. It just sits idle.</p>
  
  <p>Things I have tried:</p>
  
  <ol>
  <li>Unchecking optimisations for released mode</li>
  <li>Removing "MyBase.New()" - did not make any difference</li>
  </ol>
  
  <p>I am clueless what else to try?</p>
  
  <p>Note: Solution is a mix of c# and vb projects. In fact main vb project and rest all c# projects. It started happening few months ago. All was fine until then (launched in few secs).</p>
  
  <p><img src="https://i.stack.imgur.com/FNFYN.png" alt="VS Profiler results"></p>