0

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.

Wkjjjj
  • 45
  • 1
  • 8
  • Since the assembly isn't strong-named, it can't be in the GAC. Are you sure the assembly is somewhere the application can load it? What application is it, desktop, web? Have you tried enabling Fusion? Do you have a project reference to the assembly, or are you manually copying DLLs around? If the latter, make sure the assembly is up to date, and next to the application executable. – Luaan Sep 19 '16 at 07:56
  • Are you recompiling the code on the test machine? The version of net library has to be exactly the same on build and test machine to simply copy the executable. The net library uses windows dll and the version of the windows dll are probably different. The fix is to use the publish option in the build menu which generates an install package like commercial purchased software. The publish will create folder(s) with setup.exe in root folder. The you need to install the setup.exe like commercial software which will update the dlls on test machine, or recompile software on test machine. – jdweng Sep 19 '16 at 07:59
  • It is a WPF application on 3.5 .NET. I compile everything on my own machine then use a past programmer created .bat to move everything from Release folders into "Code-Structured folders". Everything worked fine until now. – Wkjjjj Sep 19 '16 at 08:03
  • 1
    Are you sure the `SellControls.CashCreditStatusDel` isn't dependend on an assembly that only exists on your test machine? – Jeroen van Langen Sep 19 '16 at 08:04
  • It's just a delegate for the event. There's nothing much more to it.. Maybe I can somehow raise my assemblies version manually? – Wkjjjj Sep 19 '16 at 08:12
  • Best way to investigate this is to use FusionLog. http://stackoverflow.com/questions/255669/how-to-enable-assembly-bind-failure-logging-fusion-in-net – lerthe61 Sep 19 '16 at 08:19

1 Answers1

0

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.

Wkjjjj
  • 45
  • 1
  • 8