-
-
Notifications
You must be signed in to change notification settings - Fork 638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[0.10.0 netstandard] System.MissingMethodException : Method not found: 'Int32 Mono.Cecil.MetadataReader.ReadCodeSize(Mono.Cecil.MethodDefinition)'. #500
Comments
How weird. Thanks for reporting this. You're using both the Mono.Cecil.dll and Mono.Cecil.Mdb.dll from the lib/netstandard1.3 nuget? |
Being a .net core app, it just says Here's an assembly that shows the issue : Sample1.zip |
Thanks, I'll have a look pronto. |
This actually looks like #495. |
The code looks alright, the method that is called is there, but is internal, which is why we have an InternalsVisibleTo between |
The reason why it changed between the beta7 and the final is b4f4571 that introduced the call. |
@SteveGilham I can't seem to repro. I created a new dotnet project:
Modified the csproj so that it reads: <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<None Include="Sample1.exe">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Sample1.exe.mdb">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Mono.Cecil" Version="0.10.0" />
</ItemGroup>
</Project> Wrote: using System;
using System.Linq;
using Mono.Cecil;
namespace _500repro
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
using (var module = ModuleDefinition.ReadModule("Sample1.exe", new ReaderParameters { ReadSymbols = true }))
{
Console.WriteLine($"Module has symbols: {module.HasSymbols}");
foreach (var method in module.GetTypes().SelectMany(t => t.Methods).Where(m => m.HasBody))
{
Console.WriteLine($"On method: {method.FbullName}");
Console.WriteLine(method.Body);
}
}
}
}
} And when running for both frameworks it runs without crashing on getting the method body. Do you have a way to reproduce this? |
I'm in the process of cutting down to a simple repro case. Will update later. |
I've found the culprit. It's the NUnit3TestAdapter v 3.10.0 which includes also Mono.Cecil, from beta6
and that's going to be loaded ahead of any of my code. |
@SteveGilham one of reasons i moved to xunit |
This is a change of behaviour since 0.10-beta7 -- loading an assembly built with
mcs
with a.mdb
symbol file used to work quite happily from a .net core process the same as from old-fashioned .net. Old-fashioned .net still works with 0.10 final, but now using a .net core process to load the same assembly, aSystem.MissingMethodException
with this stack trace emergesThe text was updated successfully, but these errors were encountered: