Breakpoints work fine once I go to browser and reload the page. What could cause this?
I could not find a single instance of this issue being raised anywhere on the net. I seem to have this type of thing happen often. Do I win some kind of prize?
Edit: also you don't have any error message when hovering on this breakpoint prior to launching it ? You are in debug mode without code optimization enabled ?
It isn't just "this" breakpoint, it is all breakpoints. And yes, I'm sure. Whatever page I set as the "start page" when the debugger launches does not hit break points until the reload. Simple.
It isn't just "this" breakpoint, it is all breakpoints. And yes, I'm sure. Whatever page I set as the "start page" when the debugger launches does not hit break points until the reload. Simple.
Share sample code, the break point location, and steps to reproduce this issue.
It isn't just "this" breakpoint, it is all breakpoints. And yes, I'm sure. Whatever page I set as the "start page" when the debugger launches does not hit break points until the reload. Simple.
Share sample code, the break point location, and steps to reproduce this issue.
As I said this occurs on ALL breakpoints, supplying "sample code" will serve no purpose except to confuse people. And as I said it occurs when I launch the debugger at the "start page" I can't think of a more clear outline for "steps to reproduce". Did
you read the text of mine that you quoted above?
As I said this occurs on ALL breakpoints, supplying "sample code" will serve no purpose except to confuse people. And as I said it occurs when I launch the debugger at the "start page" I can't think of a more clear outline for "steps to reproduce". Did you
read the text of mine that you quoted above?
This is an atypical issue that I've never run across. Either there is something with the code that causes an unexpected execution path or there is something with how the project is setup. Simply, if the community cannot reproduce the issue then we cannot
solve the problem.
This is an ASP.NET Web Forms application? Are you debugging in IIS Express or have you deployed the app to localhost or another environment and remote debugging? Are you pressing F5 to start the debugger? Are you debugging JavaScript?
This is an atypical issue that I've never run across. Either there is something with the code that causes an unexpected execution path or there is something with how the project is setup. Simply, if the community cannot reproduce the issue then we cannot
solve the problem.
This is an ASP.NET Web Forms application? Are you debugging in IIS Express or have you deployed the app to localhost or another environment and remote debugging? Are you pressing F5 to start the debugger? Are you debugging JavaScript?
Do you have any empty catch blocks in the code?
Thank you for taking the time to understand the nature of this odd issue. :) I agree that your two guesses are likely. But by the nature of this problem, if I knew how to reproduce it I'd likely have it solved, and alas, that is why I am here. Anyway,
here is more info:
ASP.NET 4.8 Web Forms
Debugging in IIS Express
F5 to start debugger (is there another way?)
Not debugging JS
This problem arose in the past several months, but I cannot recall what changes may have caused it. I haven't changed much in the configuration. Think I upgraded from .NET 4.5 at some point. But if that were the cause, I'm sure this issue would have
been raised by someone else.
Just noticed your question about empty catch blocks. I use them in a few places for non-critical errors. However, as I mentioned, this has been going on for months and I've ran the debugger a thousand times through different code paths and it happens every
time. So that doesn't seem likely. Not to mention, even if it were, why would the breakpoints miss on pass 1 and pass 1 only?
As I said this occurs on ALL breakpoints, supplying "sample code" will serve no purpose except to confuse people.
I can't reproduce your problem without code, but I guess it should be caused by the cache file.
You can try to delete the .pdb file before debugging (this file is used to record the debug information, it will be regenerated automatically after deletion), and then debug it after re-dubug or rebuild the project. The .Pdb files exist in bin and obj folders.
Best regards,
Sam
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
But by the nature of this problem, if I knew how to reproduce it I'd likely have it solved, and alas, that is why I am here. Anyway, here is more info:
At least you have the code. The community is unable to review the code for possible issues.
Slimfinger
F5 to start debugger (is there another way?)
Attach to process.
Slimfinger
Just noticed your question about empty catch blocks. I use them in a few places for non-critical errors. However, as I mentioned, this has been going on for months and I've ran the debugger a thousand times through different code paths and it happens every
time. So that doesn't seem likely. Not to mention, even if it were, why would the breakpoints miss on pass 1 and pass 1 only?
Execution follows a different path when there is an exception. For example, fetching a Session variable in the startup page while the Session variable is set in another page. Session will not exist because running the project clears Session.
Break points can be configured as conditional. Check the break point configuration.
I have not set any conditional breakpoints. (Btw, I remember trying to use conditional breakpoints 20 years ago and never getting them to work.) But somehow now you suspect that all the breakpoints in my entire project could be conditional without ever
being set as such.
And yes, I have the code. Perhaps a million lines, any of which may or may not contribute to this. Shall I post it? I figure there comes a point where one must weigh the pros and cons of approaching a problem in a certain way, and I'm gonna make a leap
of judgment and say that posting my code isn't the best path to solution. And yes, I certainly could try to track this down by doing some of the things you've suggested, along with many others. Basically, I thought it was worth a stab to see if someone had
ran into this before; it seems that wasn't the case.
I do thank you for your attention. I'll figure it out.
Perhaps a million lines, any of which may or may not contribute to this. Shall I post it? I figure there comes a point where one must weigh the pros and cons of approaching a problem in a certain way, and I'm gonna make a leap of judgment and say that posting
my code isn't the best path to solution.
The premise for solving your problem is to reproduce your problem. If we answer your question by some description, we can only make some speculation based on this description.
So we want to reproduce your problem through your code, but if you have too much code, you can try to write a simple demo, then set a breakpoint to debug it to see if the same problem will occur. This will determine whether the problem is with visual studio
or your project.
Best regards,
Sam
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Member
4 Points
114 Posts
C# Breakpoints not getting hit on initial page load ONLY
Nov 18, 2019 11:09 AM|Slimfinger|LINK
Subject says it all. Two questions:
A little more info:
a) Using Visual Studio 2019 Community.
b) Have Resharper Ultimate installed.
Thanks for any help! :)
Bill Nolan
Phoenix, AZ
All-Star
48530 Points
18078 Posts
Re: C# Breakpoints not getting hit on initial page load ONLY
Nov 18, 2019 02:32 PM|PatriceSc|LINK
Hi,
You are 100% sure you do access to the page first or could it be for example taken from the cache before being actually reloaded ?
My first move would be likely to use something such as https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.debugger.break?view=netframework-4.8 or writing to the Debug log to make 100% I really first hit this location.
Edit: also you don't have any error message when hovering on this breakpoint prior to launching it ? You are in debug mode without code optimization enabled ?
Member
4 Points
114 Posts
Re: C# Breakpoints not getting hit on initial page load ONLY
Nov 18, 2019 03:23 PM|Slimfinger|LINK
It isn't just "this" breakpoint, it is all breakpoints. And yes, I'm sure. Whatever page I set as the "start page" when the debugger launches does not hit break points until the reload. Simple.
All-Star
53051 Points
23644 Posts
Re: C# Breakpoints not getting hit on initial page load ONLY
Nov 18, 2019 03:31 PM|mgebhard|LINK
Share sample code, the break point location, and steps to reproduce this issue.
Member
4 Points
114 Posts
Re: C# Breakpoints not getting hit on initial page load ONLY
Nov 18, 2019 09:39 PM|Slimfinger|LINK
As I said this occurs on ALL breakpoints, supplying "sample code" will serve no purpose except to confuse people. And as I said it occurs when I launch the debugger at the "start page" I can't think of a more clear outline for "steps to reproduce". Did you read the text of mine that you quoted above?
All-Star
53051 Points
23644 Posts
Re: C# Breakpoints not getting hit on initial page load ONLY
Nov 18, 2019 10:08 PM|mgebhard|LINK
This is an atypical issue that I've never run across. Either there is something with the code that causes an unexpected execution path or there is something with how the project is setup. Simply, if the community cannot reproduce the issue then we cannot solve the problem.
This is an ASP.NET Web Forms application? Are you debugging in IIS Express or have you deployed the app to localhost or another environment and remote debugging? Are you pressing F5 to start the debugger? Are you debugging JavaScript?
Do you have any empty catch blocks in the code?
Member
4 Points
114 Posts
Re: C# Breakpoints not getting hit on initial page load ONLY
Nov 19, 2019 05:08 AM|Slimfinger|LINK
Thank you for taking the time to understand the nature of this odd issue. :) I agree that your two guesses are likely. But by the nature of this problem, if I knew how to reproduce it I'd likely have it solved, and alas, that is why I am here. Anyway, here is more info:
Member
4 Points
114 Posts
Re: C# Breakpoints not getting hit on initial page load ONLY
Nov 19, 2019 05:18 AM|Slimfinger|LINK
Just noticed your question about empty catch blocks. I use them in a few places for non-critical errors. However, as I mentioned, this has been going on for months and I've ran the debugger a thousand times through different code paths and it happens every time. So that doesn't seem likely. Not to mention, even if it were, why would the breakpoints miss on pass 1 and pass 1 only?
Contributor
3370 Points
1409 Posts
Re: C# Breakpoints not getting hit on initial page load ONLY
Nov 19, 2019 08:17 AM|samwu|LINK
Hi Slimfinger,
I can't reproduce your problem without code, but I guess it should be caused by the cache file.
You can try to delete the .pdb file before debugging (this file is used to record the debug information, it will be regenerated automatically after deletion), and then debug it after re-dubug or rebuild the project. The .Pdb files exist in bin and obj folders.
Best regards,
Sam
All-Star
48530 Points
18078 Posts
Re: C# Breakpoints not getting hit on initial page load ONLY
Nov 19, 2019 08:51 AM|PatriceSc|LINK
My first move would be still to use https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.debugger.break?view=netframework-4.8 right before the breakpoint to see what happens. It stop there but not on the breakpoint that follows and later it stops at both places? Or it doesn't stop at all the first time?
All-Star
53051 Points
23644 Posts
Re: C# Breakpoints not getting hit on initial page load ONLY
Nov 19, 2019 12:33 PM|mgebhard|LINK
At least you have the code. The community is unable to review the code for possible issues.
Attach to process.
Execution follows a different path when there is an exception. For example, fetching a Session variable in the startup page while the Session variable is set in another page. Session will not exist because running the project clears Session.
Break points can be configured as conditional. Check the break point configuration.
https://docs.microsoft.com/en-us/visualstudio/debugger/using-breakpoints?view=vs-2019
Create a new project to see if the behavior is the same. That will tell you if the issue is in the project or Visual Studio.
Member
4 Points
114 Posts
Re: C# Breakpoints not getting hit on initial page load ONLY
Nov 19, 2019 05:25 PM|Slimfinger|LINK
I have not set any conditional breakpoints. (Btw, I remember trying to use conditional breakpoints 20 years ago and never getting them to work.) But somehow now you suspect that all the breakpoints in my entire project could be conditional without ever being set as such.
And yes, I have the code. Perhaps a million lines, any of which may or may not contribute to this. Shall I post it? I figure there comes a point where one must weigh the pros and cons of approaching a problem in a certain way, and I'm gonna make a leap of judgment and say that posting my code isn't the best path to solution. And yes, I certainly could try to track this down by doing some of the things you've suggested, along with many others. Basically, I thought it was worth a stab to see if someone had ran into this before; it seems that wasn't the case.
I do thank you for your attention. I'll figure it out.
Thanks.
Contributor
3370 Points
1409 Posts
Re: C# Breakpoints not getting hit on initial page load ONLY
Nov 20, 2019 01:49 AM|samwu|LINK
Hi Slimfinger,
The premise for solving your problem is to reproduce your problem. If we answer your question by some description, we can only make some speculation based on this description.
So we want to reproduce your problem through your code, but if you have too much code, you can try to write a simple demo, then set a breakpoint to debug it to see if the same problem will occur. This will determine whether the problem is with visual studio or your project.
Best regards,
Sam