Msbuld command fails randomly in VS2019 - Runtime-generated FailFast: (7): Unhandled exception: an unmanaged exception was thrown out of a managed-to-native transition.

SRBD-DV 6 Reputation points
2021-03-31T09:58:31.107+00:00

Msbuild build is failing randomly with following errors in VS2019:


Cleaning up unreferenced code

Running 'WriteAssemblies' transform, heap at 599 MB.

Runtime-generated FailFast: (7): Unhandled exception: an unmanaged exception was thrown out of a managed-to-native transition.

C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.2.8-rel-28605-00\tools\Microsoft.NetNative.targets(801,5): error MSB6006: "ilc.exe" exited with code 4103.

C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.2.8-rel-28605-00\tools\Microsoft.NetNative.targets(914,5): error : ILC has encountered an error. Refer to the .NET Native compatibility documentation and support information at http://go.microsoft.com/fwlink/?LinkID=392869 for assistance.

**Note: Failures occurred randomly. Not always (e.g. approx. 2 builds failed in every 8 builds)

Please help us to resolve this issue.

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
35,962 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Dylan Zhu-MSFT 6,406 Reputation points
    2021-04-01T07:48:32.223+00:00

    Hi SRBDDV,

    You can try to upgrade the Microsoft.NETCore.UniversalWindowsPlatform package to latest version. The reference link: https://developercommunity.visualstudio.com/t/failed-to-build-uwp-package-ilc-error-ilc1004/66416

    Best Regards, Dylan

    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our * *documentation* to enable e-mail notifications if you want to receive the related email notification for this thread.**