In the latest BETA 4.37.11, when using FileVersionInfo.GetVersion it throws an exception “The path is not of legal form.”
at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32
maxPathLength) at System.IO.Path.GetFullPathInternal(String path)
at System.IO.Path.GetFullPath(String path) at
System.Diagnostics.FileVersionInfo.GetFullPathWithAssert(String
fileName) at
System.Diagnostics.FileVersionInfo.GetVersionInfo(String fileName)
Specifically this is happening when trying to use MvcMiniProfiler.ProfiledDbConnection which tries to call
Version = FileVersionInfo.GetVersionInfo(typeof(MiniProfiler.Settings).Assembly.Location).ProductVersion;
in static Settings() ctor.
This works fine when using the 4.31 build of LINQPad. In the BETA, the Location property of the assembly appears to be “” while in 4.31 it returns the proper path to the file.
Any ideas or workarounds to get this to work? In my script there a few features of the new BETA that I have grown used to and not really looking forward to giving them up yet.
Also found this “The location of the loaded file that contains the manifest. If the loaded file was shadow-copied, the Location is that of the file after being shadow-copied. If the assembly is loaded from a byte array, such as when using the Load(Byte[]) method, Location is an empty string (“”).”
Wonder if LINQPad Beta has changed the way it loads assemblies?
LINQPad did change the way it loaded assemblies in 4.3x (to avoid locking user references while queries ran). Because of the problems you describe (assemblies losing their Location and CodeBase), the mechanism was changed in 4.4x so that referenced assemblies have a physical presence when LINQPad shadows them. Try the latest beta – it should fix your problem.