Error: Specified cast is not valid when Regenerating assemblies in VS extension

DaiPlusPlusDaiPlusPlus Posts: 4 New member
edited December 10, 2017 5:43AM in .NET Reflector Previous Versions
I'm using the VS2017 extension version 9.3.0.217.

I went Main menu > .NET Reflector > Generate PDBs > (selected my target assembly) > Continue > Regenerate

Then I get this error message:
"(my target assembly)" has not been regenerated because of the following exception:
"Specified cast is not valid"
Do you want to report this exception?

I reported it - but this is blocking my work, unfortunately, so I need a fix sooner.

Here is the stack trace reported in the Details window:
Specified cast is not valid.
System.InvalidCastException
  at Mono.Cecil.Signatures.SignatureWriter.Write(Elem elem, MemoryBinaryWriter writer)
  at Mono.Cecil.Signatures.SignatureWriter.Write(FixedArg fa, MemoryBinaryWriter writer)
  at Mono.Cecil.Signatures.SignatureWriter.Write(CustomAttrib ca, MethodReference ctor, MemoryBinaryWriter writer)
  at Mono.Cecil.ReflectionWriter.VisitCustomAttributeCollection(CustomAttributeCollection customAttrs)
  at Mono.Cecil.TypeDefinition.Accept(IReflectionVisitor visitor)
  at Mono.Cecil.ReflectionWriter.CompleteTypeDefinitions()
  at Mono.Cecil.StructureWriter.TerminateAssemblyDefinition(AssemblyDefinition asm)
  at Mono.Cecil.AssemblyDefinition.Accept(IReflectionStructureVisitor visitor)
  at Mono.Cecil.AssemblyFactory.SaveAssembly(AssemblyDefinition asm, Stream stream)
  at Mono.Cecil.AssemblyFactory.SaveAssembly(AssemblyDefinition asm, String file)
  at RedGate.Reflector.VsPackage.Engine.AssemblyRegenerator.RegenerateAssembly(String targetAssembly, String outputDirectory, IEnumerable`1 additionalSearchDirectories)
  at RedGate.Reflector.VsPackage.Engine.AssemblyRegenerator.RegenerateAssemblyAndSatelliteAssemblies(String targetAssembly, String outputDirectory, HashSet`1 additionalSearchDirectories)
  at RedGate.Reflector.VsPackage.Gui.RegenerationProgresser.RegenerateOneAssembly(AssemblyReference target, IAssemblyRegenerator regenerator, HashSet`1 additionalSearchDirectories, String targetDirectory)
  at RedGate.Reflector.VsPackage.Gui.RegenerationProgresser.<>c__DisplayClass19_0.<ActionRegeneration>b__0()

If it helps the target assembly is compiled from Delphi to .NET.
Sign In or Register to comment.