Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ILAsm versions 5.0 or higher fail when given a res file generated by ILDasm #109225

Closed
Newrad0603 opened this issue Oct 25, 2024 · 5 comments
Closed
Assignees
Labels
area-ILTools-coreclr Priority:1 Work that is critical for the release, but we could probably ship without
Milestone

Comments

@Newrad0603
Copy link

Description

Attempting to round trip a dll through ILDasm and ILAsm without any changes fails to generate a dll when giving ILAsm the res file created by ILDasm. I've tracked down the failure point to the code in CeeFileGenWriter::emitResourceSection(). The code that scans the res sections never finds any .rsrc sections so the rsrc array check fails and bails. I'm not sure if ILDasm is not generating the proper res format or if ILAsm isn't parsing the res file correctly.

Reproduction Steps

  1. Create a C# Class Library project
  2. Target it to .NET 472 (not sure if required for repro, but that's what VS builds target)
  3. Build the project
  4. Run ILDasm on the dll (just used /out switch)

    C:.tools.nuget\packages\runtime.win-x64.microsoft.netcore.ildasm\8.0.0\runtimes\win-x64\native\ildasm.exe C:\source\repos\ClassLibrary3\ClassLibrary3\bin\Debug\net472\ClassLibrary3.dll /out=C:\source\repos\ClassLibrary3\ClassLibrary3\bin\Debug\net472\ClassLibrary3.il

  5. Run ILAsm on the il and res generated by Step 4 (just used /out, /resource, and /dll switches)

    C:.tools.nuget\packages\runtime.win-x64.microsoft.netcore.ilasm\8.0.0\runtimes\win-x64\native\ilasm.exe /dll /resource=C:\source\repos\ClassLibrary3\ClassLibrary3\bin\Debug\net472\ClassLibrary3.res C:\source\repos\ClassLibrary3\ClassLibrary3\bin\Debug\net472\ClassLibrary3.il /out=C:\source\repos\ClassLibrary3\ClassLibrary3\bin\Debug\net472\ClassLibrary3.roundtrip.dll

Expected behavior

ILAsm successfully creates the dll with the given res entries

Actual behavior

ILAsm throws the error:

Could not create output file, error code=0x80070714

Regression?

This works with the version of ILAsm that ships with Visual Studio and installs to:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ilasm.exe

Known Workarounds

No response

Configuration

No response

Other information

No response

@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Oct 25, 2024
Copy link
Contributor

Tagging subscribers to this area: @JulieLeeMSFT
See info in area-owners.md if you want to be subscribed.

@Newrad0603
Copy link
Author

@AaronRobinsonMSFT

@JulieLeeMSFT JulieLeeMSFT added Priority:1 Work that is critical for the release, but we could probably ship without and removed untriaged New issue has not been triaged by the area owner labels Oct 25, 2024
@JulieLeeMSFT JulieLeeMSFT added this to the 10.0.0 milestone Oct 25, 2024
@Newrad0603 Newrad0603 changed the title ILAsm versions 5.0 or higher fail when given a res file generated by the ILDasm ILAsm versions 5.0 or higher fail when given a res file generated by ILDasm Oct 25, 2024
@JulieLeeMSFT
Copy link
Member

@amanasifkhalid, here is one more high priority issue to include in this quarter's work.

@jkoritzinsky
Copy link
Member

This is a duplicate of #11412

@JulieLeeMSFT
Copy link
Member

Closing as duplicate.

@github-actions github-actions bot locked and limited conversation to collaborators Nov 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-ILTools-coreclr Priority:1 Work that is critical for the release, but we could probably ship without
Projects
None yet
Development

No branches or pull requests

4 participants