web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Could not load type EventHandlersLazyInitializationAttribute from assembly Microsoft.Dynamics.AX.Xpp.Support

(0) ShareShare
ReportReport
Posted on by 66

I applied a deployable package to a local VM for D365FO, now when I build any model in visual studio i get the following error

Abnormal termination with unhandled exception. Exception key: 01189b8b-39ac-4c5c-92b6-60362768b625. System.TypeInitializationException: The type initializer for 'Microsoft.Dynamics.AX.Framework.Xlnt.TypeUniverse.XLNTTypes' threw an exception. ---> System.TypeLoadException: Could not load type 'Microsoft.Dynamics.Ax.Xpp.EventHandlersLazyInitializationAttribute' from assembly 'Microsoft.Dynamics.AX.Xpp.Support, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
at Microsoft.Dynamics.AX.Framework.Xlnt.TypeUniverse.XLNTTypes..ctor()
at Microsoft.Dynamics.AX.Framework.Xlnt.TypeUniverse.XLNTTypes..cctor()

Info:

The package In applied was generated from version 10.0.28 and I applied to an environment version 10.0.30

Should this make a difference? If not, I have no idea how to troubleshoot this. The error gets generated every time an x++ class gets compiled

Thanks

I have the same question (0)
  • Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    It sounds like you created your own deployable package and applied it to a development environment. Why?

  • Nze Profile Picture
    66 on at

    Its a Sandbox environment and I didn't want to go through the process of LCS deployment just yet. That will come after some testing of the package. Do you think the applying without using LCS could be the cause?

  • Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    Not only that you don't need to compile code in Sandbox (T2+) environments, but it shouldn't even be possible. There also shouldn't be any Visual Studio installed. if you're trying to compile your code, note that a deployable package doesn't contain source code. It already contains compiled binaries.

    Why did you decide to compile code there and how do you do it?

  • Nze Profile Picture
    66 on at

    I should explain further. The package wasn't created from my sandbox. It was compiled and created in another sandbox and I want to test the code in my sandbox. the source sandbox is version 10.0.28 and mine is 10.0.30. The goal is the distribute the package using LCS bug first has to go through my sandbox.

    So I applied the package in my sandbox, imported the metadata from source control for that package so I have access to the source code for debugging purposes and that is how I am able to build the model associated with that package

  • Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    Aha, it seems that you mean a development environment when you say "a sandbox". I'll keep it in mind when reading your description.

    You shouldn't have installed the deployable package - that's what you will do when you'll install compiled binaries to test and production environments.

    In your case, you have a development environment and you want to "have access to the source code for debugging purposes and [...] to build the model",therefore you should only download source code from source control. You will build binaries by compiling the model instead of applying a deployable package.

  • Nze Profile Picture
    66 on at

    That is what I did at first, but still got a lot build errors indicating there were references that could not be resolved, when clearly the references were there.

    I have done this before, but the package was applied using LCS and I imported a model file for that package in a dev environment and had no issues.  Now with a different environment where I applied the package manually and imported the model via source control, I am unable to build the model. So wondering if that process of using LCS introduces some additional references or resolutions not available using AXUpdateInstaller

  • Verified answer
    Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    When you want source code, installing a deployable package simply makes no sense.

    My recommendation is deleting all custom modules, downloading source code again from source control and compiling your modules. If you get compilation errors, analyze the cause and fix it.

    For example, maybe not all necessary modules are in source control, someone forgot to add a descriptor file to source control and so on.

    If you fail to find the cause by yourself, create a new thread (with an appropriate title and tags) and explain your particular problem there. Don't forget to include all information you have, such as what the error message say, whether the referenced model exist in your packages folder, whether the descriptor file is in place and it contains the references, and so on.

  • Nze Profile Picture
    66 on at

    Thanks. I'll try that

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 664 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 522 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 303 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans