none
Microsoft.NetNative.targets(788,5): error : Internal compiler error: Specified cast is not valid. RRS feed

  • Question

  • I am complete lost!!!

    I using VS2019, project Xamarin Form

    Compile perfect in DEBUG mode, but when I create a package to publish to the store

    Same error

     C:\Users\JorgeGO\.nuget\packages\microsoft.net.native.compiler\2.1.8\tools\Microsoft.NetNative.targets(788,5): error : Internal compiler error: Specified cast is not valid.

    I don't know how to fix it, please any help...!!

    2>  Running 'GetType' transform, heap at 1275 MB.
    2>  Running 'McgFixups' transform, heap at 1279 MB.
    2>  Running 'ResourceManagerCtor' transform, heap at 1283 MB.
    2>  Running 'TypeofTypeHandle' transform, heap at 1283 MB.
    2>  Running 'DispatchProxyIntrinsics' transform, heap at 1301 MB.
    2>  Running 'StaticInitData' transform, heap at 1305 MB.
    2>  Running 'Delegate' transform, heap at 1363 MB.
    2>  Running 'LazyGenerics' transform, heap at 1271 MB.
    2>  Running 'AddReflectionBlockedAttributes' transform, heap at 1350 MB.
    2>  Running 'DisableOptimization' transform, heap at 1350 MB.
    2>  Running 'AddSatelliteAssembliesToList' transform, heap at 1350 MB.
    2>  Running 'ResourceExtractor' transform, heap at 1360 MB.
    2>  Running 'CreateMetadata' transform, heap at 1366 MB.
    2>C:\Users\JorgeGO\.nuget\packages\microsoft.net.native.compiler\2.1.8\tools\Microsoft.NetNative.targets(788,5): error : Internal compiler error: Specified cast is not valid.
    2>
    2>Build FAILED.
    2>

    Sunday, January 12, 2020 8:45 PM

All replies

  • Fixed!!! just only update the nutget package microsoft.net.native.compiler
    Monday, January 13, 2020 9:11 AM
  • Hi JorgeGO,

    Welcome to MSDN forum.

    According to this error, hope you could refer this similar thread to troubleshoot it. 

    • First and foremost - try to delete bin and obj folders in your project. That might help, as they sometimes get cluttered with older libraries and create conflicts.
    • If you have been building with a source control like Git (I hope you did), I would suggest going back to some early commits and then try to build release mode there. If the project builds, jump forward to some newer commit and try again. If it does not, try an even earlier commit. The goal of this is to pinpoint when in time was the error introduced, which should significantly help you in searching where the problem comes from.
    • If you didn't use any source control - first remember to do so next time. However, this time you will have to do it "the old way". Create a new project and slowly as little code from the original project, trying to do release build at each step. Hopefully this will allow you to find the culprit code and then you will be able to fix it in the original project

    BTW, for better support, we recommend you could redirect to Xamarin.Form form, and then you could get dedicated support there.

    Thank you for understanding.

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Monday, January 13, 2020 9:16 AM