473,382 Members | 1,348 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Extermely nasty bug with the way .NET handles references

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.

Nov 16 '05 #1
5 1957
this is only a bug if you run your app from the same directory that you
compile it from.
I don't know about you, but if I'm running my app, it is usually after I've
installed it (either on a local machine or a test machine or a Virtual PC).
That would put the app into an actual installed directory.

In that case, rebuilding is fairly straight forward.

--- Nick

"Andrew Baker" <we*******@vbusers.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
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.

Nov 16 '05 #2
I am not getting the precise error that you describe, but I do see behavior
that might be symptoms of the same bug. It seems as the VS.Net isn't very
good at unloading dlls during a build. Frequently, I will be working and
get a bad build. If I scan the output, I will inevitably come upon an error
message (or a few) that say something to the effect that xx.dll could not be
copied because another process has it locked. It seems that the only
workaround for this (if you can call it a work around) is to close and
re-open Visual Studio. It seems to happen more often if you have to object
browser open, or if you have a form open in the form designer. When I get
this error, I generally will close all the files in the editor (or at least
the forms) and then restart Visual Studio.

I also find that this problem seems to come up after I refresh code from
source control by performing a "get latest version" operation at the
solution level. Very, very irritating.
"Andrew Baker" <we*******@vbusers.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
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.

Nov 16 '05 #3
So then do you run it from a different directory when you are debugging?
"Nick Malik" <ni*******@hotmail.nospam.com> wrote in message
news:3z_td.539841$D%.44235@attbi_s51...
this is only a bug if you run your app from the same directory that you
compile it from.
I don't know about you, but if I'm running my app, it is usually after
I've
installed it (either on a local machine or a test machine or a Virtual
PC).
That would put the app into an actual installed directory.

In that case, rebuilding is fairly straight forward.

--- Nick

"Andrew Baker" <we*******@vbusers.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
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.


Nov 16 '05 #4
I think you have misunderstood my post. I am not running the app, I am
using Visual Studio to design an application using a solution that
contains multiple projects. Several of the project reference each other
and the Form designer is having serious problems with this. It seems to
steam from the fact that I am using visual inheritance and the
inherited base components are in the same project as the components
that are deriving from them. This couple with the other information in
the previous post gives me a big headache!

I have used the Assembly Binding Log Viewer to look for the binding
errors, plus checked the temporary files in ..\Application
Data\Microsoft\VisualStudio\7.1\ProjectAssemblies are correct and still
haven't got to the bottom of this...

This is going to take someone with a serious knowledge of .NET to
solve. Have been using a million tools to watch what is going on, but
it seems so random!!!

Nov 16 '05 #5
you are correct. I was not aware that the problem was that these components
were being loaded by Visual Studio in the design environment.

Once VS loads the library that contains your component, it cannot easily
unload it. This is because VS cannot create an appdomain for a visual
control. You will need to close out of VS and reopen it on occasion. This
will allow the dll to be unloaded and will let VS compile the new version.

--- Nick

"Andrew Baker" <we*******@vbusers.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
I think you have misunderstood my post. I am not running the app, I am
using Visual Studio to design an application using a solution that
contains multiple projects. Several of the project reference each other
and the Form designer is having serious problems with this. It seems to
steam from the fact that I am using visual inheritance and the
inherited base components are in the same project as the components
that are deriving from them. This couple with the other information in
the previous post gives me a big headache!

I have used the Assembly Binding Log Viewer to look for the binding
errors, plus checked the temporary files in ..\Application
Data\Microsoft\VisualStudio\7.1\ProjectAssemblies are correct and still
haven't got to the bottom of this...

This is going to take someone with a serious knowledge of .NET to
solve. Have been using a million tools to watch what is going on, but
it seems so random!!!

Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: SRam | last post by:
I am coding for a server. After server is reading a particluar port, How can I create handles for them and distinguish them individually #!/usr/local/bin/perl -w use strict; use IO::Socket;...
26
by: Michael Strorm | last post by:
Hi! I posted a message a while back asking for project suggestions, and decided to go with the idea of creating an adventure game (although it was never intended to be a 'proper' game, rather an...
2
by: Roby2222 | last post by:
Is there any advantage to using the Handles clause vs. using the AddHandler to map events?
4
by: tarmat | last post by:
I have a class that has a std::list of ints as a member. Let's say its this: std::list<int> MyInts; Frequently, another list of ints is assigned to MyInts MyInts = MyOtherInts; This...
1
by: Andrew Baker | last post by:
Since installing SP1 and using VS.NET 2003 I have been having terrible problems with the intellisense locking the IDE. It only seems to happen with certain assemblies, but happens a lot. For...
19
by: Jerry | last post by:
I managed to narrow this down to a very simple expression. try this: private void Bug() { bool b = false; Test(3, (b || b) && b && !b); } private void Works() {
3
by: Alex | last post by:
I'm having a problem porting an ASP solution to ASPX. In the ASP solution I'm accessing a DCOM server, create sub DCOM objects and call functions from VB script on the ASP pages. The DCOM object...
4
by: Mario | last post by:
Hi there, I'm trying to do an easy thing... but no luck so far... I have a form with a textbox, and I want the following behaviour on mouse click event: -if no text is selected, select all...
2
by: Carter | last post by:
Hi, I am currently working on a project in C++ but I am somewhat unsure about how to implement the equivalent of C/Java style handles. I am curious about the correct idiomatic way to do this. My...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.