Skip to content

Conversation

@MarkCiliaVincenti
Copy link

No description provided.

@gemini-code-assist
Copy link

Summary of Changes

Hello @MarkCiliaVincenti, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on modernizing the project's synchronization primitives by adopting System.Threading.Lock for improved performance and consistency with newer .NET versions. It introduces multi-targeting for .NET 9.0 while maintaining full compatibility with existing frameworks through a clever conditional implementation of the locking mechanism. This change enhances the robustness and future-proofing of the codebase.

Highlights

  • Updated Locking Mechanism: The synchronization object in GenericFontProvider has been upgraded from a generic System.Object to the more modern System.Threading.Lock.
  • Added .NET 9.0 Target Framework: The project now officially targets .NET 9.0, expanding its compatibility and allowing it to leverage newer platform features.
  • Conditional Locking Implementation: To ensure backward compatibility, the project uses System.Threading.Lock for .NET 9.0+ and Backport.System.Threading.Lock for older target frameworks (net462, netstandard2.0), managed through conditional MSBuild Using aliases.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@what-the-diff
Copy link

what-the-diff bot commented Dec 30, 2025

PR Summary

  • Improvements to the GenericFontProvider.cs File:

    • The threading model has been made safer by updating the type of _syncLock from an Object to a special Lock object created via LockFactory.Create().
  • Updates to the PdfRpt.Core.csproj File:

    • The targeted frameworks for the project now include .NET 9.0.
    • We've updated the language version being used to the latest.
    • A new package named Backport.System.Threading.Lock has been introduced to support the new locking features.
    • To ensure compatibility with .NET 9.0 the project's package references have been updated in various sections.
    • The old package references have been kept for older target frameworks, but conditional statements have been introduced to manage .NET 9.0 specifics.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request aims to use System.Threading.Lock on .NET 9+ by introducing the Backport.System.Threading.Lock package. While the intention to modernize the locking mechanism is good, the current implementation has a critical issue. System.Threading.Lock is a ref struct in .NET 9 and cannot be used for a static field, which will cause a compilation failure for the net9.0 target. I've provided a comment with details on how to fix this. Additionally, I've found a duplicated section in the .csproj file and suggested a way to combine them for better maintainability. I've also suggested removing the new package dependency if the locking change is reverted.

Comment on lines +33 to +41
<ItemGroup>
<PackageReference Include="Backport.System.Threading.Lock" Version="3.1.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>analyzers</IncludeAssets>
</PackageReference>
<Using Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net9.0'))" Alias="Lock" Include="System.Threading.Lock" />
<Using Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net9.0'))" Alias="Lock" Include="Backport.System.Threading.Lock" />
<Using Alias="LockFactory" Include="Backport.System.Threading.LockFactory" />
</ItemGroup>

Choose a reason for hiding this comment

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

medium

In light of the issue with using System.Threading.Lock as a static field, you might reconsider using the Backport.System.Threading.Lock package in this project. If you revert the changes in GenericFontProvider.cs to use object for locking, this entire ItemGroup is no longer necessary and can be removed to simplify the project file.

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.

1 participant