Visual Studio Development Bookmark and Share   
 index > Visual Studio Debugger > Stack overflow from apparent infinite loop in Settings.Designer.vb
 

Stack overflow from apparent infinite loop in Settings.Designer.vb

I have an application that is going into an apparent infinite loop while setting up Settings, before the main window even loads. 

The error occurs in the Default method of MySettings, on the AddHandler statement. 

        Public Shared ReadOnly Property [Default]() As MySettings
            Get
                
#If _MyType = "WindowsForms" Then
               If Not addedHandler Then
                    SyncLock addedHandlerLockObject
                        If Not addedHandler Then
                            AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
                            addedHandler = True
                        End If
                    End SyncLock
                End If
#End If
                Return defaultInstance
            End Get
        End Property

The exception thrown is StackOverflowException, which clearly points to an infinite loop.

What is causing this? This is in Visual Studio 2008 Express, using .Net 3.5.
bienvenunet  Thursday, October 15, 2009 5:08 PM
Hello,

If you don't mind, could I ask why do we have to modify the code generated by the tool? Please note that changed to the generated code may cause incorrect behavior and will be lost if the code is regenerated.

By the way, I recommend you post thread in the VB.NET forum, there are more exports there to provide help.

Best regards,
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
If you have any feedback, please tell us.
Welcome to the All-In-One Code Framework!
Roahn Luo  Friday, October 16, 2009 11:18 AM
Hello,

If you don't mind, could I ask why do we have to modify the code generated by the tool? Please note that changed to the generated code may cause incorrect behavior and will be lost if the code is regenerated.

By the way, I recommend you post thread in the VB.NET forum, there are more exports there to provide help.

Best regards,
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
If you have any feedback, please tell us.
Welcome to the All-In-One Code Framework!
Roahn Luo  Friday, October 16, 2009 11:18 AM

You can use google to search for other answers

Custom Search

More Threads

• The following module was built either with optimizations enabled or without debug information
• Using SymSrv Wrongly Downloads Files Locally
• Run time Exceptions
• Debuggin sql 2005 stored procedures with Visual Studio 2005
• How to display global variables in VC++ Watch / QuickWatch windows
• f:\sp\vctools\vc7libs\ship\atlmfc\src\mfc\objcore.cpp
• Debugger does not stop
• Dataset cannot be referenced anywhere in the system.
• How to by pass error checking...I need to ignore the erros and use a function that corrects the erros...
• Using WinDbg dumps to go back in time : How to load dump back into the context of the currently attached debugee ?