473,605 Members | 2,637 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Mysterious bug in VS2005 which occasionally causes crash

A coworker and I have spent the last day and a half trying to track
down this bug in our code. We found the solution and thought we might
post it to help others out...

The setup: Class FinalForm derives from Class BaseForm that derives
from System.Windows. Forms.

public class BaseForm : Forms {}
public class FinalForm : BaseForm {}

When trying to open class FinalForm in the designer one of a number of
error happens which are listed at the bottom, they are a bit long so
here is what was causing the problem, and the fix:

The problem:

A recursive call within the base class BaseForm:

public class BaseForm : Forms
{
int count =0;
public int Count
{
get { return Count; }
}
}

The Count's getter should be returning count, but is calling itself!
Once it returns the right thing, all is well.

I hope this helps out others!

Sam

The differen errors we saw, there might be more:

1: VS2005 crashes and either simply goes away or gives the dialog to
report the error to Microsoft.

2: One or more errors encountered while loading the designer. The
errors are listed below. Some errors can be fixed by rebuilding your
project, while others may require code changes.

Unable to load one or more of the requested types. Retrieve the
LoaderException s property for more information.
Hide

at System.Reflecti on.Module.GetTy pesInternal(Sta ckCrawlMark& stackMark)
at System.Reflecti on.Assembly.Get Types()
at
Microsoft.Visua lStudio.Shell.D esign.AssemblyO bsoleteEventArg s..ctor(Assembl y
assembly)
at
Microsoft.Visua lStudio.Design. VSDynamicTypeSe rvice.ReloadAss emblyIfChanged( String
codeBase)
at
Microsoft.Visua lStudio.Design. VSDynamicTypeSe rvice.CreateDyn amicAssembly(St ring
codeBase)
at
Microsoft.Visua lStudio.Design. VSTypeResolutio nService.Assemb lyEntry.get_Ass embly()
at
Microsoft.Visua lStudio.Design. VSTypeResolutio nService.Assemb lyEntry.Search( String
fullName, String typeName, Boolean ignoreTypeCase, Assembly& assembly,
String description)
at
Microsoft.Visua lStudio.Design. VSTypeResolutio nService.Search ProjectEntries( AssemblyName
assemblyName, String typeName, Boolean ignoreTypeCase, Assembly&
assembly)
at Microsoft.Visua lStudio.Design. VSTypeResolutio nService.GetTyp e(String
typeName, Boolean throwOnError, Boolean ignoreCase, ReferenceType
refType)
at
Microsoft.Visua lStudio.Design. Serialization.C odeDom.Aggregat eTypeResolution Service.GetType (String
name, Boolean throwOnError, Boolean ignoreCase)
at
Microsoft.Visua lStudio.Design. Serialization.C odeDom.Aggregat eTypeResolution Service.GetType (String
name)
at
System.Componen tModel.Design.D esignerHost.Sys tem.ComponentMo del.Design.IDes ignerHost.GetTy pe(String
typeName)
at
System.Componen tModel.Design.S erialization.Co deDomDesignerLo ader.EnsureDocu ment(IDesignerS erializationMan ager
manager)
at
System.Componen tModel.Design.S erialization.Co deDomDesignerLo ader.PerformLoa d(IDesignerSeri alizationManage r
manager)
at
Microsoft.Visua lStudio.Design. Serialization.C odeDom.VSCodeDo mDesignerLoader .PerformLoad(ID esignerSerializ ationManager
serializationMa nager)
at
System.Componen tModel.Design.S erialization.Ba sicDesignerLoad er.BeginLoad(ID esignerLoaderHo st
host)
3: One or more errors encountered while loading the designer. The
errors are listed below. Some errors can be fixed by rebuilding your
project, while others may require code changes.

Could not load file or assembly '<my assembly>, Version=1.0.0.0 ,
Culture=neutral , PublicKeyToken= 12e8b3ea4074fce 4' or one of its
dependencies. The system cannot find the file specified.
Hide

