Skip to content

dotnet 10 upgrade#34

Merged
prabhu merged 5 commits intomainfrom
feature/net10
Nov 12, 2025
Merged

dotnet 10 upgrade#34
prabhu merged 5 commits intomainfrom
feature/net10

Conversation

@prabhu
Copy link
Member

@prabhu prabhu commented Nov 12, 2025

Upgrade to .net 10. Refactor to use latest C# features. Reviewed with Gemini 2.5 Pro.

Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
@prabhu prabhu requested a review from timmyteo November 12, 2025 17:15
Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
Copy link
Collaborator

@timmyteo timmyteo left a comment

Choose a reason for hiding this comment

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

Looking good @prabhu! I have not dabbled in dotnet 10 yet but the new features are looking interesting. Thanks for working on this.

Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
@prabhu
Copy link
Member Author

prabhu commented Nov 12, 2025

Getting one warning for dosai, which apparently is expected for such a DLL.

dotnet run --project ./Dosai/ methods --path $(pwd) --o $(pwd)/dosai.json                                                                                                                
Warning: Skipping assembly /Users/prabhu/work/owasp/dosai/Dosai.Tests/bin/Debug/net10.0/Microsoft.TestPlatform.CommunicationUtilities.dll as it could not be fully loaded for inspection.
  - Reason: TypeLoadException: Could not load type 'System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute' from assembly 'Microsoft.TestPlatform.CoreUtilities, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

dosai.tar.gz

@prabhu prabhu merged commit b99a4ce into main Nov 12, 2025
1 check passed
@prabhu prabhu deleted the feature/net10 branch November 12, 2025 19:51
/// <summary>
/// An enhanced AssemblyLoadContext that resolves dependencies from a list of specified search paths.
/// </summary>
internal class InspectionAssemblyLoadContext(IEnumerable<string> searchPaths) : AssemblyLoadContext(isCollectible: true)
Copy link
Member Author

Choose a reason for hiding this comment

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

This way, we can support multiple .NET versions, including shared runtime.

public List<string> GetNames()
{
return new List<string> { "Alice", "Bob" };
return ["Alice", "Bob"];
Copy link
Member Author

Choose a reason for hiding this comment

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

An example refactor.

var actualMethods = methodsSlice?.Methods;

Assert.Equal(32, actualMethods?.Count);
Assert.Equal(36, actualMethods?.Count);
Copy link
Member Author

Choose a reason for hiding this comment

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

More methods are collected now.

var failedAssemblies = new List<string>();
foreach(var assemblyFilePath in assembliesToInspect)
var processedAssemblyIdentities = new HashSet<string>();
var sharedRuntimePaths = GetDotnetSharedRuntimePaths();
Copy link
Member Author

Choose a reason for hiding this comment

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

We look for .dll files in more places, such as shared runtime paths.


return assemblyMethods;

Method CreateMethodObjectFromMember(
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a cool refactoring suggested by Gemini.

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