diff options
-rw-r--r-- | main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpCompilerParameters.cs | 8 | ||||
-rw-r--r-- | main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CompilerOptionsPanelWidget.cs | 24 |
2 files changed, 21 insertions, 11 deletions
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpCompilerParameters.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpCompilerParameters.cs index 9d30f7a21c..ef73cbd84e 100644 --- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpCompilerParameters.cs +++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpCompilerParameters.cs @@ -227,9 +227,11 @@ namespace MonoDevelop.CSharp.Project return val; } set { - if (LangVersion == value) { - return; - } + try { + if (LangVersion == value) { + return; + } + } catch (Exception) { } langVersion = LanguageVersionToString (value); NotifyChange (); diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CompilerOptionsPanelWidget.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CompilerOptionsPanelWidget.cs index 396dc158c6..2085650193 100644 --- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CompilerOptionsPanelWidget.cs +++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CompilerOptionsPanelWidget.cs @@ -101,10 +101,14 @@ namespace MonoDevelop.CSharp.Project var langVerStore = new ListStore (typeof (string), typeof(LanguageVersion)); foreach (var (text, version) in CSharpLanguageVersionHelper.GetKnownLanguageVersions ()) { - if (unsupportedLanguageVersions.Contains (version) && compilerParameters.LangVersion != version) { - // Mono's MSBuild does not currently support C# 8. - } else { - langVerStore.AppendValues (text, version); + try { + if (unsupportedLanguageVersions.Contains (version) && compilerParameters.LangVersion != version) { + // Mono's MSBuild does not currently support C# 8. + } else { + langVerStore.AppendValues (text, version); + } + } catch (Exception ex) { + label2.Markup = GettextCatalog.GetString ("C# Language Version (<b>{0}</b>):", ex.Message); } } langVerCombo.Model = langVerStore; @@ -112,10 +116,14 @@ namespace MonoDevelop.CSharp.Project TreeIter iter; if (langVerStore.GetIterFirst (out iter)) { do { - var val = (LanguageVersion)(int)langVerStore.GetValue (iter, 1); - if (val == compilerParameters.LangVersion) { - langVerCombo.SetActiveIter (iter); - break; + try { + var val = (LanguageVersion)(int)langVerStore.GetValue (iter, 1); + if (val == compilerParameters.LangVersion) { + langVerCombo.SetActiveIter (iter); + break; + } + } catch (Exception ex) { + label2.Markup = GettextCatalog.GetString ("C# Language Version (<b>{0}</b>):", ex.Message); } } while (langVerStore.IterNext (ref iter)); } |