vc3/Afterthought — Issue #35: Amender crashes on methods containing a ByRef parameter
Author: stephen-czetty
Created: 2012-01-12 18:48:30+00:00
State: open

See commit cc7f7bc71 in stephen-czetty/Afterthought for a simple reproduction.

Unhandled Exception: System.ArgumentNullException: Value cannot be null.
Parameter name: key
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at Afterthought.Amender.AssemblyAmender.ResolveType(Type type) in C:\Dev\Afterthought\Afterthought.Amender\AssemblyAmender.cs:line 2042
at Afterthought.Amender.AssemblyAmender.b__87(ParameterInfo p) in C:\Dev\Afterthought\Afterthought.Amender\AssemblyAmender.cs:line 2144
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Afterthought.Amender.AssemblyAmender.ResolveMethod(ITypeDefinition declaringType, MethodInfo method) in C:\Dev\Afterthought\Afterthought.Amender\AssemblyAmender.cs:line 2144
at Afterthought.Amender.AssemblyAmender.AmendType(NamedTypeDefinition type) in C:\Dev\Afterthought\Afterthought.Amender\AssemblyAmender.cs:line 227
at Afterthought.Amender.AssemblyAmender.Mutate(NamespaceTypeDefinition namespaceTypeDefinition) in C:\Dev\Afterthought\Afterthought.Amender\AssemblyAmender.cs:line 86
at Microsoft.Cci.MutableCodeModel.MutatingVisitor.Visit(INamespaceTypeDefinition namespaceTypeDefinition) in C:\Dev\Afterthought\Afterthought.Amender\Microsoft.CCI\MutableMetadataModel\Mutator.cs:line 8029
at Microsoft.Cci.MutableCodeModel.MutatingVisitor.Dispatch(INamespaceMember namespaceMember) in C:\Dev\Afterthought\Afterthought.Amender\Microsoft.CCI\MutableMetadataModel\Mutator.cs:line 7125
at Microsoft.Cci.MutableCodeModel.MutatingVisitor.Mutate(List`1 namespaceMembers) in C:\Dev\Afterthought\Afterthought.Amender\Microsoft.CCI\MutableMetadataModel\Mutator.cs:line 7113
at Microsoft.Cci.MutableCodeModel.MutatingVisitor.Mutate(UnitNamespace unitNamespace) in C:\Dev\Afterthought\Afterthought.Amender\Microsoft.CCI\MutableMetadataModel\Mutator.cs:line 8704
at Microsoft.Cci.MutableCodeModel.MutatingVisitor.Mutate(NestedUnitNamespace nestedUnitNamespace) in C:\Dev\Afterthought\Afterthought.Amender\Microsoft.CCI\MutableMetadataModel\Mutator.cs:line 8206
at Microsoft.Cci.MutableCodeModel.MutatingVisitor.Visit(INestedUnitNamespace nestedUnitNamespace) in C:\Dev\Afterthought\Afterthought.Amender\Microsoft.CCI\MutableMetadataModel\Mutator.cs:line 8153
at Microsoft.Cci.MutableCodeModel.MutatingVisitor.Dispatch(INamespaceMember namespaceMember) in C:\Dev\Afterthought\Afterthought.Amender\Microsoft.CCI\MutableMetadataModel\Mutator.cs:line 7127
at Microsoft.Cci.MutableCodeModel.MutatingVisitor.Mutate(List`1 namespaceMembers) in C:\Dev\Afterthought\Afterthought.Amender\Microsoft.CCI\MutableMetadataModel\Mutator.cs:line 7113
at Microsoft.Cci.MutableCodeModel.MutatingVisitor.Mutate(UnitNamespace unitNamespace) in C:\Dev\Afterthought\Afterthought.Amender\Microsoft.CCI\MutableMetadataModel\Mutator.cs:line 8704
at Microsoft.Cci.MutableCodeModel.MutatingVisitor.Mutate(NestedUnitNamespace nestedUnitNamespace) in C:\Dev\Afterthought\Afterthought.Amender\Microsoft.CCI\MutableMetadataModel\Mutator.cs:line 8206
at Microsoft.Cci.MutableCodeModel.MutatingVisitor.Visit(INestedUnitNamespace nestedUnitNamespace) in C:\Dev\Afterthought\Afterthought.Amender\Microsoft.CCI\MutableMetadataModel\Mutator.cs:line 8153
at Microsoft.Cci.MutableCodeModel.MutatingVisitor.Dispatch(INamespaceMember namespaceMember) in C:\Dev\Afterthought\Afterthought.Amender\Microsoft.CCI\MutableMetadataModel\Mutator.cs:line 7127
at Microsoft.Cci.MutableCodeModel.MutatingVisitor.Mutate(List`1 namespaceMembers) in C:\Dev\Afterthought\Afterthought.Amender\Microsoft.CCI\MutableMetadataModel\Mutator.cs:line 7113
at Microsoft.Cci.MutableCodeModel.MutatingVisitor.Mutate(UnitNamespace unitNamespace) in C:\Dev\Afterthought\Afterthought.Amender\Microsoft.CCI\MutableMetadataModel\Mutator.cs:line 8704
at Microsoft.Cci.MutableCodeModel.MutatingVisitor.Mutate(NestedUnitNamespace nestedUnitNamespace) in C:\Dev\Afterthought\Afterthought.Amender\Microsoft.CCI\MutableMetadataModel\Mutator.cs:line 8206
at Microsoft.Cci.MutableCodeModel.MutatingVisitor.Visit(INestedUnitNamespace nestedUnitNamespace) in C:\Dev\Afterthought\Afterthought.Amender\Microsoft.CCI\MutableMetadataModel\Mutator.cs:line 8153
at Microsoft.Cci.MutableCodeModel.MutatingVisitor.Dispatch(INamespaceMember namespaceMember) in C:\Dev\Afterthought\Afterthought.Amender\Microsoft.CCI\MutableMetadataModel\Mutator.cs:line 7127
at Microsoft.Cci.MutableCodeModel.MutatingVisitor.Mutate(List`1 namespaceMembers) in C:\Dev\Afterthought\Afterthought.Amender\Microsoft.CCI\MutableMetadataModel\Mutator.cs:line 7113
at Microsoft.Cci.MutableCodeModel.MutatingVisitor.Mutate(UnitNamespace unitNamespace) in C:\Dev\Afterthought\Afterthought.Amender\Microsoft.CCI\MutableMetadataModel\Mutator.cs:line 8704
at Microsoft.Cci.MutableCodeModel.MutatingVisitor.Mutate(NestedUnitNamespace nestedUnitNamespace) in C:\Dev\Afterthought\Afterthought.Amender\Microsoft.CCI\MutableMetadataModel\Mutator.cs:line 8206
at Microsoft.Cci.MutableCodeModel.MutatingVisitor.Visit(INestedUnitNamespace nestedUnitNamespace) in C:\Dev\Afterthought\Afterthought.Amender\Microsoft.CCI\MutableMetadataModel\Mutator.cs:line 8153
at Microsoft.Cci.MutableCodeModel.MutatingVisitor.Dispatch(INamespaceMember namespaceMember) in C:\Dev\Afterthought\Afterthought.Amender\Microsoft.CCI\MutableMetadataModel\Mutator.cs:line 7127
at Microsoft.Cci.MutableCodeModel.MutatingVisitor.Mutate(List`1 namespaceMembers) in C:\Dev\Afterthought\Afterthought.Amender\Microsoft.CCI\MutableMetadataModel\Mutator.cs:line 7113
at Microsoft.Cci.MutableCodeModel.MutatingVisitor.Mutate(UnitNamespace unitNamespace) in C:\Dev\Afterthought\Afterthought.Amender\Microsoft.CCI\MutableMetadataModel\Mutator.cs:line 8704
at Microsoft.Cci.MutableCodeModel.MutatingVisitor.Mutate(RootUnitNamespace rootUnitNamespace) in C:\Dev\Afterthought\Afterthought.Amender\Microsoft.CCI\MutableMetadataModel\Mutator.cs:line 8579
at Microsoft.Cci.MutableCodeModel.MutatingVisitor.Visit(IRootUnitNamespace rootUnitNamespace) in C:\Dev\Afterthought\Afterthought.Amender\Microsoft.CCI\MutableMetadataModel\Mutator.cs:line 8561
at Microsoft.Cci.MutableCodeModel.MutatingVisitor.Mutate(Module module) in C:\Dev\Afterthought\Afterthought.Amender\Microsoft.CCI\MutableMetadataModel\Mutator.cs:line 7058
at Afterthought.Amender.AssemblyAmender.Mutate(Module module) in C:\Dev\Afterthought\Afterthought.Amender\AssemblyAmender.cs:line 110
at Microsoft.Cci.MutableCodeModel.MutatingVisitor.Mutate(Assembly assembly) in C:\Dev\Afterthought\Afterthought.Amender\Microsoft.CCI\MutableMetadataModel\Mutator.cs:line 5778
at Afterthought.Amender.AssemblyAmender.Mutate(Assembly assembly) in C:\Dev\Afterthought\Afterthought.Amender\AssemblyAmender.cs:line 98
at Microsoft.Cci.MutableCodeModel.MutatingVisitor.Visit(IAssembly assembly) in C:\Dev\Afterthought\Afterthought.Amender\Microsoft.CCI\MutableMetadataModel\Mutator.cs:line 5749
at Microsoft.Cci.MutableCodeModel.MutatingVisitor.Visit(IModule module) in C:\Dev\Afterthought\Afterthought.Amender\Microsoft.CCI\MutableMetadataModel\Mutator.cs:line 7024
at Afterthought.Amender.Program.Amend(String targetAssembly, String[] amendmentAssemblies, String[] referenceAssemblies) in C:\Dev\Afterthought\Afterthought.Amender\Program.cs:line 145
at Afterthought.Amender.Program.Main(String[] args) in C:\Dev\Afterthought\Afterthought.Amender\Program.cs:line 47