Fix some processes missing from "Attach to Process (Unity)"#242
Merged
ElektroKill merged 1 commit intodnSpyEx:masterfrom Sep 13, 2023
Merged
Conversation
I added an optional non-capturing group to take care of the number & comma that comes before the machine name on my machine.
Member
|
Hi, Thanks for the contribution! Were you perhaps able to figure out why your version of the Unity player had the additional number in the data string and what is the purpose of this additional number? Other than that, LGTM! |
Author
|
No, unfortunately I couldn't find any official documentation about the Unity player data string format. These are the mentions of the player data string that I found but none of them give insights on the meaning on that part of it:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
TryParseUnityPlayerDatabails here because the value it parsed formachinedoesn'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-PCWindowsPlayer(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.