Dynamics AX – Object ‘CLRObject’ could not be created – will it ever end?!!!

Argh! This has been the week of AX CLR errors, for me. My frustration level is (in one word), high.  This is my third post on this topic.  I guess they say that learning can be a painful process.  Well, I am learning a lot this month.

Background:  My CLR object and related-code have been working for a while now.  Last week, I made a minor tweak to the object, deployed it to the server (version 1.0.0.2), reloaded it in the GAC, removed it from AX, and restarted the AOS.  (because that is the proper process).  I ran my test job, to ensure that everything was deployed correctly.  That job worked fine.  However, some other regression tests, in other parts of AX resulted in errors.  It was the dreaded “Object ‘CLRObject’ could not be created”!

This time, the error message also had some useful information, but it was subtle:
System.IO.FileNotFoundException: Could not load file or assembly ‘MyCompany.ExchangeWrapper, Version=1.0.0.1, etc.’ or one of its dependencies.  The system cannot find the file specified. 
 File name: ‘MyCompany.ExchangeWrapper, Version 1.0.0.1, etc’
 
Initially, I was like, “huh?!”.  Because I just tested it in the Job, so I know its all there.  The subtle part was the Version #.  The latest change upped the rev to 1.0.0.2.  So the whacky thing was still hoping to load ver 1.0.0.1 of the object (which is long-gone now).
 
The solution was to recompile all X++/AX classes containing references (declarations) to the CLR object.  Here is a screen-shot:
 
Yep.  Doing a re-compile fixed it.  So, I can finally relax and makes some progress.  Lesson learned.  I thought I’d share in case anyone else stumbles over this one too.
Advertisements

About Tim Golisch

I'm a geek. I do geeky things.
This entry was posted in .net, Dynamics AX, Errors. Bookmark the permalink.