Also fix exporting BLOB values via /server backup table, would generate invalid SQL that could not be subsequently imported again with /server import table
This happened due to two factors:
1) the standalone build would show a message box warning because it couldn't change the current/working directory
2) the gui schedules InitServerTask to run on the background thread. This in turn will eventually call Server.Start on the background thread, which in turn will call Logger.Log(..) which in turn calls back to Window.LogMessage
Note that the UI can only be updated from the main/UI thread. Normally this wouldn't cause any issues, because LogMessage checked whether 'InvokeRequired' returned true or not - if it did, then LogMessage scheduled the message to be logged later on the main/UI thread by using BeginInvoke.
However, it was rarely possible that due to thread scheduling, the call to LogMessage from the background thread would be run *before* the main window control handle had finished being created.
And unexpectedly, 'InvokeRequired' would return *false* if the main window handle hadn't been created yet - and hence the background thread would attempt to directly update UI controls with catastrophic consequences. Sometimes this worked, but other times it would cause the app to SIGABRT and crash in X11 somewhere, usually in X11Keyboard:XCreateFontSet
So to workaround this I made the following changes:
1) failing to set working/current directory doesn't show a warning message box popup anymore
2) LogMessage doesn't check 'InvokeRequired' anymore and just always calls BeginInvoke to schedule the message logging on the main/UI thread
So in the most of the rare cases when this issue even happened, it shouldn't occur anymore now. However, the underlying issue still isn't completely solved.. if you change the code to show a message box before the main window, you'll still rarely end up with the main window being a black box with X11
Avoids a 'Couldn't process file Window\Window.resx due to its being in the Internet or Restricted zone or having the mark of the web on the file. Remove the mark of the web if you want to process these files' error that happens for some people when trying to compile the GUI
This took a long time to figure out because
1) for testing purposes I set Icon before the window handle had been created
2) When the window handle was later created, mono would not actually apply the custom icon since the border style is FixedDialog (see CreateHandle in Form.cs)
3) I later set Icon again in multiple other places. However, this was essentially a noop because Mono checked if the new icon was the same as the same previously assigned icon and do nothing in that case.
However, the assumption in step 3) was incorrect because the previously assigned icon had not actually been applied to the window.
Unfortunately this meant the correct Icon never showed at all. So the correct solution to this is to only assign Icon once in the Load event of forms.
I spent way too much time on this
This exception gets thrown when trying to invoke a method after the window has already been destroyed. This can rarely happen when trying to log messages at end of server shutdown after the window has been destroyed