Registry Mirror
Skip to content

Conversation

@christophwille

Copy link
Copy Markdown
Member

Fixes #4246.

Root cause

The regression is not in the handling of the dash. The query parser in RunningSearch.ParseInput added the value of every prefix to the keyword list, including the scope prefixes inassembly: and innamespace:. Every keyword has to be contained in an entity's (short) name for AbstractSearchStrategy.IsMatch to accept it, so inassembly:Assembly-CSharp Chip produced the keywords Assembly-CSharp and Chip, and no type or member name in the game assembly contains Assembly-CSharp.

inassembly:UnityEngine only appeared to work: the stray keyword equals the namespace of the Unity types, so whenever another term carried a dot (which switches on full-name matching) the full names UnityEngine.X.Y contained it by coincidence. Game code in Assembly-CSharp lives in the global namespace, so the stray keyword could never match. Any assembly whose name is not a prefix of its namespaces was affected, which is why the reporter saw it in "a lot of games".

How the root cause was found

  1. Read the issue and located the inassembly handling: RunningSearch.ParseInput (parser) and AbstractEntitySearchStrategy.IsInNamespaceOrAssembly (filter). The filter is a plain Contains on the file name / full assembly name, so a dash cannot break it.
  2. Noticed the parser comment "Term goes into keywords/regex regardless of prefix" and traced the keyword into AbstractSearchStrategy.PrepareTerms / IsMatch: every keyword is a mandatory Contains against the entity name.
  3. Compared with the WPF parser from the v10.1.1 tag (ILSpy/Search/SearchPane.xaml.cs): it only added the term as a keyword (and only touched FullNameSearch / OmitGenerics) when prefix == null || prefix.Length <= 2, so scope prefixes were filters only. git log -S showed this was lost in 99a956c ("Search-prefix DSL"), which also pinned the new behaviour in SearchPrefixParsingTests.
  4. Confirmed with the reporter's assemblies via ilspycmd -l: none of the 116 types in Assembly-CSharp.dll and none of the 444 types in UnityEngine.CoreModule.dll has the assembly name in its short name.
  5. Ran ILSpy 10.1.1 and the current build against the game's Managed folder:
    • inassembly:Assembly-CSharp Chip: results in v10, empty in v11.
    • A lone inassembly:Assembly-CSharp: empty in both versions, because no keyword means no search strategy (GetSearchStrategy / GetStrategy return null). The reporter's "works on 10" therefore refers to the scope filter combined with a typed term, typically via the "Scope search to this assembly" context menu.

Change

Scope prefixes now set their filter and skip the keyword list and the full-name / generics heuristics, restoring the v10 contract. The two parser tests that pinned the leak were corrected, and three regression tests were added: the exact inassembly:Assembly-CSharp Chip shape, a lone scope prefix yielding zero keywords, and an end-to-end headless search for inassembly:System.Private.CoreLib =String whose results must all come from the core library. All were red before the fix and green after.

Side observation, not addressed here: the --search command-line argument is still a no-op at startup in the Avalonia build (AssemblyTreeModel.HandleCommandLineArgumentsAsync).

Assisted-by: Claude:claude-fable-5-1:Claude Code

🤖 Generated with Claude Code

The value of inassembly:/innamespace: was added to the keyword list, so
every entity name had to contain the assembly name to match. It only
appeared to work for assemblies whose name is a prefix of their
namespaces (UnityEngine); Unity game code in Assembly-CSharp lives in
the global namespace and found nothing. The WPF parser treated scope
prefixes as filters only, which this restores, including not letting a
dotted scope value switch on full-name matching.

Assisted-by: Claude:claude-fable-5-1:Claude Code
@siegfriedpammer
siegfriedpammer merged commit 700e2ff into master Oct 16, 2026
15 checks passed
@siegfriedpammer
siegfriedpammer deleted the fix/4246-inassembly-keyword-leak branch October 16, 2026 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression: inassembly search filter not working for some Unity assemblies

2 participants