title: Icon in Task Bar for ClickOnce Application Vanishes when App Starts
body: <p>After logging in to our ClickOnce app, the icon in the task bar vanishes.  </p>
  
  <p>Some details: This app, which we'll call ThisApp, was originally written in .NET 2.0 (VB) and has been migrated forward to .NET 4.0  But this issue has been persistent all along the way.  In Windows 7 (and I think it did the same thing in Vista and XP...) it behaves like this:</p>
  
  <p>When you go to Start >  All Programs > ThisApp and first start it up, the icon appears in the task bar, as it should.  You are first presented with a log-on screen.  If you enter proper credentials, the log-on screen is replaced by the actual UI for the app, but at the same time, the icon in the task bar simply vanishes.  You can still see the UI screen for the app, but the task bar icon is gone.</p>
  
  <p>At that point, if you should happen to minimize the app, there is literally no way to bring it back, other than going again to  >  All Programs > ThisApp, which gives you a notice that says "An instance of ThisApp is already running", but at least at that point it restores the icon to the task bar.</p>
  
  <p>If, just after logging in and while the icon is missing, you should happen to click on another window and send ThisApp to the background, the icon remains missing.  But, if you then click on ThisApp's window and bring it back to the front, the icon suddenly returns to the task bar.</p>
  
  <p>I've stepped through the initial logon process in debug.  I've looked at trace logs.  I've looked at the Windows event log.  I've spent time on Google. I can find NO clues as to why this is happening. It's been going on for years and never been enough of an issue to warrant any developer time on it.  But now (finally?) a large enough client is complaining about this, and we need to finally figure this out.  I've found a lot of questions about ClickOne apps and their icons, but I've not found one that addresses this particular issue.</p>
  
  <p>Anyone ever seen something like this? Ever dealt with it?  Any ideas?</p>
  
  <p>Thanks!!!</p>
  
  <p><strong>EDIT -- MORE INFO:</strong></p>
  
  <p>I am still stumped on this.  Here's what I've been able to figure out:</p>
  
  <p>FIRST:</p>
  
  <p>When the app is first initiated, a splash page is shown while the app checks configs, tests connections to the DB, loads user cached data, etc. While the splash page is visible, the icon shows in the taskbar just fine.  Once the initial setup is done, the splash page is hidden.  At this point, the taskbar icon goes away.</p>
  
  <p>SECOND:</p>
  
  <p>Right after the splash page is hidden, the login form is initialized and shown.  When shown, the icon again becomes visible in the taskbar.  it stays there until after the user is validates and the form is closed, at which point the icon is gone again from the taskbar.</p>
  
  <p>THIRD:</p>
  
  <p>As soon as the login form is closed, the splash page is again shows while the more configuration is done and a sync between the app (client) and server takes place.  When the splash page is shown, the taskbar icon comes back.  As soon as the sync is complete the splash page is hidden, and the taskbar icon is gone again.</p>
  
  <p>FOURTH:</p>
  
  <p>As soon as the second splash page is hidden, we then show the Main Form.  At this point, I would expect the taskbar icon to show again.  But... it does not.  I have been comparing properties of the Login form and the Main form at the point they become visible to see if I can spot any differences that might explain why one shows the icon and the other does not. I am not seeing anything obvious.</p>
  
  <p>CODE:</p>
  
  <p>Below is a screenshot of the code that creates and loads the Login form, with an arrow pointing to the line where the form becomes visible AND the icon appears in the taskbar.</p>
  
  <p><img src="https://i.stack.imgur.com/beNsy.png" alt="code that creates and loads the login form - taskbar icon shows"></p>
  
  <p>Below is a screenshot of the code that creates and loads the Main form, with an arrow pointing to the line where the I would EXPECT the taskbar icon to appear. The form itself does appear at this line,  but the icon does not.</p>
  
  <p><img src="https://i.stack.imgur.com/30T1a.png" alt="code that creates and loads the main form - taskbar icon does not show"></p>
  
  <p>A couple more things:</p>
  
  <ol>
  <li>The icon is set in the properties of the application</li>
  <li>In both forms, ShowIcon and ShowInTaskbar are both true</li>
  </ol>
  
  <p>Any ideas are welcome!!!</p>