Skip to content

Commit 6ea1fdd

Browse files
committed
LT-22306: Fix Startup Crash on Clean Machine
Prompt the user for update preferences after initializing the l10n manager. The l10n manager must be initialized before looking up strings to prevent language IDs from being mapped incorrectly (see https://issues.bloomlibrary.org/youtrack/issue/BL-13245). The prompt remains as early in startup as possible so that the user can choose before any update checks are initiated. Change-Id: Ib2284a6022c362b5dd961ed5f330a8ed63b540e1
1 parent aa1658c commit 6ea1fdd

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

Src/Common/FieldWorks/FieldWorks.cs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -185,18 +185,6 @@ static int Main(string[] rgArgs)
185185
s_appSettings.DeleteCorruptedSettingsFilesIfPresent();
186186
s_appSettings.UpgradeIfNecessary();
187187

188-
if (s_appSettings.Update == null && Platform.IsWindows)
189-
{
190-
s_appSettings.Update = new UpdateSettings
191-
{
192-
Behavior = DialogResult.Yes == FlexibleMessageBox.Show(
193-
Properties.Resources.AutomaticUpdatesMessage, Properties.Resources.AutomaticUpdatesCaption, MessageBoxButtons.YesNo,
194-
options: FlexibleMessageBoxOptions.AlwaysOnTop)
195-
? UpdateSettings.Behaviors.Download
196-
: UpdateSettings.Behaviors.DoNotCheck
197-
};
198-
}
199-
200188
var reportingSettings = s_appSettings.Reporting;
201189
if (reportingSettings == null)
202190
{
@@ -233,6 +221,19 @@ static int Main(string[] rgArgs)
233221
SetupErrorReportInformation();
234222
InitializeLocalizationManager();
235223

224+
// Initialize update settings for users who don't have them. After InitializeLocalizationManager because it displays strings (LT-22306)
225+
if (s_appSettings.Update == null && Platform.IsWindows)
226+
{
227+
s_appSettings.Update = new UpdateSettings
228+
{
229+
Behavior = DialogResult.Yes == FlexibleMessageBox.Show(
230+
Properties.Resources.AutomaticUpdatesMessage, Properties.Resources.AutomaticUpdatesCaption, MessageBoxButtons.YesNo,
231+
options: FlexibleMessageBoxOptions.AlwaysOnTop)
232+
? UpdateSettings.Behaviors.Download
233+
: UpdateSettings.Behaviors.DoNotCheck
234+
};
235+
}
236+
236237
// Invoke does nothing directly, but causes BroadcastEventWindow to be initialized
237238
// on this thread to prevent race conditions on shutdown.See TE-975
238239
// See http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=911603&SiteID=1

0 commit comments

Comments
 (0)