Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System.TypeLoadException

Tags:

c#

wpf

csla

I'm receiving the following error in my WPF application:

Declaration referenced in a method implementation cannot be a final method.

And the only thing I have found states that the problem is that a non-virtual method is being overridden, but I checked and could not find any in my object.

The error is not thrown when compiling but only when I debug.

Does anyone have a suggestion that I might try?

-- UPDATE

I get the error in my App.Xaml.cs OnStartup override when calling:

var catalog = new AggregateCatalog();
catalog.Catalogs.Add(new DirectoryCatalog(localDir));
_container = new CompositionContainer(catalog);

On the _container I receive 15 LoaderException after upgrading to CSLA 4.5.10.

like image 452
Chrisjan Lodewyks Avatar asked Dec 21 '22 09:12

Chrisjan Lodewyks


1 Answers

Okay I have found my issue. I hope that posting it here might help someone else find the issue that I have been searching for so long.

In the code I have posted above the localDir points to a directory on my local machine where the projects are built to and then fetched with the MEF. The problem for me here was that there was a .dll to a different project that was still referencing an old version of CSLA and there Save(), was still being overridden although it is not allowed annymore.

So in short it was a .dll mismatch in my MEF directory, so be sure to check for something like that.

Hope this helps someone!

like image 124
Chrisjan Lodewyks Avatar answered Jan 07 '23 03:01

Chrisjan Lodewyks