304NotModified / Fody.Stamp

:octocat: Stamps an assembly with git data
MIT License
65 stars 19 forks source link

Fails when two tags point to the same commit #60

Open redwyre opened 5 years ago

redwyre commented 5 years ago

Fody 2.4.6, Stamp.Fody 1.4.2

LibGitEx.FindVersionTag throws if two tags have the same commit, when trying to put them into a dictionary.

I'll probably just try to get rid of the extra tag, if not would you like a PR?

Fody: An unhandled exception occurred:
Exception:
An item with the same key has already been added.
Type:
System.ArgumentException
StackTrace:
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   at LibGitEx.FindVersionTag(Repository repository) in C:\projects\fody-stamp\Fody\LibGitEx.cs:line 18
   at FormatStringTokenResolver.ReplaceTokens(String template, ModuleDefinition moduleDefinition, Repository repo, String changestring) in C:\projects\fody-stamp\Fody\FormatStringTokenResolver.cs:line 37
   at ModuleWeaver.Execute() in C:\projects\fody-stamp\Fody\ModuleWeaver.cs:line 71
   at lambda_method(Closure , Object )
   at InnerWeaver.ExecuteWeavers() in C:\projects\fody\FodyIsolated\InnerWeaver.cs:line 200
   at InnerWeaver.Execute() in C:\projects\fody\FodyIsolated\InnerWeaver.cs:line 102