Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Forums / Finance forum / Common Language Runtim...
Finance forum

Common Language Runtime detected an invalid program

(0) ShareShare
ReportReport
Posted on by

Hi everyone,

today when I build my solution and I try to use my code I have this error "Common Language Runtime detected an invalid program." into Dynamics 365.

This error appear when a click on button and I call a method of my class. 

My method is like this:

public void exportData(ItemId _itemId)
{...}

The class of this method extend my other class.

When I build my Model this error disappear but when I change it and build or rebuild solution, Dynamics show me the CLR error.

Does anyone know the solution?

Thanks

  • DianP Profile Picture
    25 on at
    RE: Common Language Runtime detected an invalid program

    Hi Andre,

    Yes you are right, I should contact them regarding this issue.

    Thanks a lot for replying my question.

  • André Arnaud de Calavon Profile Picture
    293,041 Super User 2025 Season 1 on at
    RE: Common Language Runtime detected an invalid program

    Hi Dian,

    First of all, I wonder why someone would use this AOT browser as it would be an option to use a development VM for the same purpose.

    I have limited knowledge about setting up or verifying build pipelines. Probably there might be another volunteer on this forum who can help you. Have you also considered contacting Arbela who provided the AOT browser solution?

  • DianP Profile Picture
    25 on at
    RE: Common Language Runtime detected an invalid program

    Hi Andre,

    Thanks a lot you still reply although this thread is an old thread.
    I will explain the background of the issue first.

    I am a vendor where we implement customization for customer. But the customer requested to include other ISV solution named AOTBrowser (dynamics-tips.com/.../). This solution allowing user to view AOT objects from front end. They published the metadata and the source code. github.com/.../releases.

    There is no issue of AOTBrowser when build from the model. However, I need to create VS solution containing of our models and AOTBrowser model for the purpose of setup Azure build pipeline (ariste.info/.../).
    This where the problem happens.

    This means, I can create package from VS in DEV manually without issue. But when I create the package using Azure build (where it build using VS solution containing AOTBrowser project), the build was success but it shows error when user open the form.

    When the project is built, VS also shows a warning message:
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2110,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "Dynamics.AX.AOTBrowser, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.

  • André Arnaud de Calavon Profile Picture
    293,041 Super User 2025 Season 1 on at
    RE: Common Language Runtime detected an invalid program

    Hi Dian,

    Can you indicate why you need to build a third party ISV solution? Usually ISVs provide the solution with a deployable package with the compiled runtime.

  • DianP Profile Picture
    25 on at
    RE: Common Language Runtime detected an invalid program

    Hi AndreaAX,

    Did you find the solution for this? I faced the same issue when build project from other ISV.

    I suspect a reference issue.

    The reason I need to build from Solution is because I setup Azure build pipeline which require a Solution file.

  • AndreaAX Profile Picture
    on at
    RE: Common Language Runtime detected an invalid program.i

    Hi André,

    My current version of Dynamics is the latest (Dynamics 365 for Operations). 

    My class extends an other class that I have created. When I build all my model with full build the error disappear but when I build only the solution the error returns.

  • André Arnaud de Calavon Profile Picture
    293,041 Super User 2025 Season 1 on at
    RE: Common Language Runtime detected an invalid program.i

    Hi AndreaAX,

    You have used the Version 'Other' in your tag. I do think it is a question related to 'Operations'? Am I right? Please avoid using hashtags in your tags. This is not Twitter.

    Can you share a screenshot of your error and also provide more information about the complete solution you have build? How did this class extend your other class, etc...?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,041 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,856 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans