-
Notifications
You must be signed in to change notification settings - Fork 392
Closed
Labels
enhancementGeneral enhancement requestGeneral enhancement request
Description
Our CI is using code coverage on .NET SDK 3.0.100.
When trying to update to SDK to 5.0.301 the instrumentation fails:
C:\Users\kirill\.nuget\packages\coverlet.msbuild\2.6.3\build\coverlet.msbuild.targets(7,5): [coverlet] Unable to instrument module: C:\.....\Release\net472\.......dll because : The type initializer for 'Coverlet.Core.Instrumentation.NetstandardAwareAssemblyResolver' threw an exception.
From looking at the static constructor, it only catches the FileNotFoundException:
coverlet/src/coverlet.core/Instrumentation/CecilAssemblyResolver.cs
Lines 49 to 64 in 7221afe
| static NetstandardAwareAssemblyResolver() | |
| { | |
| try | |
| { | |
| // To be sure to load information of "real" runtime netstandard implementation | |
| _netStandardAssembly = System.Reflection.Assembly.LoadFile(Path.Combine(Path.GetDirectoryName(typeof(object).Assembly.Location), "netstandard.dll")); | |
| System.Reflection.AssemblyName name = _netStandardAssembly.GetName(); | |
| _name = name.Name; | |
| _publicKeyToken = name.GetPublicKeyToken(); | |
| _assemblyDefinition = AssemblyDefinition.ReadAssembly(_netStandardAssembly.Location); | |
| } | |
| catch (FileNotFoundException) | |
| { | |
| // netstandard not supported | |
| } | |
| } |
I think the Instrumenter should be trying to unwrap the exception before reporting it:
| _logger.LogWarning($"Unable to instrument module: '{_module}' because : {ex.Message}"); |
Metadata
Metadata
Assignees
Labels
enhancementGeneral enhancement requestGeneral enhancement request