[UWP] Compile with "Compile with .NET Native tool chain" Failed : Internal compiler error: Specified cast is not valid

Dayanand PR 1 Reputation point
2021-10-20T06:34:25.103+00:00

We developed UWP application and tried to upload it to Microsoft Store. During uploading process, we encountered "Supported API test" is failed in WACK (Windows Application Certification Kit) tool. So as per recommendation we have enabled the .Net native tool chain option in our project, but after enabling the source code it is not compiling and throwing below error.

C:\Users.nuget\packages\microsoft.net.native.compiler\2.2.8-rel-28605-00\tools\Microsoft.NetNative.targets(801,5): error : Internal compiler error: Specified cast is not valid.

It does not say where the error is.

can we use any settings to ignore the error? As the build works fine after disabling Compile with .Net Native tool chain option.

We need our application in Microsoft store and therefore we can't enable the .Net Native compiler option. Please help us overcome this problem.

Please find the attached file for Supported API Test errors detected in the WACK tool.

141992-supported-api-test-report-wack.txt

Thanks & Regards,
Dayanand PR

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,293 questions
Universal Windows Platform (UWP)
{count} votes