-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Block debugger attach after any ApplyUpdate changes #50200
Conversation
Tagging subscribers to this area: @tommcdon Issue DetailsDebugActiveProcess now fails if any metadata updates have been applied with the ApplyUpdate API. Add better error message for ApplyUpdate while debugging.
|
src/libraries/System.Private.CoreLib/src/Resources/Strings.resx
Outdated
Show resolved
Hide resolved
cc @lambdageek |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the error message someone will get if they try to attach after an edit?
The debugger API returns CORDBG_E_DEBUGGING_NOT_POSSIBLE HRESULT when there have been updates. It is the closest error I could come up with. VS displays the following message as a result: "Unable to attach to the process. Debugging is not possible due to an incompatibility within the CLR implementation" |
Should we define a new HRESULT for this so that VS can give better error message in this situation? |
Thanks. What would it take to do better (after this PR) such that the error message is more descriptive about the particular case? Introduce a new error code and teach VS what to say in response? |
(Jan beat me to my question by 45 seconds apparently :-) |
The problem with a new HRESULT is that VS will display something very generic until they do another release. |
Like "Unable to attach. Unknown error: 0x8xxxxxxxx" I'm assuming. |
I think that's ok. Ideally we could get the error=>string mapping into a near-term 16.xx release, but even if we couldn't, I'd rather have a better experience here for the longer term. After all, one of the primary purposes of having this block in place is to provide a better user experience that's explanatory of the situation than what would happen if you could successfully attach but find yourself unable to meaningfully debug and not know why. And if it is "Unable to attach. Unknown error: 0x8xxxxxxxx", worst case that 0x8xxxxxxxx becomes searchable and we can ensure the right information is exposed in docs about what that message means. |
How about:
The resulting VS message is: "Unable to attach to the process. Operation not supported. Unknown error: 0x80131c69" |
@@ -383,6 +383,7 @@ | |||
#define CORDBG_E_DATA_TARGET_ERROR EMAKEHR(0x1c61) | |||
#define CORDBG_E_NO_IMAGE_AVAILABLE EMAKEHR(0x1c64) | |||
#define CORDBG_E_UNSUPPORTED_DELEGATE EMAKEHR(0x1c68) | |||
#define CORDBG_E_ASSEMBLY_UPDATES_APPLIED EMAKEHR(0x1c69) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please also add it to src\coreclr\inc\corerror.xml ?
I think I need help with the message. I was trying to keep the error and text not specific to attach just in case we need to use it in some other case.
```
<HRESULT NumericValue="0x80131c69">
<SymbolicName>CORDBG_E_ASSEMBLY_UPDATES_APPLIED</SymbolicName>
<Message>"The operation is not supported because assembly updates have been applied."</Message>
<Comment>The operation is not supported because assembly updates have been applied.</Comment>
</HRESULT>
```
|
LGTM, thanks. Then we'll just need to get a dedicated, descriptive message added into VS for this new error code for when someone's able to use that newer version. |
Hello @mikem8361! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
DebugActiveProcess now fails if any metadata updates have been applied with the ApplyUpdate API.
Add better error message for ApplyUpdate while debugging.