MissingMethodException

Hi, I am using TurboActivate for a product currently in beta stages of development. My product is a .Net app written in C#. Some of my users have a MissingMethodException come up in runtime.

Analyzing the problem signature I can see that the exception is thrown when trying to call TA methods such as IsGenuine. I made sure that the TurboActivate.dll is deployed to the same folder as my app, and that platform target is same for both (tried x86 and x64 with both failing).

The strangest thing is the fact that this only happened on 3 out of 15 machines tested so far. The only common pattern I was able to notice with regard to user setups is all 3 of them use Windows 7 Ultimate specifically.

Can you help me solve the problem?

Much more information is needed. What exactly is throwing the exception? If you're using the TurboActivate class directly you'll never get the exception (because we don't use reflection in the C# class).

I do use the TurboActivate.cs class as supplied. The exception is thrown by my main form constructor (I put the TA checks there, following the example project). IL offset of the place where exception is thrown is not 100% consistent but points in general to code where TA methods are called and/or parameters for them loaded to stack.

My constructor code is as follows:

public Form1() { InitializeComponent(); TurboActivate.VersionGUID = "MyAppGUID goes here"; IsGenuineResult gr = TurboActivate.IsGenuine(14, 3);

isActivated = gr == IsGenuineResult.Genuine; if (!isActivated) //There is no key; app will exit { MessageBox.Show("MyApp is not activated and will now close."); Environment.Exit(5); } else //There is an activation key { string trialExpires = TurboActivate.GetFeatureValue("trial_expires", null);

isTrialKey = trialExpires != null; //is key a trial key? if (isTrialKey) { bool stillInTrial = TurboActivate.IsDateValid(trialExpires, TurboActivate.TA_DateCheckFlags.TA_HAS_NOT_EXPIRED); //check if trial key is still valid if (stillInTrial) { MessageBox.Show("Your trial expires on: " + trialExpires); //key is a valid trial key; show dialog. } else { MessageBox.Show("Your trial expired on: " + trialExpires + ". Please buy the full version. Program will now close."); //key is an expired trial key; app will exit Environment.Exit(5); } } } //If we got to here then there is full (non-trial) key or a valid (non-expired) trial one; app will continue. /* More initialization follows here*/ }

If you need more information I will be more than happy to supply it. I am otherwise happy with LimeLM and would like to continue to use it as my license management tool.

First of all, you should copy the example C# app. This isn't right:

isActivated = gr == IsGenuineResult.Genuine;

You need to also handle the cases where InternetError happened and when FeaturesChanged. Both of those are valid success cases.

As far as the MissingMethodException, you need to be able to reproduce the error. This is not coming from TurboActivate. Are you using an obfuscator? If so, don't. They have no benefit and they mess up execution.

I am using an obfuscator - Dotfuscator CE. I thought the purpose is clear - to "hide" my code, in particular some innovative proprietary algorithms that I devised which enable to do new things in my field. I dont depend on the obfuscation to make piracy harder if that was your point.

I will however test the effect it has on the error appearing there by trying non-obfuscated vs obfuscated vs obfuscated with TA excluded from obfuscation and also all of these full app and dummy app (basically a unit test of TA) on the affected machines and get back to you.

As to your suggestions re: use of IsGenuine, I just made it simpler for the time being. I dont plan to use the FeaturesChanged thing (as I understand it only kicks in if I change the version GUID) but I might have to rethink my handling of InetError.

I now see that I misunterstood what GenuineFeaturesChanged means so please disregard this part. Problem with the exception still stands, I am in the process of conducting more thorough tests.

Well, the solution to the MissingMethodException is to stop using that obfuscator. You should really not waste your money on any obfuscator (obfuscation can be undone by the click of a button). If you're determined to use one, then you might as well use an open source one: https://obfuscar.codeplex.com/