All of a sudden our production application started throwing an error: “The invoked member is not supported in a dynamic assembly” when calling SetLicense. We found other articles here and determined we were calling it right before each and every use of the component which was not recommended. So we moved the call to the Application_Start of the site. Now it throws that error immediately and the app fails to startup. I already have the license file as an embedded resource, so that is not the issue. This was working for well over a year and suddenly started having this issue. The only thing that changed was the volume of use of this application. It would work for a little after deployment and then stop working. I have had to take the SetLicense call out and run in trial mode just to keep the application running, which is not good. So we are essentially down at the moment. Our users are not happy about the watermark it leaves. We urgently need help in solving this issue.
One quick update. I was running an older version so I decided to upgrade to latest to see if it fixed it. I was running 20.4 and now run 21.2. It worked fine locally, but still broke once deployed to a server. This time the error was different, saying it could not find the license file. I have it embedded as a resource so I do not know why it would be trying to find it as a file. I checked and the full namespace is correct, and it was not changed from the previous version. On a hunch I moved it to the main website assembly, it was originally in a class library and I noticed the docs mention it had to be in the calling assembly. Still did not work, even after updating the namespace to match. I decompiled my assembly to verify that the embedded resource was there and the fully qualified name matched. Still no dice. So finally I changed it to a bin deployed file instead of embedded. It seems to work locally and deployed so far from application start once I changed to match just the file name. Any idea why this behaves different between versions?
It is hard to determine the root cause of the error without replicating it at our end. Furthermore, the issue seems related to a specific environment. Please remove the license completely from the deployed application and add it again. Also, make sure that the older license is correctly and completely removed from the application. Restart the IIS services and see if the issue still persists. Please let us know by sharing the complete exception with the stack trace. We will further try to assist you accordingly.