Skip to content

Commit

Permalink
Handle BadImageFormatException.
Browse files Browse the repository at this point in the history
  • Loading branch information
mntone committed May 25, 2021
1 parent f6f7458 commit 879a52a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions source/VirtualDesktop/Interop/ComInterfaceAssemblyProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,18 @@ private Assembly GetExistingAssembly()
if (int.TryParse(_assemblyRegex.Match(file.Name).Groups["build"]?.ToString(), out var build)
&& build == ProductInfo.OSBuild)
{
var name = AssemblyName.GetAssemblyName(file.FullName);
if (name.Version >= _requireVersion)
try
{
System.Diagnostics.Debug.WriteLine($"Assembly found: {file.FullName}");
var name = AssemblyName.GetAssemblyName(file.FullName);
if (name.Version >= _requireVersion)
{
System.Diagnostics.Debug.WriteLine($"Assembly found: {file.FullName}");
#if !DEBUG
return Assembly.LoadFile(file.FullName);
return Assembly.LoadFile(file.FullName);
#endif
}
}
catch (BadImageFormatException) { }
}
}
}
Expand Down

0 comments on commit 879a52a

Please sign in to comment.