diff --git a/ILSpy/AboutPage.cs b/ILSpy/AboutPage.cs index 1dcef578a..b796fa362 100644 --- a/ILSpy/AboutPage.cs +++ b/ILSpy/AboutPage.cs @@ -54,7 +54,7 @@ namespace ICSharpCode.ILSpy }; output.WriteLine(Resources.ILSpyVersion + DecompilerVersionInfo.FullVersion); - string prodVersion = System.Diagnostics.FileVersionInfo.GetVersionInfo(typeof(Uri).Assembly.Location).ProductVersion; + string prodVersion = GetDotnetProductVersion(); output.WriteLine(Resources.NETFrameworkVersion + prodVersion); output.AddUIElement( @@ -104,6 +104,27 @@ namespace ICSharpCode.ILSpy textView.ShowText(output); } + private static string GetDotnetProductVersion() + { + // In case of AOT .Location is null, we need a fallback for that + string assemblyLocation = typeof(Uri).Assembly.Location; + + if (!String.IsNullOrWhiteSpace(assemblyLocation)) + { + return System.Diagnostics.FileVersionInfo.GetVersionInfo(assemblyLocation).ProductVersion; + } + else + { + var version = typeof(Object).Assembly.GetName().Version; + if (version != null) + { + return version.ToString(); + } + } + + return "UNKNOWN"; + } + sealed class MyLinkElementGenerator : LinkElementGenerator { readonly Uri uri; diff --git a/ILSpy/ILSpySettingsFilePathProvider.cs b/ILSpy/ILSpySettingsFilePathProvider.cs index 386b9b2ba..74bba6c4b 100644 --- a/ILSpy/ILSpySettingsFilePathProvider.cs +++ b/ILSpy/ILSpySettingsFilePathProvider.cs @@ -29,10 +29,16 @@ namespace ICSharpCode.ILSpy { if (App.CommandLineArguments.ConfigFile != null) return App.CommandLineArguments.ConfigFile; - string localPath = Path.Combine(Path.GetDirectoryName(typeof(MainWindow).Assembly.Location), "ILSpy.xml"); - if (File.Exists(localPath)) - return localPath; - return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ICSharpCode\\ILSpy.xml"); + + var assemblyLocation = typeof(MainWindow).Assembly.Location; + if (!String.IsNullOrWhiteSpace(assemblyLocation)) + { + string localPath = Path.Combine(Path.GetDirectoryName(assemblyLocation), "ILSpy.xml"); + if (File.Exists(localPath)) + return localPath; + } + + return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ICSharpCode", "ILSpy.xml"); } } }