views:

790

answers:

4

I do not get the normal error message saying debugging is not enabled red error message. If i remove my global asax file, my code goes to my breakpoint. If i add the file back in, the project runs totally ignoring any break points. Here is the code inside my global asax file

Public Class Global_asax Inherits System.Web.HttpApplication

Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
    ' Fires when the session is started
    Application("concurentUsers") += 1
End Sub

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
    ' Fires when the session ends
    If Session("loggedout") = Nothing Then
        Application("concurentUsers") += -1
    End If
End Sub

End Class

So as you can see its not much. I do receive the following messagebox from visual studio when runnning the project WITH the global .asax file present

"The following module was built either with optimizations enabled or without debug information: (path to my temp asp.net files) To debug this module, change the project build configuration to debug mode. To supress this message, disable the 'Warn if no user code on launch' debugger option."

I have tried to delete these temp files, but then causes the project to be completely undebuggable and get the red error messagebox stating so and had to restore from the recycle bin to get my project back in order. So its very anoying that i have to remove the global asax file in order to debug the project (and any code associated with it threwout the project files)

P.S. Everything is being run in debug mode along with it marked as such in the web config. As i said it debugs fine without the global.asax file present

A: 

As a side issue, you should be using Application.Lock. Also += -1 is odd. You should do -= 1

Application.Lock()
Application("concurentUsers") -= 1
Application.UnLock()

Never mind the spelling of concurrent.

RichardOD
+1  A: 

Post the entire contents of global.asax and global.asax.cs (if it exists). My guess is that the Application directive at the top of global.asax has a compiler directive or something in it that's causing the behavior (for example, /debug- or /debug:pdbonly could cause this behavior).

technophile
A: 

You can try and clear out your Temporary ASP.NET folder.

That sometimes causes configuration issues.

Don't delete the folder, just delete its contents.

Jack Marchetti
A: 

This problem has driven me nuts on several occassions. What I have found is that during a push to production I have changed the "Configuration" from Active (Debug) to Release and set the "Enable Optimizations" option on the Advanced compiler settings window (Project Properties/Compile/Advanced Compile Options). If I later set the configuration type back to "Active (Debug)" I tend to forget to uncheck the "Enable Optimizations" option. When that occurs I get the error message about "Optimizations enabled" or "Without debug information". In the past I always clued on the "Without Debug information" which threw me off track.

So the short answer is: Double check that "Enable Optimizations" option is unchecked and the "Generate debug info:" is set to full or pbd-only on the Advanced Compiler Settings.

HTH,

James.