at System.Signatur e._GetSignature (SignatureStruc t& signature, Void*
pCorSig, Int32 cCorSig, IntPtr fieldHandle, IntPtr methodHandle, IntPtr
declaringTypeHa ndle)
at System.Signatur e.GetSignature( SignatureStruct & signature, Void*
pCorSig, Int32 cCorSig, RuntimeFieldHan dle fieldHandle,
RuntimeMethodHa ndle methodHandle, RuntimeTypeHand le
declaringTypeHa ndle)
at System.Signatur e..ctor(Runtime MethodHandle methodHandle,
RuntimeTypeHand le declaringTypeHa ndle)
at System.Reflecti on.RuntimeMetho dInfo.get_Signa ture()
at System.Reflecti on.RuntimeMetho dInfo.GetParame tersNoCopy()
at System.Reflecti on.RuntimePrope rtyInfo.GetInde xParameters()
at
System.Componen tModel.ReflectT ypeDescriptionP rovider.Reflect GetProperties(T ype
type)
at
System.Componen tModel.ReflectT ypeDescriptionP rovider.Reflect edTypeData.GetP roperties()
at
System.Componen tModel.TypeDesc riptor.TypeDesc riptionNode.Def aultTypeDescrip tor.System.Comp onentModel.ICus tomTypeDescript or.GetPropertie s()
at
System.Componen tModel.TypeDesc riptor.TypeDesc riptionNode.Def aultTypeDescrip tor.System.Comp onentModel.ICus tomTypeDescript or.GetPropertie s()
at System.Componen tModel.TypeDesc riptor.GetPrope rties(Type
componentType)
at
System.Windows. Forms.Design.Fo rmDocumentDesig ner.Initialize( IComponent
component)
at
System.Componen tModel.Design.D esignerHost.Add ToContainerPost Process(ICompon ent
component, String name, IContainer containerToAddT o)
at System.Componen tModel.Design.D esignerHost.Add (IComponent component,
String name)
at
System.Componen tModel.Design.D esignerHost.Sys tem.ComponentMo del.Design.IDes ignerHost.Creat eComponent(Type
componentType, String name)
at
System.Componen tModel.Design.S erialization.De signerSerializa tionManager.Cre ateInstance(Typ e
type, ICollection arguments, String name, Boolean addToContainer)
at
System.Componen tModel.Design.S erialization.De signerSerializa tionManager.Sys tem.ComponentMo del.Design.Seri alization.IDesi gnerSerializati onManager.Creat eInstance(Type
type, ICollection arguments, String name, Boolean addToContainer)
at
System.Componen tModel.Design.S erialization.Ty peCodeDomSerial izer.Deserializ e(IDesignerSeri alizationManage r
manager, CodeTypeDeclara tion declaration)
at
System.Componen tModel.Design.S erialization.Co deDomDesignerLo ader.PerformLoa d(IDesignerSeri alizationManage r
manager)
at
Microsoft.Visua lStudio.Design. Serialization.C odeDom.VSCodeDo mDesignerLoader .PerformLoad(ID esignerSerializ ationManager
serializationMa nager)
at
System.Componen tModel.Design.S erialization.Ba sicDesignerLoad er.BeginLoad(ID esignerLoaderHo st
host)

Mar 21 '06 #1
2 4299
I can't really see where you're driving at with this.

You have written a class (BaseForm) with a typo in it that is liable to
cause a stack overflow and yet you are you appear to be claiming that VS2005
has a bug in it.

Firstly System.Windows. Forms is a namespace and therfore I can't really
accept that you are deriving a class from it.

Secondly, neither of the stack traces indicate a call to the Count property
of your BaseForm.

If the Count property in your BasForm were to be called I would expect an
explicit stack overflow to be encountered with a few milliseconds.

When it comes to classes derived from System.Windows. Forms.Form, you have to
remember that code in the inherited class(es) may run when you load the
derived class in the designer. You have to implement code in the base
class(es) to cater for for this.
<sc*******@gmai l.com> wrote in message
news:11******** *************@t 31g2000cwb.goog legroups.com...
A coworker and I have spent the last day and a half trying to track
down this bug in our code. We found the solution and thought we might
post it to help others out...

The setup: Class FinalForm derives from Class BaseForm that derives
from System.Windows. Forms.

public class BaseForm : Forms {}
public class FinalForm : BaseForm {}

When trying to open class FinalForm in the designer one of a number of
error happens which are listed at the bottom, they are a bit long so
here is what was causing the problem, and the fix:

The problem:

A recursive call within the base class BaseForm:

public class BaseForm : Forms
{
int count =0;
public int Count
{
get { return Count; }
}
}

The Count's getter should be returning count, but is calling itself!
Once it returns the right thing, all is well.

I hope this helps out others!

Sam

The differen errors we saw, there might be more:

1: VS2005 crashes and either simply goes away or gives the dialog to
report the error to Microsoft.

2: One or more errors encountered while loading the designer. The
errors are listed below. Some errors can be fixed by rebuilding your
project, while others may require code changes.

Unable to load one or more of the requested types. Retrieve the
LoaderException s property for more information.
Hide

at System.Reflecti on.Module.GetTy pesInternal(Sta ckCrawlMark& stackMark)
at System.Reflecti on.Assembly.Get Types()
at
Microsoft.Visua lStudio.Shell.D esign.AssemblyO bsoleteEventArg s..ctor(Assembl y
assembly)
at
Microsoft.Visua lStudio.Design. VSDynamicTypeSe rvice.ReloadAss emblyIfChanged( String
codeBase)
at
Microsoft.Visua lStudio.Design. VSDynamicTypeSe rvice.CreateDyn amicAssembly(St ring
codeBase)
at
Microsoft.Visua lStudio.Design. VSTypeResolutio nService.Assemb lyEntry.get_Ass embly()
at
Microsoft.Visua lStudio.Design. VSTypeResolutio nService.Assemb lyEntry.Search( String
fullName, String typeName, Boolean ignoreTypeCase, Assembly& assembly,
String description)
at
Microsoft.Visua lStudio.Design. VSTypeResolutio nService.Search ProjectEntries( AssemblyName
assemblyName, String typeName, Boolean ignoreTypeCase, Assembly&
assembly)
at Microsoft.Visua lStudio.Design. VSTypeResolutio nService.GetTyp e(String
typeName, Boolean throwOnError, Boolean ignoreCase, ReferenceType
refType)
at
Microsoft.Visua lStudio.Design. Serialization.C odeDom.Aggregat eTypeResolution Service.GetType (String
name, Boolean throwOnError, Boolean ignoreCase)
at
Microsoft.Visua lStudio.Design. Serialization.C odeDom.Aggregat eTypeResolution Service.GetType (String
name)
at
System.Componen tModel.Design.D esignerHost.Sys tem.ComponentMo del.Design.IDes ignerHost.GetTy pe(String
typeName)
at
System.Componen tModel.Design.S erialization.Co deDomDesignerLo ader.EnsureDocu ment(IDesignerS erializationMan ager
manager)
at
System.Componen tModel.Design.S erialization.Co deDomDesignerLo ader.PerformLoa d(IDesignerSeri alizationManage r
manager)
at
Microsoft.Visua lStudio.Design. Serialization.C odeDom.VSCodeDo mDesignerLoader .PerformLoad(ID esignerSerializ ationManager
serializationMa nager)
at
System.Componen tModel.Design.S erialization.Ba sicDesignerLoad er.BeginLoad(ID esignerLoaderHo st
host)
3: One or more errors encountered while loading the designer. The
errors are listed below. Some errors can be fixed by rebuilding your
project, while others may require code changes.

Could not load file or assembly '<my assembly>, Version=1.0.0.0 ,
Culture=neutral , PublicKeyToken= 12e8b3ea4074fce 4' or one of its
dependencies. The system cannot find the file specified.
Hide

at System.Signatur e._GetSignature (SignatureStruc t& signature, Void*
pCorSig, Int32 cCorSig, IntPtr fieldHandle, IntPtr methodHandle, IntPtr
declaringTypeHa ndle)
at System.Signatur e.GetSignature( SignatureStruct & signature, Void*
pCorSig, Int32 cCorSig, RuntimeFieldHan dle fieldHandle,
RuntimeMethodHa ndle methodHandle, RuntimeTypeHand le
declaringTypeHa ndle)
at System.Signatur e..ctor(Runtime MethodHandle methodHandle,
RuntimeTypeHand le declaringTypeHa ndle)
at System.Reflecti on.RuntimeMetho dInfo.get_Signa ture()
at System.Reflecti on.RuntimeMetho dInfo.GetParame tersNoCopy()
at System.Reflecti on.RuntimePrope rtyInfo.GetInde xParameters()
at
System.Componen tModel.ReflectT ypeDescriptionP rovider.Reflect GetProperties(T ype
type)
at
System.Componen tModel.ReflectT ypeDescriptionP rovider.Reflect edTypeData.GetP roperties()
at
System.Componen tModel.TypeDesc riptor.TypeDesc riptionNode.Def aultTypeDescrip tor.System.Comp onentModel.ICus tomTypeDescript or.GetPropertie s()
at
System.Componen tModel.TypeDesc riptor.TypeDesc riptionNode.Def aultTypeDescrip tor.System.Comp onentModel.ICus tomTypeDescript or.GetPropertie s()
at System.Componen tModel.TypeDesc riptor.GetPrope rties(Type
componentType)
at
System.Windows. Forms.Design.Fo rmDocumentDesig ner.Initialize( IComponent
component)
at
System.Componen tModel.Design.D esignerHost.Add ToContainerPost Process(ICompon ent
component, String name, IContainer containerToAddT o)
at System.Componen tModel.Design.D esignerHost.Add (IComponent component,
String name)
at
System.Componen tModel.Design.D esignerHost.Sys tem.ComponentMo del.Design.IDes ignerHost.Creat eComponent(Type
componentType, String name)
at
System.Componen tModel.Design.S erialization.De signerSerializa tionManager.Cre ateInstance(Typ e
type, ICollection arguments, String name, Boolean addToContainer)
at
System.Componen tModel.Design.S erialization.De signerSerializa tionManager.Sys tem.ComponentMo del.Design.Seri alization.IDesi gnerSerializati onManager.Creat eInstance(Type
type, ICollection arguments, String name, Boolean addToContainer)
at
System.Componen tModel.Design.S erialization.Ty peCodeDomSerial izer.Deserializ e(IDesignerSeri alizationManage r
manager, CodeTypeDeclara tion declaration)
at
System.Componen tModel.Design.S erialization.Co deDomDesignerLo ader.PerformLoa d(IDesignerSeri alizationManage r
manager)
at
Microsoft.Visua lStudio.Design. Serialization.C odeDom.VSCodeDo mDesignerLoader .PerformLoad(ID esignerSerializ ationManager
serializationMa nager)
at
System.Componen tModel.Design.S erialization.Ba sicDesignerLoad er.BeginLoad(ID esignerLoaderHo st
host)

Mar 22 '06 #2
I guess I did not state things clearly. It first appeared to be a bug
in VS2005, but it turned out to be a recursive call in our code.

What I am driving at, or more accurately, why I made the posting is to
help out others that run into the same problem in their code. I am
hoping that someone else will search the news groups, find my posting
and say: Ah, let me look for a recursive call in my code!

It took two developers a day and a half to find this, I am hoping
others can benefit from what we learned.

As far as a explicit stack overflow, there isn't one. I believe the
reason is because VS2005 is using reflection to call into our code
right before it displays the designer and crashes not expecting a stack
overflow. I have a feeling this is not something Microsoft can help,
thus it is what it is.

Sam

Mar 22 '06 #3

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

Similar topics

3
12493
by: Philippe Trottier | last post by:
Hi! I have a C# program developped with VS2003 and Enterprise Library June 2005. I converted it to VS2005B2, recompiled Enterprise Library to VS2005 and now I'm stuck with a bug when my program closes. The error messsage says : ObjectDisposedException was unhandled Safe handle has been closed
1
2558
by: Mark B | last post by:
DoCmd.OutputTo acOutputReport, globCurrentReportToBeOutput, strFileType, strFileName, Me.CheckAutoStart On occasion, some (not many) of our users report that when they try to export some reports, there is a crash and our 97 runtime app shuts down. We can't duplicate this on our development machines. What reason(s) would cause such a crash to happen? Thanks for any ideas.
8
6451
by: Adam Louis | last post by:
I would like help resolving this problem. I'm a novice who's been hired to query a hospital database and extract useful information, available to me only in a dynamically generated, downloadable .mdb. The query below query runs correctly and without error, but any attempt to save it causes Access to crash without a message, leaving the .ldb file. Opening the DB reveals it saved a blank "query1". I've upgraded to Jet SP 8, and I'm running...
0
981
by: PaulM | last post by:
While using the debugger in VS2005 it occasionally will cause an Application_Error. The reason I know this is the first line of the Application_Error method checks the request object: if (Request.Url.Segments == "get_aspx_ver.aspx") This code was for VS2003 to catch when it was checking for the hidden file 'get_aspx_ver.aspx" to check which version of Framework was loaded. It appears that VS2005 does something different. Anybody...
4
5640
by: ARF | last post by:
I'm testing AutoCAD 2005 automation via VS2005 Pro C++/CLR and I'm getting fatal compiler errors. I start with a default C++/CLR class library project and modify it by adding the following references: acdbmgd.dll acmgd.dll the entire source for the default library header file is:
56
3525
by: Rob Dob | last post by:
VS2005 is a PIECE of Garbage and is bug Ridden, I wonder how many others feel the same, I am so sorry that I have moved away from VS2003, VS2005 is unstable, and half the stuff doesn't work, Microsft has spent so much time trying to make it simply that when you try to do something useful with it it doesn't work... Half the time it crashes, and menu items appear for things you cannot do. For example, Go into component designer, ...
16
1722
by: Edward Diener | last post by:
After spending more than a day reducing a complicated compiler bug to a simple case I reported it to the MSDN Product Feedback Center as a bug just now. However this bug is completely stymying my development of a VC++ component. Does Microsoft still offer any free bug reporting cases for VS2005, as they did two for VS2003 so that I can talk with a technical representative directly to try to find a workaround for the compiler bug ? While...
1
396
by: Norman Diamond | last post by:
After VS2005 SP1 crashes enough times, it stops offering to send crash dumps to Microsoft. But it doesn't stop crashing. When VS2005 SP1 reloads a project after a crash, it still displays a reminder "ha ha, you forgot to spend 30 minutes doing an Analyse in SourceSafe". Then it still proceeds to reload the project that needs analysis, without letting the user abort and run the analysis before reloading. VS2005 SP1 is a fine CTP,...
1
2396
by: virax | last post by:
Hello all, I'm working on a solution that interfaces with a PostgreSQL db, which occasionally uses the || operator to concatenate column values in a SELECT statement. Visual Studio 2005 is apparently baffled by this operator in TableAdapter queries, as it gives an error and does not generate parameters. It also likes to crash completely when I select the option to ignore the error and continue. I have only managed to successfully create...
0
8004
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7934
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8418
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6743
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5886
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3912
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3958
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2438
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1541
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.