GetSequencePointMapping() throws Argument Exception
MNie opened this issue · 10 comments
It looks like GetSequencePointMapping method (line 675 or 682) tries to add a duplicate to a dictionary what results with a lock on an exe file.
Issue: Expecto.Adapter
Steps to reproduce:
- Create/Open F# project in Visual Studio
- Install Expecto ( > 5.0) and Adapter (> 5.0)
- run tests several times
- update/reinstall packages related to Expecto
- try to run specs
Thanks for reporting this. I'll need an exe and a pdb which reproduces the issue to diagnose the best fix.
That's very curious! Thanks for the repro, I'll have a look!
I think jb is travelling at the moment
I can't reproduce the issue with the binaries you provided. There's no method in ConsoleApplication.dll for which GetSequencePointMapping is throwing.
Closing this for now. Feel free to re-open with a repro.
Hello @jbevain .
Please look into this issue once again.
Here is the binary on which this issue is reproduced:
https://github.com/alex-bogomaz/ExpectoAdapterCecilIssue/blob/master/ExpectoAdapterCecilIssue/bin/Debug/ExpectoAdapterCecilIssue.dll .
Following code:
var readerParams = new ReaderParameters { ReadSymbols = true, InMemory = true };
var moduleDefinition = ModuleDefinition.ReadModule(@"D:\GitHub\alex-bogomaz\ExpectoAdapterCecilIssue\ExpectoAdapterCecilIssue\bin\Debug\ExpectoAdapterCecilIssue.dll", readerParams);
var types = moduleDefinition.GetTypes();
foreach (var t in types)
{
foreach (var m in t.GetMethods())
{
var s = m.DebugInformation.GetSequencePointMapping();
}
}
fails with exception:
HResult=0x80070057
Message=An item with the same key has already been added.
Source=mscorlib
StackTrace:
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at Mono.Cecil.Cil.MethodDebugInformation.GetSequencePointMapping()
at ConsoleApp1.Program.Main(String[] args) in D:\My\Projects\PSlogger-master\ConsoleApp1\Program.cs:line 25
Erroneous MethodDefinition is:
Microsoft.FSharp.Core.Unit
ExpectoAdapterCecilIssue.Tests/equality@16::Invoke(Microsoft.FSharp.Core.Unit)}
Software version:
<package id="Mono.Cecil" version="0.10.0-beta6" targetFramework="net461" />
Related ExpectoAdapter issue:
adamchester/expecto-adapter#28
@alex-bogomaz thanks for the repro!