-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
The changes made in issue #3132 have introduced a bug due to relying on a physical location for the assembly. If the Microsoft.ML.Core assembly is loaded from memory the assembly.location will be empty. Using FileVersionInfo.GetVersionInfo relies on a physical path - so an argument exception is thrown inside System.IO.Path since the supplied path is empty.
machinelearning/src/Microsoft.ML.Core/Data/Repository.cs
Lines 308 to 311 in 37ed336
var versionInfo = FileVersionInfo.GetVersionInfo(typeof(RepositoryWriter).Assembly.Location); | |
using (var ent = rep.CreateEntry(DirTrainingInfo, "Version.txt")) | |
using (var writer = Utils.OpenWriter(ent.Stream)) | |
writer.WriteLine(versionInfo.ProductVersion); |
Instead of using FileVersionInfo.GetVersionInfo the assembly custom attributes should be used, for example:
var productVersion = assembly.CustomAttributes.FirstOrDefault(a => a.AttributeType == typeof(AssemblyFileVersionAttribute)).ConstructorArguments.First();
This will return the same product string version as the FileVersionInfo.GetVersionInfo does.