Skip to content

Update BamlProject.cs#2

Open
Deltafox79 wants to merge 1 commit intoUlyssesWu:masterfrom
Deltafox79:master
Open

Update BamlProject.cs#2
Deltafox79 wants to merge 1 commit intoUlyssesWu:masterfrom
Deltafox79:master

Conversation

@Deltafox79
Copy link
Copy Markdown

Catch BadImageFormatException in Baml Paring

Catch BadImageFormatException in Baml Paring
Copy link
Copy Markdown
Owner

@UlyssesWu UlyssesWu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, but since you've catched all kinds of Exception, you should throw for other types, otherwise it will turn to a NullReferenceException which is confusing.

{
Console.WriteLine("This resource can not be parsed.");
return resource;
}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For other types of Exception, just throw;

Console.WriteLine("This resource can not be parsed.");
//throw;
return;
}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For other types of Exception, just throw;

@Deltafox79
Copy link
Copy Markdown
Author

Deltafox79 commented Sep 29, 2024

Hi

whit latest dnlib of May 30, 2024 and latest compiled ASNR on my dll Target I have this issue :

.\ASNR.exe .\xxxx.dll
Auto StrongName Remover/Resigner
by Ulysses, wdwxy12345@gmail.com

Removing StrongName for assembly [xxxx.dll] ...
This resource can not be parsed.
This resource can not be parsed.
This resource can not be parsed.
This resource can not be parsed.
[Error] Process failed.
System.BadImageFormatException: Corrupt .resources file. Unable to read resources from this file. Invalid header information. Try regenerating the .resources file. ---> System.IO.EndOfStreamException: Unable to read beyond the end of the stream.
in System.IO.BinaryReader.FillBuffer(Int32 numBytes)
in System.IO.BinaryReader.ReadInt32()
in System.Resources.ResourceReader._ReadResources()
in System.Resources.ResourceReader.ReadResources()
in System.Resources.ResourceReader.ReadResources()
in System.Resources.ResourceReader..ctor(Stream stream)
in ASNR.BamlProject.ParseResource(EmbeddedResource resource)
in ASNR.BamlProject.RemoveRefKeyToken(String publicKeyToken, String replaceToken)
in ASNR.Program.Remove(ModuleDefMD md, StrongNameKey key, Boolean checkBaml, Int32 floor)
in ASNR.Program.RemoveStrongName(String path, Boolean aggressiveCheck, Boolean checkBaml)
in ASNR.Program.Main(String[] args)

my PR Resolve this issue..... Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants