dotnet / dotnet/msbuild

GenerateResource cannot extract resources from ARM binaries

Open
#2,253 5 comments 0 reactions 0 assignees View on GitHub
Area: Task: GenerateResource triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

This was reported via feedback as https://developercommunity.visualstudio.com/content/problem/54934/uwp-resx-strings-not-merged-into-the-pri-file-for.html and as https://connect.microsoft.com/VisualStudio/feedback/details/2345310/. Internal bug [189984](https://devdiv.visualstudio.com/DevDiv/_workitems/edit/189984).

If a UWP app project that builds an appx package refers to a DLL compiled for ARM that embeds resources, those resources are silently ignored rather than packaged into the PRI.

This is because of a `BadImageFormatException`

```
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
   at System.Reflection.Assembly.UnsafeLoadFrom(String assemblyFile)
   at Microsoft.Build.Tasks.ProcessResourceFiles.ReadAssemblyResources(String name, String outFileOrDir) in E:\A\_work\8\s\src\Tasks\GenerateResource.cs:line 2958
```
 
Thrown [here ](https://github.com/Microsoft/msbuild/blob/f45785fb104c30080024affe855cd10ad27c6d4e/src/Tasks/GenerateResource.cs#L2958) and silently ignored [here](https://github.com/Microsoft/msbuild/blob/f45785fb104c30080024affe855cd10ad27c6d4e/src/Tasks/GenerateResource.cs#L2997-L3003).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.