简体   繁体   中英

After adding delegate could not load type from assembly C#

So well I've searched tons of threads regarding the same issue but I can't seem to work. I know the exact same problem though.

So there's a

SellControl.DLL

that I added a delegate and an event as you can see here.

public delegate void CashCreditStatusDel(string cardNo, decimal amount, string extraText, string token, string docNr, bool status);


public static event CashCreditStatusDel SwitchOperationStatus;

Now I need that event inside another class so I reference the SellControl.dll and run it. Eeverything in my PC works fine, flawless though when I put it on test machine that our tester uses - it drops an error

[08:42:46] FATAL (Kernel): Inner exception: System.TypeLoadException: Could not load type 'SellControls.CashCreditStatusDel ' from assembly 'SellControl, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. at Plugins.CardCreditOperation.Display()

So I tracked an error to Display() method

SellControl.SwitchOperationStatus += InvokeData;

I subscribe my method InvokeData to method inside a SellControl, if I remove this line - code doesn't crash but I don't subscribe to event.

As I can understand somehow in the test machine there's GAC that has the old version of SellControl.dll and uses it instead of mine? I'm struggling with it for like 2 hours now.

Okay so what I did I went to my assembly and in properties I added a file version and raised assembly version and wrote a date in the comments to really verify if I have the same DLL all over. After doing that I rebuilt - voila.

It somehow worked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM