Browse Source

Logging more information before trying to resolve assembly path

Source commit: 5785580806c52fb2a2afe2230abbb6811d113df8
Martin Prikryl 8 years ago
parent
commit
cc51e243ef
1 changed files with 9 additions and 4 deletions
  1. 9 4
      dotnet/internal/Logger.cs

+ 9 - 4
dotnet/internal/Logger.cs

@@ -284,16 +284,21 @@ namespace WinSCP
 
         private void WriteEnvironmentInfo()
         {
-            string path = GetAssemblyFilePath();
-            FileVersionInfo version = string.IsNullOrEmpty(path) ? null : FileVersionInfo.GetVersionInfo(path);
             Assembly assembly = Assembly.GetExecutingAssembly();
-            WriteLine("Executing Assembly: {0}; Path: {1}; Location: {2}; Product: {3}", assembly, path, assembly.Location, ((version != null) ? version.ProductVersion : "unknown"));
-            WriteLine("Entry Assembly: {0}", Assembly.GetEntryAssembly());
+            WriteLine("Executing assembly: {0}", assembly);
+            WriteLine("Executing assembly codebase: {0}", (assembly.CodeBase ?? "unknown"));
+            WriteLine("Executing assembly location: {0}", (assembly.Location ?? "unknown"));
+            Assembly entryAssembly = Assembly.GetEntryAssembly();
+            WriteLine("Entry Assembly: {0}", (entryAssembly != null ? entryAssembly.ToString() : "unmanaged"));
             WriteLine("Operating system: {0}", Environment.OSVersion);
             WriteLine("User: {0}@{1}@{2}; Interactive: {3}", Environment.UserName, Environment.UserDomainName, Environment.MachineName, Environment.UserInteractive);
             WriteLine("Runtime: {0}", Environment.Version);
             WriteLine("Console encoding: Input: {0} ({1}); Output: {2} ({3})", Console.InputEncoding.EncodingName, Console.InputEncoding.CodePage, Console.OutputEncoding.EncodingName, Console.OutputEncoding.CodePage);
             WriteLine("Working directory: {0}", Environment.CurrentDirectory);
+            string path = GetAssemblyFilePath();
+            FileVersionInfo version = string.IsNullOrEmpty(path) ? null : FileVersionInfo.GetVersionInfo(path);
+            WriteLine("Assembly path: {0}", path);
+            WriteLine("Assembly product version: {0}", ((version != null) ? version.ProductVersion : "unknown"));
         }
 
         public static string LastWin32ErrorMessage()