Skip to content

fix: skip unresolvable assemblies during plugin discovery scan - #45

Merged
art0007i merged 2 commits into
masterfrom
hazre/fix/plugin-scan-unresolvable-refs
Sep 15, 2026
Merged

art0007i merged 2 commits into
masterfrom
hazre/fix/plugin-scan-unresolvable-refs

Conversation

@hazre

@hazre hazre commented Sep 13, 2026

Copy link
Copy Markdown
Member

This fixes the good old System.IO.Ports error from way back, which was nothing but a false positive because the walker, well walked too much.

for example:

[Debug  :   BepInEx] Examining 'C:\Users\haz\AppData\Roaming\com.kesomannen.gale\resonite\profiles\Default\BepInEx\plugins\Nytra-InterprocessLib\InterprocessLib.BepisLoader\InterprocessLib.FrooxEngine.dll'
[Error  :   BepInEx] Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'System.IO.Ports, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
   at Mono.Cecil.BaseAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
   at Mono.Cecil.BaseAssemblyResolver.Resolve(AssemblyNameReference name)
   at Mono.Cecil.DefaultAssemblyResolver.Resolve(AssemblyNameReference name)
   at BepInEx.Bootstrap.BaseChainloader`1.ReferencesThisAssembly(AssemblyDefinition ass, HashSet`1 seen) in C:\Users\haz\dev\BepInEx\BepInEx.Core\Bootstrap\BaseChainloader.cs:line 104
   at BepInEx.Bootstrap.BaseChainloader`1.ReferencesThisAssembly(AssemblyDefinition ass, HashSet`1 seen) in C:\Users\haz\dev\BepInEx\BepInEx.Core\Bootstrap\BaseChainloader.cs:line 105
   at BepInEx.Bootstrap.BaseChainloader`1.ReferencesThisAssembly(AssemblyDefinition ass, HashSet`1 seen) in C:\Users\haz\dev\BepInEx\BepInEx.Core\Bootstrap\BaseChainloader.cs:line 105
   at BepInEx.Bootstrap.BaseChainloader`1.ReferencesThisAssembly(AssemblyDefinition ass, HashSet`1 seen) in C:\Users\haz\dev\BepInEx\BepInEx.Core\Bootstrap\BaseChainloader.cs:line 105
   at BepInEx.Bootstrap.BaseChainloader`1.HasBepinPlugins(AssemblyDefinition ass) in C:\Users\haz\dev\BepInEx\BepInEx.Core\Bootstrap\BaseChainloader.cs:line 112
   at BepInEx.Bootstrap.TypeLoader.FindPluginTypes[T](String directory, Func`3 typeSelector, Func`2 assemblyFilter, String cacheName) in C:\Users\haz\dev\BepInEx\BepInEx.Core\Bootstrap\TypeLoader.cs:line 158

ReferencesThisAssembly walked transitive references with an unguarded
Cecil Resolve, so a single missing framework facade (e.g. System.IO.Ports
pulled in via MimeDetective -> System 4.0) failed discovery of the whole
DLL with AssemblyResolutionException and skipped cache write. Treat
unresolvable branches as not referencing this assembly, matching
ToPluginInfo which already catches AssemblyResolutionException.

Signed-off-by: hazre <mail@haz.re>
@hazre
hazre requested a review from art0007i September 13, 2026 23:04
@github-actions

github-actions Bot commented Sep 13, 2026

Copy link
Copy Markdown

Download the artifacts for this pull request:

@art0007i

Copy link
Copy Markdown

should still print a basic debug log ? like failed to load assembly System.IO.Ports

@hazre

hazre commented Sep 14, 2026

Copy link
Copy Markdown
Member Author

The thing is it's not supposed to load it in the first place. it's a transitive dependency that's not even used by Resonite or Bepis. it's something for legacy stuff. the problem is Cecil Resolve goes way down the dependency graph, where it has nothing to do there. I don't mind logging something but it's not "failing"

@art0007i

Copy link
Copy Markdown

ok, then the message does not need to mention failing at all. I think it's good to log it still, just make it debug log level

Signed-off-by: hazre <mail@haz.re>
@hazre

hazre commented Sep 15, 2026

Copy link
Copy Markdown
Member Author

is this good?

@art0007i art0007i left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep it's good!

@art0007i
art0007i merged commit 324978b into master Sep 15, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants