- 
                Notifications
    
You must be signed in to change notification settings  - Fork 404
 
          🎉Add new NumberExtensionsCS14 nuget package
          #1620
        
          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
  
    🎉Add new NumberExtensionsCS14 nuget package
  
  #1620
              Conversation
| 
           @claude Review this PR. In addition to the standard prompt, also comment on what target frameworks we should use for the two projects.  | 
    
| 
           Claude encountered an error —— View job I'll analyze this and get back to you.  | 
    
| 
           @claude Review PR  | 
    
| 
           Claude encountered an error —— View job I'll analyze this and get back to you.  | 
    
| 
           Seems Claude doesn't work for PRs from forks due to security:  | 
    
        
          
                UnitsNet.NumberExtensions.CS14/UnitsNet.NumberExtensions.CS14.csproj
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                UnitsNet.NumberExtensions.CS14/UnitsNet.NumberExtensions.CS14.csproj
              
                Outdated
          
            Show resolved
            Hide resolved
        
      | 
           Local review by Claude: PR Review: Add C# 14 Extension Members SupportThank you for this contribution! The implementation of C# 14's extension members feature is well-structured and properly integrated into the code 🔴 Issues to Fix
 
 | 
    
NumberExtensionsCS14 nuget pakcageNumberExtensionsCS14 nuget package
      There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per Claude review:
-  Fix PackageId to 
UnitsNet.NumberExtensions.CS14 - Add documentation/README section explaining the new package
 -  Add example usage in documentation showing 
5.Meterssyntax - Fix typo in PR title
 - Confirm timeline - wait for C# 14 official release?
 
See inline comments above:
#1620 (review)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, build scripts must be updated to include new projects:
| var extensionsOutputDir = $"{rootDir}/UnitsNet.NumberExtensions/GeneratedCode"; | ||
| var extensionsTestOutputDir = $"{rootDir}/UnitsNet.NumberExtensions.Tests/GeneratedCode"; | ||
| var extensionsCs14OutputDir = $"{rootDir}/UnitsNet.NumberExtensions.CS14/GeneratedCode"; | ||
| var extensionsCs14TestOutputDir = $"{rootDir}/UnitsNet.NumberExtensions.CS14.Tests/GeneratedCode"; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CS14 projects are NOT included in the build-functions.psm1 file. This means:
Build Script Issues Found
The new CS14 projects are missing from the build pipeline:
- Not in test list (line 63-67): UnitsNet.NumberExtensions.CS14.Tests is not included in the Start-Tests function
 - Not in NuGet pack list (line 102-106): UnitsNet.NumberExtensions.CS14 is not included in the Start-PackNugets function
 
This means:
- ✅ The projects ARE in the solution file and will build with dotnet build
 - ❌ The tests won't run in CI/CD pipeline
 - ❌ The NuGet package won't be created in CI/CD pipeline
 
Here's the additional feedback to add to the PR review:
🔴 Build Pipeline Issue
The new CS14 projects are missing from the build pipeline configuration:
File: Build/build-functions.psm1
- Tests not running in CI - Add to line ~65:
 
$projectPaths = @(
    "UnitsNet.Tests\UnitsNet.Tests.csproj",
    "UnitsNet.NumberExtensions.Tests\UnitsNet.NumberExtensions.Tests.csproj",
    "UnitsNet.NumberExtensions.CS14.Tests\UnitsNet.NumberExtensions.CS14.Tests.csproj",  # ADD THIS
    "UnitsNet.Serialization.JsonNet.Tests\UnitsNet.Serialization.JsonNet.Tests.csproj"
)
2. NuGet package not created in CI - Add to line ~105:
$projectPaths = @(
    "UnitsNet\UnitsNet.csproj",
    "UnitsNet.Serialization.JsonNet\UnitsNet.Serialization.JsonNet.csproj",
    "UnitsNet.NumberExtensions\UnitsNet.NumberExtensions.csproj",
    "UnitsNet.NumberExtensions.CS14\UnitsNet.NumberExtensions.CS14.csproj"  # ADD THIS
)
Without these changes, the CS14 package won't be tested or published by the CI/CD pipeline.
This is a critical issue that would prevent the package from being properly tested and published.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could merge this earlier if we get the CI pipeline to build and run tests with .NET 10 SDK preview.
I pushed an attempt to fix this, let's see if the pipeline works now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Claude happily fixed these issues, so I pushed a fix for the build scripts also.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, thanks. I didn't check the Package Id, description and the build script. Sorry about that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries, that's what reviews are for 👍
- Add .NET 10 SDK preview installation to Azure Pipelines - Include CS14 projects in build, test, and pack scripts
- Fix ID conflict (now UnitsNet.NumberExtensions.CS14) - Update package title and description for clarity
- Document new UnitsNet.NumberExtensions.CS14 package - Show examples of C# 14 extension members syntax (no parentheses) - Compare with classic extension methods syntax - Note requirements for C# 14 preview and .NET 10 SDK
- Ensures consistent SDK version across development environments - Required for C# 14 extension members support - Allows prerelease versions with rollForward to latest feature
The .NET 10 preview SDK doesn't include the .NET 9 runtime, which is required to run the CodeGen project (targets net9.0). Install both .NET 9 and .NET 10 SDKs to ensure all runtimes are available.
The ILLink analyzer throws InvalidCastException with C# 14 extension members due to incompatibility with the preview syntax. Disable AOT until this is fixed. This resolves the CSC error AD0001 during compilation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> # Conflicts: # .claude/settings.local.json
The pipeline was missing .NET 8 SDK installation, causing test failures when trying to run net8.0 targeted tests. Added .NET 8 SDK installation to both azure-pipelines.yml and azure-pipelines-pr.yml. Error was: "You must install or update .NET to run this application" for the net8.0 test assemblies. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Changed global.json to require minimum .NET 9 SDK with rollForward to latestMajor, allowing it to use .NET 10 preview when available but fall back to .NET 9 on CI runners. Previous setting required exact version 10.0.0 which didn't match the installed 10.0.0-rc.1.x preview versions, causing build failures. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Configure global.json to allow both latest .NET 9 SDK and any .NET 10 preview SDKs: - Minimum version: 9.0.0 - allowPrerelease: true (allows .NET 10 previews/RCs) - rollForward: latestMajor (allows using newer major versions) This ensures the project uses .NET 10 preview when available for C# 14 support, but gracefully falls back to .NET 9 on systems without it. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
This reverts commit e7fd329.
| 
           Sorry for hijacking this, but Claude just went with it and decided to try and make it work with preview .NET10 SDK. Looks good in our PR and CI pipelines, so I'll merge this for now as it should no longer block anything.  | 
    
| 
           Nuget is out @ArchiDog1998 It's prerelease, as v6 currently is.  | 
    
| 
           Does it compile with   | 
    

Fixes #1619
Add new project
NumberExtensionsCS14to use the C#14 featureextension membersfor making5.Meterswork.Please merge after C#14 is officially released.