dotnet / core

.NET news, announcements, release notes, and more!
https://dot.net
MIT License
20.97k stars 4.91k forks source link

Issues with C++/CLI code on Windows arm64 #9485

Closed dnoan closed 1 month ago

dnoan commented 2 months ago

I have been trying to get our C++/CLI code running on Windows arm64 but without success. The code compiles with Visual Studio 17.11 and .NET Framework 4.8.1 but doesn't run. It seems that mscoree.dll, or rather some of its dependencies is missing. Recently I got a Copilot+ PC (Snapdragon X Elite) and tried running the code - same problem. I have reported the problem to Microsoft before via various channels but no one has addressed the issue or take responsibility. Recently I was redirected here from https://learn.microsoft.com/en-us/answers/questions/1806807/mscoree-dll-missing-on-windows-arm64

krwq commented 2 months ago

Can you please send your csproj file or steps to recreate your project? Are you building self-contained exe? (-r your-RID --self-contained true) If not you'll need runtime installed https://dotnet.microsoft.com/en-us/download - please let me know if you were able to solve the issue.

dnoan commented 2 months ago

An example compile from the ARM64 Native Tools Command Prompt for VS 2022 v17.11.2:

cl -nologo -I../include -O2 -clr -GR -FS -Zi -Gy -MP -W3 -std:c++17 -permissive- -Zc:twoPhase- -Zc:__cplusplus -MD -FoC:/projects/cli/objs/release/managedcode.obj -c managedcode.cpp

cl -nologo -I../include -O2 -GR -FS -Zi -Gy -MP -EHsc -W3 -openmp:llvm -std:c++20 -permissive- -Zc:twoPhase- -Zc:__cplusplus -MD -FoC:/projects/cli/objs/release/nativecode.obj -c nativecode.cpp

link -dll -debug -nologo libomp.dll.lib /NODEFAULTLIB:vcomp /MACHINE:ARM64 /INCREMENTAL:NO -libpath:C:/projects/cli/lib/release -out:C:/projects/cli/lib/release/foo_wpf.dll C:/projects/cli/objs/release/managedcode.obj C:/projects/cli/objs/release/nativecode.obj C:/projects/cli/objs/release/foo_wpf.res user32.lib foo.lib bar.lib

Then the inspection:

dumpbin.exe /DEPENDENTS -out:C:/projects/cli/lib/release/foo_wpf.dll

Dump of file C:\projects\cli\lib\release\foo_wpf.dll

File Type: DLL

  Image has the following dependencies:

    MSVCP140.dll
    KERNEL32.dll
    VCRUNTIME140.dll
    api-ms-win-crt-heap-l1-1-0.dll
    api-ms-win-crt-string-l1-1-0.dll
    api-ms-win-crt-runtime-l1-1-0.dll
    foo.dll
    bar.dll
    mscoree.dll
krwq commented 2 months ago

@dnoan do you have https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist installed?

dnoan commented 2 months ago

Yes, I have it installed on both the development computer (where I have Visual Studio) and on the test computer. I just reinstalled just in case but the problem persists.

github-actions[bot] commented 1 month ago

This issue is stale because there has been no response to a request for more information for 7 days.

github-actions[bot] commented 1 month ago

This issue was closed because there was no response to a request for more information for 10 days.