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 184.108.40.206), 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=220.127.116.11, etc.’ or one of its dependencies. The system cannot find the file specified.
File name: ‘MyCompany.ExchangeWrapper, Version 18.104.22.168, 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 22.214.171.124. So the whacky thing was still hoping to load ver 126.96.36.199 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.