none
Debugger is not getting hit RRS feed

  • Question

  • Hi All,

    I have developed on component in ASP.NET C# and it was working fine

    I am having window form on which there is button and on click on that button my C# code get call.

    It was working fine before some time, i have made small change in C# .cs file and build it added debugger in file where i changed my code now once click on button i am not able to debug my code it directly getting execute.Now sure what cause this issue ?

    Is it realted to CACHE ? GAC ? i have tried un-gac and re- gac my compoement.dll but of no use.

    The break point or debugger is showing me message that The break point will not currently be hit. No Symbol have been loaded or this document.

    any idea how to resolve this issue ?


    Thanks and Regards, Nitin.

    • Moved by [Kamlesh Kumar] Wednesday, June 12, 2019 10:13 AM Question is not related to BizTalk
    Wednesday, June 12, 2019 10:08 AM

All replies

  • Hi Nitin,

    Thank you posting on MSDN forum.

    Seems your question was not related to BizTalk so moved this thread to proper forum.


    Thanks,
    Kamlesh Kumar

    If my reply is helpful please mark as Answer or vote as Helpful.

    My blog | Twitter | LinkedIn

    Wednesday, June 12, 2019 10:15 AM
  • Your assembly and the source code for the assembly  the debugger is using are out of sync.

    You should do a 'Clean' and 'Rebuild' of  the solution that should clean everything out . The debugger should work after you do that. 

    Wednesday, June 12, 2019 10:54 AM
  • Your assembly and the source code for the assembly  the debugger is using are out of sync.

    You should do a 'Clean' and 'Rebuild' of  the solution that should clean everything out . The debugger should work after you do that. 

    Thanks for your help , I done what you suggested but still it's not working.

    Thanks and Regards, Nitin.

    Wednesday, June 12, 2019 11:59 AM
  • Your assembly and the source code for the assembly  the debugger is using are out of sync.

    You should do a 'Clean' and 'Rebuild' of  the solution that should clean everything out . The debugger should work after you do that. 

    Thanks for your help , I done what you suggested but still it's not working.

    Thanks and Regards, Nitin.


    You were talking about two environments Web and Windows desktop.  Where in the code you are trying to debug? What is hosting the code. How is the code being accessed? 
    • Edited by DA924x Wednesday, June 12, 2019 3:40 PM
    Wednesday, June 12, 2019 1:50 PM
  • Wait a second. You have a web component in ASP.NET but you're calling it from Winforms? What kind of component is this? Is it a REST API/WCF or a UI component? If it is a UI component then how exactly are you getting it to show up in Winforms?

    If it is a REST API/WCF then are you running the API/WCF project in the debugger? Note that by default VS will only run (and therefore debug) a single executable at a time. It is whatever the startup project happens to be. If that project loads class libraries then they will be debuggable because they are running in the startup project's process. However other projects won't be loaded and therefore won't be debuggable. To debug multiple executable projects (aka a Winforms app and an API/WCF project) you need to tell VS to start up multiple projects. Alternatively if the Winform project is running fine and you you're just testing your API/WCF project then you can just debug that project and use the (already compiled) winforms executable directly.

    After you've configured VS to debug both projects also note that your Winforms project needs to be pointing its endpoint/client URL to the local instance that is running when the debugger kicks in (e.g. http://localhost:35000/myservice). If it is pointing to a remote server or something then you won't be able to step into the code as you aren't debugging the remote instance.



    Michael Taylor http://www.michaeltaylorp3.net

    Wednesday, June 12, 2019 1:55 PM
    Moderator
  • Hello,

    See the following for clearing cache.

    https://github.com/Codealike/Codealike-KnowledgeBase/blob/master/clear-visual-studio-component-cache.md


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Wednesday, June 12, 2019 3:01 PM
    Moderator
  • Your assembly and the source code for the assembly  the debugger is using are out of sync.

    You should do a 'Clean' and 'Rebuild' of  the solution that should clean everything out . The debugger should work after you do that. 

    Thanks for your help , I done what you suggested but still it's not working.

    Thanks and Regards, Nitin.


    You were talking about two environments Web and Windows desktop.  Where in the code you are trying to debug? What is hosting the code. How is the code being accessed? 
    My mistake i have C# code .cs file which i am calling on click of Window desktop application form.

    Thanks and Regards, Nitin.

    Thursday, June 13, 2019 7:18 AM
  • Wait a second. You have a web component in ASP.NET but you're calling it from Winforms? What kind of component is this? Is it a REST API/WCF or a UI component? If it is a UI component then how exactly are you getting it to show up in Winforms?

    If it is a REST API/WCF then are you running the API/WCF project in the debugger? Note that by default VS will only run (and therefore debug) a single executable at a time. It is whatever the startup project happens to be. If that project loads class libraries then they will be debuggable because they are running in the startup project's process. However other projects won't be loaded and therefore won't be debuggable. To debug multiple executable projects (aka a Winforms app and an API/WCF project) you need to tell VS to start up multiple projects. Alternatively if the Winform project is running fine and you you're just testing your API/WCF project then you can just debug that project and use the (already compiled) winforms executable directly.

    After you've configured VS to debug both projects also note that your Winforms project needs to be pointing its endpoint/client URL to the local instance that is running when the debugger kicks in (e.g. http://localhost:35000/myservice). If it is pointing to a remote server or something then you won't be able to step into the code as you aren't debugging the remote instance.



    Michael Taylor http://www.michaeltaylorp3.net

    My mistake i have C# code .cs file which i am calling on click of Window desktop application form.

    Thanks and Regards, Nitin.

    Thursday, June 13, 2019 7:18 AM
  • Your assembly and the source code for the assembly  the debugger is using are out of sync.

    You should do a 'Clean' and 'Rebuild' of  the solution that should clean everything out . The debugger should work after you do that. 

    Thanks for your help , I done what you suggested but still it's not working.

    Thanks and Regards, Nitin.


    You were talking about two environments Web and Windows desktop.  Where in the code you are trying to debug? What is hosting the code. How is the code being accessed? 

    My mistake i have C# code .cs file which i am calling on click of Window desktop application form.

    Thanks and Regards, Nitin.

    Are you using a code repository like TFS, SVN, etc., and etc.?

    Also is all of this code in a single project or separate projects in a single VS .SNL file?

    • Edited by DA924x Thursday, June 13, 2019 9:58 AM
    Thursday, June 13, 2019 9:41 AM
  • So you have a .cs file in your project. You compile your project in Visual Studio. There are no build errors correct?

    Then when you put a breakpoint on an executable line of code and use F5 to debug your code (not Run without Debugging) then the breakpoint does not get hit even though you set it?

    This C# file would have at least a type in it. Are you referencing that type in your main executable project? When the debugger starts up does the breakpoint icon show as fully red or does it switch to "this won't be hit" at that point? If it shows it won't be hit it is quite possible it simply hasn't been loaded yet. .NET delay loads dependencies. Put a breakpoint in your main executable code somewhere in the call path that you know will eventually call code from this new C# file. Then debug your code and do whatever it takes to hit that breakpoint. When the breakpoint is hit then step into (F11, by default) the code line by line until it gets to where you expect the C# file to be executed.

    If it never loads it then your code is out of sync. If it opens up a brand new file then your C# file isn't where that code is defined. It is getting it from elsewhere.


    Michael Taylor http://www.michaeltaylorp3.net

    Thursday, June 13, 2019 1:39 PM
    Moderator