Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing "Please restart your debugging session" to make a developer's life easier. #27976

Closed
ghost opened this issue Jun 19, 2018 · 8 comments
Closed
Labels
Area-Interactive Interactive-EnC Resolution-Duplicate The described behavior is tracked in another issue Story
Milestone

Comments

@ghost
Copy link

ghost commented Jun 19, 2018

Last month I was writing code in C#, everything is going fine,

every time I change a lambada expression make me compile again.
every time I add the namespace make me compile again.
every time I change something in a variable (that has a breakpoint and currently pointer) make me compile again.

Most of the other thing make me compile again, This thing creeps me out, On the same side, I see developer writing the same thing in javascript doesn't need to stop and recompile.

I do a lot of recompiles to finish my work, What was I doing is consuming some API in my C# code using Restsharp and Newtonsoft.Json.

I write the same code in javascript and run it in chrome dev tool (I am not saying Javascript is good)
and debug the whole app without stop and compile.

If you are using chrome dev tool, it takes breakpoint as same as your Visual Studio editor. When you modified something it's going in the outer block. I debug my whole app without a stop at any point. This is non-stop debugging experience. I was thinking to post it in csharplang but I post it here because Roslyn is compiler and it's related to the compiler.

I have posted the same issue in https://developercommunity.visualstudio.com/content/problem/242242/the-biggest-problem-in-writing-c-code.html

if this can be improved, I believe it can help many developers. For me, I can write my code without stop and able to enjoy debugging more than ever.

@ghost ghost changed the title Adding namespace at compile time, making a developer's life easier. Fixing "Please restart your debugging session" to make a developer's life easier. Jun 19, 2018
@tmat
Copy link
Member

tmat commented Jun 19, 2018

@anirugu Thanks for feedback. This is definitely the right repository to post it. We are aware that some of the limitations, like inability to add a namespace are painful to deal with (tracked by issue #10043). We have done many improvements in this area in past, but I agree there is definitely more room for improvement.

In some cases you might be able to make the change in the code if you step out of the current block or a method. For example, making any change in a foreach statement is allowed while there is no code executing the statement but it's limited when stopped in the middle of the iteration. Restrictions like these are reported as "... around an active statement ...".

Sometimes it's simply impossible to apply an edit and keep the state of the program consistent with what would the code do if it was edited before the debugging started. For example, applying edits in lambda expressions that alter the structure of its closure such as lifting an existing local variable into the closure might require some state information that is already gone and impossible to retrieve.

Re comparison with JavaScript - I'd say JavaScript has an easier job since it's a dynamically typed language with a lot of flexibility built-in. In JavaScript the code itself can add/remove properties from objects etc. This makes it much easier to make changes while debugging.

FWIW, you can find the list of currently supported (and unsupported) edits https://github.com/dotnet/roslyn/wiki/EnC-Supported-Edits

@tmat tmat added this to the Unknown milestone Jun 19, 2018
@tmat
Copy link
Member

tmat commented Jun 19, 2018

Re the specific edits you mention:

  • every time I change a lambada expression make me compile again.

This depends on what change is made exactly and what variables the lambda expression captures. If you can share the snippet of code and the exact error message I can check if the error is expected.

  • every time I add the namespace make me compile again.

Tracked by issue #10043

  • every time I change something in a variable (that has a breakpoint and currently pointer) make me compile

Can you share the code, the edit you are trying to make and the error message?

@ghost
Copy link
Author

ghost commented Jun 19, 2018

@tmat I was using dynamic object Deserialization, for example, https://stackoverflow.com/a/9038318/713789

I deserialize my json from string to a dynamic object. (I was meaning dynamic variable in my post).
Now after doing anything I need to come to there again and follow same thing again and again.

write the code/ debug, change the code, debug > change > debug again > change again > debug again.

If I consume same API in Javascript using chrome dev tool, I never need to stop my debugging sesison. when you modified the file, it's just go to outer part (which is good, because I just modified and debug that part, instead of stop and restart from scratch).

the chrome dev tool make the thing a lot easier for me (but I want to make API reqeust in server side c#).
If debugging experience can be simpler and similar to Chrome Dev Tool, It would make much benefit for developer.

@tmat
Copy link
Member

tmat commented Jun 19, 2018

@anirugu To be able to help, I'd need to see the source code of the method, where in the method was the program stopped and what change did you try to make.

@ghost
Copy link
Author

ghost commented Jul 31, 2018

I just mention this issue in a new issue I started today, I can't post any code here. what I was doing is consuming an API and done changed a lot during writing the code.

  1. if you modify the same line where your VS execution pointing, debugging not continue.
  2. just add the namespace for regex or something else, you can't continue, I mention an idea for sort out this, if namespace can be easily imported in the immediate window, it would be helpful for the developer to work effectively.

I write the same code in Javascript too in April (when I post this is dev community) and don't need to do anything, I was using jquery and consume the whole api and when I make change, debugging goes one block up and it's look good, I started from there again and able to test and debug the code that I write few second ago, this way I completely write my javascript code even without stopping at anything.

This is the experience I am talking about, a similar thing can be analyzed and better-debugging functionality can be provided in the future version of VS 2019.

@ghost
Copy link
Author

ghost commented Aug 3, 2018

image

@GSPP
Copy link

GSPP commented Jan 28, 2019

I personally notice as well that EnC is not possible in too many scenarios. EnC is extremely useful.

One particular issue that I hit very often is changes to the variables that a lambda captures.

@tmat
Copy link
Member

tmat commented Jan 24, 2022

@tmat tmat closed this as completed Jan 24, 2022
@tmat tmat added the Resolution-Duplicate The described behavior is tracked in another issue label Jan 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Interactive Interactive-EnC Resolution-Duplicate The described behavior is tracked in another issue Story
Projects
None yet
Development

No branches or pull requests

3 participants