locked
Is there a way to know if changes applied to code will be ok for edit and continue? RRS feed

  • Question

  • Hi,

    In debugger break mode, I make some code changes programmatically and I need to add some expressions to the Watch window. If my changes are not legal for edit and continue, then adding to Watch window will result with ugly messagebox. This messagebox is asking to edit the code or stop debugging. Is there a way to query VS if changes made to the code are ok for edit and continue? So that I will not add anything to Watch window if the code is illegal?

    Or eventually, can I register to some debugging event or something which would allow me to detect illegal EnC attempt, cancel the messagebox and revert my changes to Watch window?

    Regards

    Thursday, August 14, 2014 11:12 AM

All replies

  • Hi Przemyslaw.Wlodarczak,

    As far as know, if it is not a syntactic error, it can't be detected before build.

    >>or something which would allow me to detect illegal EnC attempt

    Please explain the "EnC attempt".

    Best regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, August 18, 2014 2:57 AM
  • Hi Anna,

    As "EnC attempt" I understand every action which results with code being rebuild, checked and eventually applied by Edit and Continue engine. As "illegal Edit and Continue attempt" I understand such action triggered when code is not compiling or has changes which will be rejected by the Edit and Continue engine. I don't know how do you name such situation internally in MS :)

    In my particular scenario it is adding some expression to the Watch window (programmatically) or in rare situations setting the next statement (also programmatically). Both actions result in VS trying to apply changes to the code and both can fail with message box if Edit and Continue engine rejects changed code. I want to avoid such message box.

    I would be happy with any of below possibilities:

    • detect that code will trigger issues for Edit and Continue engine before adding new expression to watch window - from your above post it looks like impossible to do in general case
    • put Edit and Continue engine temporary into "no GUI" mode, so that message box with error is not shown when I add my expression to the Watch window and engine fails to apply changes.
    • interact with Edit and Continue engine somehow, so that when I add my expression to the Watch window and engine fails to apply changes, I can detect this, tell VS to not show the message box with error and revert my changes (e.g. remove my added expression from the Watch window)
    • after adding my expression to the watch window - detect that Edit and Continue engine failed to apply changes and showed message box with error, close this messagebox programmatically and revert my changes - not ideal solution because OS plays some sound when message box appears, but at least this should be doable

    Regards, Przemyslaw

    Monday, August 18, 2014 8:24 PM
  • Hi Anna, any news on this?
    Friday, August 29, 2014 10:37 AM