Skip to content

fix: resolve .NET 8 SDK transitive dependencies from deps.json files#170

Open
alafleur-genetec wants to merge 2 commits intomainfrom
fix/net8-sdk-resolver-deps-json
Open

fix: resolve .NET 8 SDK transitive dependencies from deps.json files#170
alafleur-genetec wants to merge 2 commits intomainfrom
fix/net8-sdk-resolver-deps-json

Conversation

@alafleur-genetec
Copy link
Member

The SdkResolver previously only used Genetec.Sdk.deps.json to resolve dependencies. Assemblies required by transitive dependencies (e.g., Genetec.Platform.Security) that were not listed in Genetec.Sdk.deps.json and not physically present in the SDK installation folder could not be found, causing authentication failures (ConnectionEstablished → Failed).

The resolver now parses all .deps.json files in the SDK folder and builds an index that maps assembly names to file paths, checking the SDK folder first and falling back to the local NuGet package cache.

The SdkResolver previously only used Genetec.Sdk.deps.json to resolve
dependencies. Assemblies required by transitive dependencies (e.g.,
Genetec.Platform.Security) that were not listed in Genetec.Sdk.deps.json
and not physically present in the SDK installation folder could not be
found, causing authentication failures (ConnectionEstablished → Failed).

The resolver now parses all .deps.json files in the SDK folder and builds
an index that maps assembly names to file paths, checking the SDK folder
first and falling back to the local NuGet package cache.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the .NET 8 sample SDK resolver to resolve assemblies required by transitive dependencies by parsing all .deps.json files in the SDK folder and mapping referenced runtime assemblies to either the SDK folder or the local NuGet cache.

Changes:

  • Replace AssemblyDependencyResolver usage with a .deps.json-driven assembly path index.
  • Parse all *.deps.json files in the SDK probing folder to build a name → path map, with fallback to the user NuGet global-packages cache.
  • Use the index as the first strategy during AssemblyLoadContext.Default.Resolving.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Remove unused System.Runtime.InteropServices import
- Reject rooted paths from deps.json to prevent path traversal
- Use NUGET_PACKAGES env var before falling back to default cache path
- Continue indexing SDK folder DLLs even when NuGet cache is missing
- Add null guard on s_packageAssemblyPaths in LoadAssembly
- Catch specific exceptions (BadImageFormatException, JsonException, IOException)
- Process all targets in deps.json instead of only the first
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants