473,383 Members | 1,862 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,383 software developers and data experts.

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
LoaderExceptions property for more information.
Hide

at System.Reflection.Module.GetTypesInternal(StackCra wlMark& stackMark)
at System.Reflection.Assembly.GetTypes()
at
Microsoft.VisualStudio.Shell.Design.AssemblyObsole teEventArgs..ctor(Assembly
assembly)
at
Microsoft.VisualStudio.Design.VSDynamicTypeService .ReloadAssemblyIfChanged(String
codeBase)
at
Microsoft.VisualStudio.Design.VSDynamicTypeService .CreateDynamicAssembly(String
codeBase)
at
Microsoft.VisualStudio.Design.VSTypeResolutionServ ice.AssemblyEntry.get_Assembly()
at
Microsoft.VisualStudio.Design.VSTypeResolutionServ ice.AssemblyEntry.Search(String
fullName, String typeName, Boolean ignoreTypeCase, Assembly& assembly,
String description)
at
Microsoft.VisualStudio.Design.VSTypeResolutionServ ice.SearchProjectEntries(AssemblyName
assemblyName, String typeName, Boolean ignoreTypeCase, Assembly&
assembly)
at Microsoft.VisualStudio.Design.VSTypeResolutionServ ice.GetType(String
typeName, Boolean throwOnError, Boolean ignoreCase, ReferenceType
refType)
at
Microsoft.VisualStudio.Design.Serialization.CodeDo m.AggregateTypeResolutionService.GetType(String
name, Boolean throwOnError, Boolean ignoreCase)
at
Microsoft.VisualStudio.Design.Serialization.CodeDo m.AggregateTypeResolutionService.GetType(String
name)
at
System.ComponentModel.Design.DesignerHost.System.C omponentModel.Design.IDesignerHost.GetType(String
typeName)
at
System.ComponentModel.Design.Serialization.CodeDom DesignerLoader.EnsureDocument(IDesignerSerializati onManager
manager)
at
System.ComponentModel.Design.Serialization.CodeDom DesignerLoader.PerformLoad(IDesignerSerializationM anager
manager)
at
Microsoft.VisualStudio.Design.Serialization.CodeDo m.VSCodeDomDesignerLoader.PerformLoad(IDesignerSer ializationManager
serializationManager)
at
System.ComponentModel.Design.Serialization.BasicDe signerLoader.BeginLoad(IDesignerLoaderHost
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=12e8b3ea4074fce4' or one of its
dependencies. The system cannot find the file specified.
Hide

at System.Signature._GetSignature(SignatureStruct& signature, Void*
pCorSig, Int32 cCorSig, IntPtr fieldHandle, IntPtr methodHandle, IntPtr
declaringTypeHandle)
at System.Signature.GetSignature(SignatureStruct& signature, Void*
pCorSig, Int32 cCorSig, RuntimeFieldHandle fieldHandle,
RuntimeMethodHandle methodHandle, RuntimeTypeHandle
declaringTypeHandle)
at System.Signature..ctor(RuntimeMethodHandle methodHandle,
RuntimeTypeHandle declaringTypeHandle)
at System.Reflection.RuntimeMethodInfo.get_Signature( )
at System.Reflection.RuntimeMethodInfo.GetParametersN oCopy()
at System.Reflection.RuntimePropertyInfo.GetIndexPara meters()
at
System.ComponentModel.ReflectTypeDescriptionProvid er.ReflectGetProperties(Type
type)
at
System.ComponentModel.ReflectTypeDescriptionProvid er.ReflectedTypeData.GetProperties()
at
System.ComponentModel.TypeDescriptor.TypeDescripti onNode.DefaultTypeDescriptor.System.ComponentModel .ICustomTypeDescriptor.GetProperties()
at
System.ComponentModel.TypeDescriptor.TypeDescripti onNode.DefaultTypeDescriptor.System.ComponentModel .ICustomTypeDescriptor.GetProperties()
at System.ComponentModel.TypeDescriptor.GetProperties (Type
componentType)
at
System.Windows.Forms.Design.FormDocumentDesigner.I nitialize(IComponent
component)
at
System.ComponentModel.Design.DesignerHost.AddToCon tainerPostProcess(IComponent
component, String name, IContainer containerToAddTo)
at System.ComponentModel.Design.DesignerHost.Add(ICom ponent component,
String name)
at
System.ComponentModel.Design.DesignerHost.System.C omponentModel.Design.IDesignerHost.CreateComponent (Type
componentType, String name)
at
System.ComponentModel.Design.Serialization.Designe rSerializationManager.CreateInstance(Type
type, ICollection arguments, String name, Boolean addToContainer)
at
System.ComponentModel.Design.Serialization.Designe rSerializationManager.System.ComponentModel.Design .Serialization.IDesignerSerializationManager.Creat eInstance(Type
type, ICollection arguments, String name, Boolean addToContainer)
at
System.ComponentModel.Design.Serialization.TypeCod eDomSerializer.Deserialize(IDesignerSerializationM anager
manager, CodeTypeDeclaration declaration)
at
System.ComponentModel.Design.Serialization.CodeDom DesignerLoader.PerformLoad(IDesignerSerializationM anager
manager)
at
Microsoft.VisualStudio.Design.Serialization.CodeDo m.VSCodeDomDesignerLoader.PerformLoad(IDesignerSer ializationManager
serializationManager)
at
System.ComponentModel.Design.Serialization.BasicDe signerLoader.BeginLoad(IDesignerLoaderHost
host)

Mar 21 '06 #1
2 4281
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*******@gmail.com> wrote in message
news:11*********************@t31g2000cwb.googlegro ups.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
LoaderExceptions property for more information.
Hide

at System.Reflection.Module.GetTypesInternal(StackCra wlMark& stackMark)
at System.Reflection.Assembly.GetTypes()
at
Microsoft.VisualStudio.Shell.Design.AssemblyObsole teEventArgs..ctor(Assembly
assembly)
at
Microsoft.VisualStudio.Design.VSDynamicTypeService .ReloadAssemblyIfChanged(String
codeBase)
at
Microsoft.VisualStudio.Design.VSDynamicTypeService .CreateDynamicAssembly(String
codeBase)
at
Microsoft.VisualStudio.Design.VSTypeResolutionServ ice.AssemblyEntry.get_Assembly()
at
Microsoft.VisualStudio.Design.VSTypeResolutionServ ice.AssemblyEntry.Search(String
fullName, String typeName, Boolean ignoreTypeCase, Assembly& assembly,
String description)
at
Microsoft.VisualStudio.Design.VSTypeResolutionServ ice.SearchProjectEntries(AssemblyName
assemblyName, String typeName, Boolean ignoreTypeCase, Assembly&
assembly)
at Microsoft.VisualStudio.Design.VSTypeResolutionServ ice.GetType(String
typeName, Boolean throwOnError, Boolean ignoreCase, ReferenceType
refType)
at
Microsoft.VisualStudio.Design.Serialization.CodeDo m.AggregateTypeResolutionService.GetType(String
name, Boolean throwOnError, Boolean ignoreCase)
at
Microsoft.VisualStudio.Design.Serialization.CodeDo m.AggregateTypeResolutionService.GetType(String
name)
at
System.ComponentModel.Design.DesignerHost.System.C omponentModel.Design.IDesignerHost.GetType(String
typeName)
at
System.ComponentModel.Design.Serialization.CodeDom DesignerLoader.EnsureDocument(IDesignerSerializati onManager
manager)
at
System.ComponentModel.Design.Serialization.CodeDom DesignerLoader.PerformLoad(IDesignerSerializationM anager
manager)
at
Microsoft.VisualStudio.Design.Serialization.CodeDo m.VSCodeDomDesignerLoader.PerformLoad(IDesignerSer ializationManager
serializationManager)
at
System.ComponentModel.Design.Serialization.BasicDe signerLoader.BeginLoad(IDesignerLoaderHost
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=12e8b3ea4074fce4' or one of its
dependencies. The system cannot find the file specified.
Hide

at System.Signature._GetSignature(SignatureStruct& signature, Void*
pCorSig, Int32 cCorSig, IntPtr fieldHandle, IntPtr methodHandle, IntPtr
declaringTypeHandle)
at System.Signature.GetSignature(SignatureStruct& signature, Void*
pCorSig, Int32 cCorSig, RuntimeFieldHandle fieldHandle,
RuntimeMethodHandle methodHandle, RuntimeTypeHandle
declaringTypeHandle)
at System.Signature..ctor(RuntimeMethodHandle methodHandle,
RuntimeTypeHandle declaringTypeHandle)
at System.Reflection.RuntimeMethodInfo.get_Signature( )
at System.Reflection.RuntimeMethodInfo.GetParametersN oCopy()
at System.Reflection.RuntimePropertyInfo.GetIndexPara meters()
at
System.ComponentModel.ReflectTypeDescriptionProvid er.ReflectGetProperties(Type
type)
at
System.ComponentModel.ReflectTypeDescriptionProvid er.ReflectedTypeData.GetProperties()
at
System.ComponentModel.TypeDescriptor.TypeDescripti onNode.DefaultTypeDescriptor.System.ComponentModel .ICustomTypeDescriptor.GetProperties()
at
System.ComponentModel.TypeDescriptor.TypeDescripti onNode.DefaultTypeDescriptor.System.ComponentModel .ICustomTypeDescriptor.GetProperties()
at System.ComponentModel.TypeDescriptor.GetProperties (Type
componentType)
at
System.Windows.Forms.Design.FormDocumentDesigner.I nitialize(IComponent
component)
at
System.ComponentModel.Design.DesignerHost.AddToCon tainerPostProcess(IComponent
component, String name, IContainer containerToAddTo)
at System.ComponentModel.Design.DesignerHost.Add(ICom ponent component,
String name)
at
System.ComponentModel.Design.DesignerHost.System.C omponentModel.Design.IDesignerHost.CreateComponent (Type
componentType, String name)
at
System.ComponentModel.Design.Serialization.Designe rSerializationManager.CreateInstance(Type
type, ICollection arguments, String name, Boolean addToContainer)
at
System.ComponentModel.Design.Serialization.Designe rSerializationManager.System.ComponentModel.Design .Serialization.IDesignerSerializationManager.Creat eInstance(Type
type, ICollection arguments, String name, Boolean addToContainer)
at
System.ComponentModel.Design.Serialization.TypeCod eDomSerializer.Deserialize(IDesignerSerializationM anager
manager, CodeTypeDeclaration declaration)
at
System.ComponentModel.Design.Serialization.CodeDom DesignerLoader.PerformLoad(IDesignerSerializationM anager
manager)
at
Microsoft.VisualStudio.Design.Serialization.CodeDo m.VSCodeDomDesignerLoader.PerformLoad(IDesignerSer ializationManager
serializationManager)
at
System.ComponentModel.Design.Serialization.BasicDe signerLoader.BeginLoad(IDesignerLoaderHost
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
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...
1
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...
8
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...
0
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...
4
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...
56
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, ...
16
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...
1
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...
1
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...
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.