[GH-ISSUE #40] Operation is not valid due to the current state of the object. #35

Closed
opened 2026-02-25 21:30:31 +03:00 by kerem · 3 comments
Owner

Originally created by @GieltjE on GitHub (Jul 10, 2017).
Original GitHub issue: https://github.com/brutaldev/StrongNameSigner/issues/40

When creating an empty project with NodaTime v2.1.0 and StrongNameSigner it becomes imposible to launch the project:

Severity Code Description Project File Line Suppression State
Error Operation is not valid due to the current state of the object.
at Mono.Cecil.ModuleDefinition.ProcessDebugHeader()
at Mono.Cecil.ModuleDefinition.ReadSymbols(ISymbolReader reader)
at Mono.Cecil.ModuleReader.ReadSymbols(ModuleDefinition module, ReaderParameters parameters)
at Mono.Cecil.ModuleReader.CreateModuleFrom(Image image, ReaderParameters parameters)
at Mono.Cecil.ModuleDefinition.ReadModule(Stream stream, ReaderParameters parameters)
at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
at Brutal.Dev.StrongNameSigner.SigningHelper.GetAssemblyInfo(String assemblyPath, String[] probingPaths)
at Brutal.Dev.StrongNameSigner.AutomaticBuildTask.Execute() WindowsFormsApp19

Originally created by @GieltjE on GitHub (Jul 10, 2017). Original GitHub issue: https://github.com/brutaldev/StrongNameSigner/issues/40 When creating an empty project with NodaTime v2.1.0 and StrongNameSigner it becomes imposible to launch the project: Severity Code Description Project File Line Suppression State Error Operation is not valid due to the current state of the object. at Mono.Cecil.ModuleDefinition.ProcessDebugHeader() at Mono.Cecil.ModuleDefinition.ReadSymbols(ISymbolReader reader) at Mono.Cecil.ModuleReader.ReadSymbols(ModuleDefinition module, ReaderParameters parameters) at Mono.Cecil.ModuleReader.CreateModuleFrom(Image image, ReaderParameters parameters) at Mono.Cecil.ModuleDefinition.ReadModule(Stream stream, ReaderParameters parameters) at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters) at Brutal.Dev.StrongNameSigner.SigningHelper.GetAssemblyInfo(String assemblyPath, String[] probingPaths) at Brutal.Dev.StrongNameSigner.AutomaticBuildTask.Execute() WindowsFormsApp19
kerem 2026-02-25 21:30:31 +03:00
  • closed this issue
  • added the
    duplicate
    label
Author
Owner

@brutaldev commented on GitHub (Jul 10, 2017):

Machine/environment specific error, duplicate of issue #32. You can try sign on another machine or even a VM and it will work.

This occurs inside Mono.Cecil so you could try report this on their repo: https://github.com/jbevain/cecil
According to a very old bug in Mono.Cecil on the same method call, this happens when the PDB is out of sync with the assembly, try clean and rebuilding your project: http://markmail.org/message/rfsybwk7waearubw

When I moved to the latest version, file locks occurs causing more problems but I think this will still happens when PDB does not match the assembly.

<!-- gh-comment-id:314052241 --> @brutaldev commented on GitHub (Jul 10, 2017): Machine/environment specific error, duplicate of issue #32. You can try sign on another machine or even a VM and it will work. This occurs inside Mono.Cecil so you could try report this on their repo: https://github.com/jbevain/cecil According to a very old bug in Mono.Cecil on the same method call, this happens when the PDB is out of sync with the assembly, try clean and rebuilding your project: http://markmail.org/message/rfsybwk7waearubw When I moved to the latest version, file locks occurs causing more problems but I think this will still happens when PDB does not match the assembly.
Author
Owner

@GieltjE commented on GitHub (Jul 10, 2017):

When I launch a separate project with just StrongNameSigner it can sign the dll, it just happens when trying to debug an project with both assemblies in them (immediately after the compile operation).

<!-- gh-comment-id:314052728 --> @GieltjE commented on GitHub (Jul 10, 2017): When I launch a separate project with just StrongNameSigner it can sign the dll, it just happens when trying to debug an project with both assemblies in them (immediately after the compile operation).
Author
Owner

@brutaldev commented on GitHub (Jul 10, 2017):

Still a Mono.Cecil problem. This happens when simply trying to read assembly information, it's not even trying to sign things yet. Would have to prevent symbol reading on line 460 which is enabled if symbols are found with the same name as the assembly you are signing. If symbol reading is disabled, the same stack trace (inside Mono.Cecil) would not occur and bypass this issue.

<!-- gh-comment-id:314053923 --> @brutaldev commented on GitHub (Jul 10, 2017): Still a Mono.Cecil problem. This happens when simply trying to read assembly information, it's not even trying to sign things yet. Would have to prevent symbol reading on [line 460](https://github.com/brutaldev/StrongNameSigner/blob/6726b85bb69c7054719e84bf6b5963d3f3341c8d/src/Brutal.Dev.StrongNameSigner/SigningHelper.cs#L460) which is enabled if symbols are found with the same name as the assembly you are signing. If symbol reading is disabled, the same stack trace (inside Mono.Cecil) would not occur and bypass this issue.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/StrongNameSigner#35
No description provided.