Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BinSkim .NET Updates to version 9 #1024

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

AllDwarf
Copy link
Collaborator

[WIP] BinSkim .NET Updates to version 9

Overview

This pull request focuses on updating the BinSkim project to incorporate the latest .NET updates. The goal is to ensure compatibility with the newest .NET features and improve overall performance and security.

Changes

Updated the project to target the latest .NET version.

Benefits

Enhanced Compatibility: Ensures that the BinSkim project is compatible with the latest .NET version, taking advantage of new features and improvements.

Testing

Verified that the project builds successfully with the latest .NET version.
Ran all existing tests to ensure no regressions were introduced.
Conducted manual testing to confirm that the functionality remains intact.
Additional Notes
If you encounter any issues or have questions about these updates, please feel free to reach out.

@AllDwarf AllDwarf changed the title BinSkim .NET Updates to version 9 [WIP] BinSkim .NET Updates to version 9 Dec 19, 2024
@AllDwarf AllDwarf force-pushed the users/marekaldorf/BinSkim_dotnet_updates branch from 3d1696b to 990a79d Compare January 9, 2025 15:45
@AllDwarf AllDwarf force-pushed the users/marekaldorf/BinSkim_dotnet_updates branch 2 times, most recently from 8c0ae1d to c90c64e Compare January 21, 2025 10:43
@AllDwarf AllDwarf changed the title [WIP] BinSkim .NET Updates to version 9 BinSkim .NET Updates to version 9 Jan 21, 2025
@AllDwarf AllDwarf marked this pull request as ready for review January 21, 2025 10:46
@AllDwarf AllDwarf requested a review from a team as a code owner January 21, 2025 10:46
Comment on lines +132 to +135
catch (Exception ex)
{
throw new InvalidOperationException("Failed to read string from memory.", ex);
}

Check notice

Code scanning / CodeQL

Generic catch clause Note

Generic catch clause.
@AllDwarf AllDwarf force-pushed the users/marekaldorf/BinSkim_dotnet_updates branch from c72a5f2 to 0884878 Compare January 21, 2025 20:00
@AllDwarf AllDwarf added this to the Release v4.3.2 milestone Jan 24, 2025
BuildAndTest.cmd Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@mkacmar mkacmar left a comment

Choose a reason for hiding this comment

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

There are some configs under .vscode/ you want to change too.

global.json Outdated Show resolved Hide resolved
@@ -121,13 +121,18 @@ public ulong ReadLength(out bool is64bit)
/// <summary>
/// Reads the string from the current position in the stream.
/// </summary>
[HandleProcessCorruptedStateExceptions]
Copy link
Collaborator

Choose a reason for hiding this comment

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

I may be reading the docs wrong, but with HandleProcessCorruptedStateExceptions being removed - are you still trying to catch CSEs with the try-catch block?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

well I went over the docs, and as of now the only option seems to be try catch, so I did it with the generic try catch clause. But I'm more than open to the suggestions for improvements :)

src/Test.UnitTests.BinaryParsers/PEBinary/PEBinaryTests.cs Outdated Show resolved Hide resolved
src/Test.ConcurrencyTests/rewriteUnitTests.ps1 Outdated Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nitpick: It seems there's a mix of major, minor and patch updates - I assume not all of them are strictly .NET update related (I'd be surprised if some of these patch level updates would be). I think it's fine to update dependencies in general, but too many changes here make it a bit tricky to review these. Separate PR in a regular dependency update cycle would be great in the future.

README.md Outdated Show resolved Hide resolved
Enhance memory reading and COM object management with error handling and platform checks

Add static keyword to lambdas in AnalyzeCommandTests.cs

Modified lambda expressions in AnalyzeCommandTests.cs to be static.
This change ensures that the lambdas do not capture variables from
the enclosing scope, potentially improving performance and clarity.

Fixing version constant file

Refactor project to target .NET 9.0 and remove obsolete configurations

Update ADO build configuration to target .NET 9.0 and add .vscode to .gitignore

Update GitHub workflows to target .NET 9.0 and improve formatting steps

Update .gitignore and improve Build scripts for .NET 9.0 compatibility

Directory.Packages.props fixes

Fix formatting in VersionConstants.cs by removing unnecessary whitespace

Update ADO build configuration to allow all branches for PRs

Remove platform-specific exceptions in PDB handling for cross-platform support

Refactor platform-specific code and resource management

Removed `using System.Runtime.Versioning;` and `[SupportedOSPlatform("windows")]` from `MSDiaComWrapper.cs` and `Pdb.cs`. Replaced `Marshal.GetObjectForIUnknown` with `ResourceReleaser.GetObjectForIUnknown` in `MSDiaComWrapper.cs`. Removed `OperatingSystem.IsWindows()` checks in `Pdb.cs` and ensured `PlatformSpecificHelpers.ThrowIfNotOnWindows()` still enforces Windows-only execution in `Init` methods. Simplified codebase by removing redundant platform checks.
@AllDwarf AllDwarf force-pushed the users/marekaldorf/BinSkim_dotnet_updates branch from 53a1ae1 to 000e522 Compare February 5, 2025 14:13
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.

3 participants