Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / NullReferenceException...
Finance forum
Answered

NullReferenceException in ILGeneratorAgent

Posted on by 13
Hi to all,
 
In Visual Studio, Every time I save a modification to an AOT object or code I get the following error in the Error List:
 
Error - System.NullReferenceException: Object reference not set to an instance of an object.
- at Microsoft.Dynamics.Framework.Tools.ILGeneratorAgent.CompilationService.ParseTypeResolve(String module, String metadataPath, String compilerMetadataPath, IEnumerable`1 referencedAssembliesFolders, IEnumerable`1 elements)
 
Due to this, any warning or error related to the modified object are not evaluated/shown. It seems that on save VS is unable to evaluate the object or X++ syntax properly.
IntelliSense (or how is it called X++ code-completion aid) does not seem to work either properly.
 
Model build or Solution rebuild temporarily removes the problem and shows correct errors and warning in Error List, but any minor modification and save, will raise this error again. I also tried opening and closing VS.
As if something behind crashes (like a service) which is then not restarted until Dev Box restart.
 
My dev has had this issue since it was created so I doubt is a local configuration I made (which are just default for solution and project properties)
 
I have no Idea where else to look at or what else I could try try.
 
Other things I tried:
- Clean and rebuild
- Shut down IIS express and VS and restarted
- Unloaded and reloaded the project in the solution
- All the above together as /clean, unload, shut down IIS express and VS, restart VS (and IIS express), load and build/
  • Verified answer
    LCAS Profile Picture
    LCAS 13 on at
    NullReferenceException in ILGeneratorAgent
    @Judy
    Thanks, that was my next step. Only problem is that I don't really have repro steps and I think it will be hard to get a proper answer or fix.
     
    It appears to be something happening now and then, even in the past, looking at the following:
     
    Although here the issue arises on build, whereas for me building clears the output and shows correct errors or warnings, if any.
     
    Now I managed to "solve" it by cleaning ALL Visual Studio cache and tmp files. Let's see if I get the problem again and if so, if this solution really helps.

    EDIT: Problem gets temporary solved by cleaning VS cache. In time it will come back still...

    I copy the main steps that helped in my case and in case the link is discontinued in the future:

    Please find visual studio 2022 cache folders by following:

    1. Component Cache

      Close Visual Studio (ensure devenv.exe is not present in the Task Manager) and delete the C:\Users\xxxx AppData\Local\Microsoft\VisualStudio\your version xxx\ComponentModelCache directory
    2. Temp folder

      Exit iisexpress.
      Delete the C:\Users\xxxx \AppData\Local\Temp directory
  • Judy Profile Picture
    Judy Microsoft Employee on at
    NullReferenceException Microsoft.Dynamics.Framework.Tools.ILGeneratorAgent.CompilationService
    Hi Sir,
     
    I am not sure about this, if the issue persists, it is highly recommended that you create a ticket with Microsoft for further investigate.
     
    Best Regards,
    Judy

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,584 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,864 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans