Fix some processes missing from "Attach to Process (Unity)" #242
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
When using "Debug -> Attach to Process (Unity)...", my Unity process is not shown. Here's a screenshot:
Root cause
It seems that my Unity player data string has a slightly different format than dnSpy expects which causes its regex to fail on it.
In the debugger, I can see that my Unity process's player data string is:
TryParseUnityPlayerData
bails here because the value it parsed formachine
doesn't matchDns.GetHostName()
:machine: "2,Rigderns-PC"
Dns.GetHostName(): "Rigderns-PC"
Solution
I updated the regex to account for the possibility of a number and comma preceding the machine name. I verified "machine" is parsed properly regardless of whether it is preceded by a number. Examples:
WindowsPlayer(2,Rigderns-PC)
, "machine" is parsed asRigderns-PC
WindowsPlayer(Rigderns-PC)
, "machine" is parsed asRigderns-PC
(If there's test infrastructure in place, let me know and I can add some tests for this.)
I also verified that my Unity process is now listed in the "Attach to Process (Unity)" window.