Skip to content
This repository has been archived by the owner on Apr 16, 2020. It is now read-only.

"An entry with the same key already exists." when trying to write srcsrv data #124

Closed
florian-gandon opened this issue Sep 13, 2016 · 4 comments

Comments

@florian-gandon
Copy link

florian-gandon commented Sep 13, 2016

I'm having an exception when trying write srcsrv data in a PDB.
"System.ArgumentException : An entry with the same key already exists."
I've reproduced it, for instance, with the debug version build locally of SourceLink.Core.pdb.
I'm using SourceLink.Core directly with the following piece of code.
PdbFile.writeSrcSrvBytes(_targetPdbFile, _srcSrv);

I believe there is an issue in the type PdbInfo around the flag index management. There is actually some code commented.
I'm not very familiar with what does mean this flag index and how it should be computed.
Can you provide me some hit in order for me to fix it ? I've tried some naive fixes like taking the next available index but it's seems not enough as doing a srctoolx doesn't get me the links anymore.

@florian-gandon
Copy link
Author

florian-gandon commented Sep 14, 2016

I'm adding the stack trace:

System.dll!System.ThrowHelper.ThrowArgumentException(System.ExceptionResource resource)
System.dll!System.Collections.Generic.TreeSet<System.Collections.Generic.KeyValuePair<int, System.__Canon>>.AddIfNotPresent(System.Collections.Generic.KeyValuePair<int, System.__Canon> item)
System.dll!System.Collections.Generic.SortedDictionary<int, SourceLink.PdbName>.Add(int key, SourceLink.PdbName value)
SourceLink.Core.dll!SourceLink.PdbInfo.AddNewName(string name) Ligne 57
SourceLink.Core.dll!SourceLink.PdbFile.WriteNewStream(string name, byte[] bytes) Ligne 206
SourceLink.Core.dll!SourceLink.PdbFile.writeSrcSrvBytes(string pdbFile, byte[] srcsrvBytes) Ligne 326

@ctaggart
Copy link
Owner

Thanks for reporting this @reeflog.

@ctaggart
Copy link
Owner

Can you give me a way to reproduce this, ideally using SourceLink.exe? Oh, I see. If you are trying to use the code that writes directly to the pdb file instead of using pdbstr.exe, it isn't going to work. It "almost" worked, but then I gave up trying to reverse engineer the pdb format. With portable pdb format #93, this all goes away.

Regarding the future of SourceLink, I'm waiting for the dust to settle a bit on the .NET Core tooling. I expect to have a better idea of its future by early November by the MVP conference.

@florian-gandon
Copy link
Author

Thanks for the feedback. I'll wait a bit then.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants