In the following Form1 code, two other Form s are opened, and then one of them is closed. As a result, the second child form also closes. Why?
public partial class Form1 : Form { System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer { Interval = 2000 }; public Form1() { InitializeComponent(); ShowForm3(); (new Form2()).ShowDialog();
Form2 and Form3 are VS forms by default.
( Optional : this is a simple version of the source code. In the original (which, of course, is too long to publish here) this does not happen when executed from Visual Studio (neither Debug nor Release). This only happens when you install clickonce as an application, but then - even if I just click on the executable file (in the AppData folder). (Perhaps there is another piece of code that prevents it there when executed from VS, but I have not found it yet.) What could be the reason for this discrepancy? some type of optimization in clickonce that doesn't run well in Release mode?)
source share