A
Andrew Baker
If you have every had the following error when trying to use load a
form in the IDE then read on!!!
An exception occurred while trying to create an instance of
GSL.Windows.Forms.BrowserFormBase. The exception was "Method Validate
in type GSL.Shared.GridFilters.GridFilter from assembly GSL.Shared,
Version=1.0.1804.21512, Culture=neutral, PublicKeyToken=null does not
have an implementation.".
I has taken me ages, but I have worked out why this happens and I don't
believe there is a work around.
I have a Windows project called "GSL.Windows.Forms" this references an
assemly called "GSL.UI". Both these projects reference another project
called "GSL.Shared". Seems straight forward... yet this causes a big
problem in .NET.
Unfortunately due to the annoying way .NET handles file locking you
have to set "Copy Local" to true for the "GSL.Shared" reference in the
"GSL.Windows.Forms" and "GSL.UI" projects. Otherwise the "GSL.Shared"
and "GSL.Windows.Forms" projects will lock the "GSL.Shared" dll and
prevent you from rebuilding it.
So both "GSL.Shared" and "GSL.Windows.Forms" have to have their own
private copy of "GSL.Shared". Which should be fine, I always rebuild
both of these if I change "GSL.Shared". However, the killer is that
when I open a form in "GSL.Windows.Forms" which has a component on it
that uses "GSL.UI" you will get the error I posted above. It seems that
even though there is an identical copy of the "GSL.Shared" assembly in
both projects, the designer gives you a "method validate error"!!!!
If I set "Copy Local" to false for the "GSL.Shared" reference, in both
"GSL.Shared" and "GSL.Windows.Forms" it works fine, except I can never
rebuild "GSL.Shared" since the dll will always be locked by the other
two projects!!!!
The problem never arises at runtime, since this will always be using a
single copy of all the references.
form in the IDE then read on!!!
An exception occurred while trying to create an instance of
GSL.Windows.Forms.BrowserFormBase. The exception was "Method Validate
in type GSL.Shared.GridFilters.GridFilter from assembly GSL.Shared,
Version=1.0.1804.21512, Culture=neutral, PublicKeyToken=null does not
have an implementation.".
I has taken me ages, but I have worked out why this happens and I don't
believe there is a work around.
I have a Windows project called "GSL.Windows.Forms" this references an
assemly called "GSL.UI". Both these projects reference another project
called "GSL.Shared". Seems straight forward... yet this causes a big
problem in .NET.
Unfortunately due to the annoying way .NET handles file locking you
have to set "Copy Local" to true for the "GSL.Shared" reference in the
"GSL.Windows.Forms" and "GSL.UI" projects. Otherwise the "GSL.Shared"
and "GSL.Windows.Forms" projects will lock the "GSL.Shared" dll and
prevent you from rebuilding it.
So both "GSL.Shared" and "GSL.Windows.Forms" have to have their own
private copy of "GSL.Shared". Which should be fine, I always rebuild
both of these if I change "GSL.Shared". However, the killer is that
when I open a form in "GSL.Windows.Forms" which has a component on it
that uses "GSL.UI" you will get the error I posted above. It seems that
even though there is an identical copy of the "GSL.Shared" assembly in
both projects, the designer gives you a "method validate error"!!!!
If I set "Copy Local" to false for the "GSL.Shared" reference, in both
"GSL.Shared" and "GSL.Windows.Forms" it works fine, except I can never
rebuild "GSL.Shared" since the dll will always be locked by the other
two projects!!!!
The problem never arises at runtime, since this will always be using a
single copy of all the references.