Skip to content

fix: cover analyzer package regressions across frameworks#1682

Merged
clairernovotny merged 14 commits intomainfrom
codex/fix-1681-package-regression
Mar 7, 2026
Merged

fix: cover analyzer package regressions across frameworks#1682
clairernovotny merged 14 commits intomainfrom
codex/fix-1681-package-regression

Conversation

@clairernovotny
Copy link
Copy Markdown
Member

@clairernovotny clairernovotny commented Mar 6, 2026

Summary

  • fix the analyzer fallback target so packaged consumers no longer fail when Roslyn component versioning is unavailable
  • move the test projects under a top-level tests/ directory and update the solution, docs, and CI references
  • simplify package verification so tests/verify-packages.ps1 directly restores/builds/runs checked-in sample consumer projects for console, Web API, Blazor, net48 analyzer loading, and a CI-only wapproj smoke check
  • keep both the SDK-style sample consumers and the Windows packaging project as checked-in fixtures under tests/fixtures, with the verifier copying them to temp and pointing a temporary NuGet.config at the freshly built package output

Testing

  • dotnet test --project tests/Humanizer.Analyzers.Tests/Humanizer.Analyzers.Tests.csproj --framework net10.0
  • dotnet test --project tests/Humanizer.Tests/Humanizer.Tests.csproj --framework net8.0
  • dotnet test --project tests/Humanizer.Tests/Humanizer.Tests.csproj --framework net10.0
  • dotnet build Humanizer/Humanizer.csproj -c Release /t:PackNuSpecs /p:PackageOutputPath=..\\artifacts\\packages-codex (from src)
  • ./tests/verify-packages.ps1 -PackageVersion 3.1.0-dev.16.g5c096e17be -PackagesDirectory E:\Dev\Humanizer\src\artifacts\packages-codex -IncludeWapProjSmokeTest

fixes #1681

Copilot AI review requested due to automatic review settings March 6, 2026 21:46
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 672acda915

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown
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

This PR addresses a packaging regression in the analyzer fallback targets (for environments without Roslyn component versioning), expands package smoke-test coverage across frameworks/scenarios, and reorganizes the test projects under a top-level tests/ directory with corresponding solution/CI/doc updates.

Changes:

  • Fix analyzer fallback selection logic in Humanizer.Core.targets to avoid MSBuild item-metadata conditions that break some consumers.
  • Move/refresh test infrastructure under tests/ (xUnit v3 + Microsoft Testing Platform runner), including many localisation test files.
  • Update solution, CI pipeline, and contributor/docs references to the new test layout and expanded smoke-test frameworks.

Reviewed changes

Copilot reviewed 15 out of 300 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/Humanizer.Tests/testconfig.json Adds test runner + coverage configuration for the moved test project.
tests/Humanizer.Tests/UseCultureAttribute.cs Introduces a culture-switching test attribute for localisation tests.
tests/Humanizer.Tests/TupleizeTests.cs Adds/moves tuple naming tests.
tests/Humanizer.Tests/TransformersTests.cs Adds/moves string transform tests.
tests/Humanizer.Tests/TimeUnitToSymbolTests.cs Adds/moves TimeUnit symbol tests.
tests/Humanizer.Tests/TimeOnlyHumanizeTests.cs Adds/moves TimeOnly humanization tests.
tests/Humanizer.Tests/StringDehumanizeTests.cs Adds/moves string dehumanize tests.
tests/Humanizer.Tests/RomanNumeralTests.cs Adds/moves roman numeral tests.
tests/Humanizer.Tests/ModuleInitializer.cs Initializes Verify settings for the test assembly.
tests/Humanizer.Tests/Localisation/zh-Hant/TimeSpanHumanizeTests.cs Adds/moves zh-Hant TimeSpan humanization tests.
tests/Humanizer.Tests/Localisation/zh-Hans/TimeSpanHumanizeTests.cs Adds/moves zh-Hans TimeSpan humanization tests.
tests/Humanizer.Tests/Localisation/zh-HK/TimeSpanHumanizeTests.cs Adds/moves zh-HK TimeSpan humanization tests.
tests/Humanizer.Tests/Localisation/zh-CN/TimeSpanHumanizeTests.cs Adds/moves zh-CN TimeSpan humanization tests.
tests/Humanizer.Tests/Localisation/zh-CN/NumberToWordsTests.cs Adds/moves zh-CN number-to-words tests.
tests/Humanizer.Tests/Localisation/tr/TimeSpanHumanizeTests.cs Adds/moves Turkish TimeSpan humanization tests.
tests/Humanizer.Tests/Localisation/tr/OrdinalizeTests.cs Adds/moves Turkish ordinalize tests.
tests/Humanizer.Tests/Localisation/th-TH/NumberToWordsTests.cs Adds/moves Thai number-to-words tests.
tests/Humanizer.Tests/Localisation/th-TH/DateHumanizeTests.cs Adds/moves Thai date humanization tests.
tests/Humanizer.Tests/Localisation/sv/TimeSpanHumanizeTests.cs Adds/moves Swedish TimeSpan humanization tests.
tests/Humanizer.Tests/Localisation/sv/CollectionFormatterTests.cs Adds/moves Swedish collection formatting tests.
tests/Humanizer.Tests/Localisation/sr/NumberToWordsTest.cs Adds/moves Serbian number-to-words tests.
tests/Humanizer.Tests/Localisation/sr-Latn/NumberToWordsTest.cs Adds/moves Serbian (Latin) number-to-words tests.
tests/Humanizer.Tests/Localisation/sl/NumberToWordsTests.cs Adds/moves Slovenian number-to-words tests.
tests/Humanizer.Tests/Localisation/ru-RU/TimeUnitToSymbolTests.cs Adds/moves Russian TimeUnit symbol tests.
tests/Humanizer.Tests/Localisation/ru-RU/Bytes/ToStringTests.cs Adds/moves Russian ByteSize formatting tests.
tests/Humanizer.Tests/Localisation/ru-RU/Bytes/ToFullWordsTests.cs Adds/moves Russian ByteSize word formatting tests.
tests/Humanizer.Tests/Localisation/ro-Ro/OrdinalizerTests.cs Adds/moves Romanian ordinalizer tests.
tests/Humanizer.Tests/Localisation/ro-Ro/CollectionFormatterTests.cs Adds/moves Romanian collection formatting tests.
tests/Humanizer.Tests/Localisation/pt/TimeUnitToSymbolTests.cs Adds/moves Portuguese TimeUnit symbol tests.
tests/Humanizer.Tests/Localisation/pt/TimeToClockNotationTests.cs Adds/moves Portuguese clock notation tests.
tests/Humanizer.Tests/Localisation/pt/TimeSpanHumanizeTests.cs Adds/moves Portuguese TimeSpan humanization tests.
tests/Humanizer.Tests/Localisation/pt-BR/TimeUnitToSymbolTests.cs Adds/moves Portuguese (BR) TimeUnit symbol tests.
tests/Humanizer.Tests/Localisation/pt-BR/TimeToClockNotationTests.cs Adds/moves Portuguese (BR) clock notation tests.
tests/Humanizer.Tests/Localisation/pt-BR/TimeSpanHumanizeTests.cs Adds/moves Portuguese (BR) TimeSpan humanization tests.
tests/Humanizer.Tests/Localisation/nl/TimeSpanHumanizeTests.cs Adds/moves Dutch TimeSpan humanization tests.
tests/Humanizer.Tests/Localisation/nl/OrdinalizeTests.cs Adds/moves Dutch ordinalize tests.
tests/Humanizer.Tests/Localisation/nb/TimeSpanHumanizeTests.cs Adds/moves Norwegian Bokmål TimeSpan humanization tests.
tests/Humanizer.Tests/Localisation/nb-NO/TimeSpanHumanizeTests.cs Adds/moves nb-NO TimeSpan humanization tests.
tests/Humanizer.Tests/Localisation/mt/TimeSpanHumanizeTests.cs Adds/moves Maltese TimeSpan humanization tests.
tests/Humanizer.Tests/Localisation/ms-MY/TimeSpanHumanizeTests.cs Adds/moves Malay (ms-MY) TimeSpan humanization tests.
tests/Humanizer.Tests/Localisation/lv/TimeSpanHumanizeTests.cs Adds/moves Latvian TimeSpan humanization tests.
tests/Humanizer.Tests/Localisation/lv/DateToOrdinalWordsTests.cs Adds/moves Latvian date-to-ordinal-words tests.
tests/Humanizer.Tests/Localisation/lt/DateToOrdinalWordsTests.cs Adds/moves Lithuanian date-to-ordinal-words tests.
tests/Humanizer.Tests/Localisation/lt/DateHumanizeTests.cs Adds/moves Lithuanian date humanization tests.
tests/Humanizer.Tests/Localisation/lb/TimeOnlyHumanizeTests.cs Adds/moves Luxembourgish TimeOnly tests.
tests/Humanizer.Tests/Localisation/lb/OrdinalizeTests.cs Adds/moves Luxembourgish ordinalize tests.
tests/Humanizer.Tests/Localisation/lb/DateToOrdinalWordsTests.cs Adds/moves Luxembourgish date-to-ordinal-words tests.
tests/Humanizer.Tests/Localisation/lb/CollectionFormatterTests.cs Adds/moves Luxembourgish collection formatting tests.
tests/Humanizer.Tests/Localisation/lb/Bytes/ToStringTests.cs Adds/moves Luxembourgish ByteSize formatting tests.
tests/Humanizer.Tests/Localisation/lb/Bytes/ToFullWordsTests.cs Adds/moves Luxembourgish ByteSize word formatting tests.
tests/Humanizer.Tests/Localisation/lb/Bytes/ByteRateTests.cs Adds/moves Luxembourgish byte rate humanization tests.
tests/Humanizer.Tests/Localisation/ku/TimeSpanHumanizeTests.cs Adds/moves Kurdish TimeSpan humanization tests.
tests/Humanizer.Tests/Localisation/ko-KR/TimeSpanHumanizeTests.cs Adds/moves Korean TimeSpan humanization tests.
tests/Humanizer.Tests/Localisation/ja/TimeSpanHumanizeTests.cs Adds/moves Japanese TimeSpan humanization tests.
tests/Humanizer.Tests/Localisation/it/OrdinalizerTests.cs Adds/moves Italian ordinalizer tests.
tests/Humanizer.Tests/Localisation/it/CollectionFormatterTests.cs Adds/moves Italian collection formatting tests.
tests/Humanizer.Tests/Localisation/is/TimeOnlyHumanizeTests.cs Adds/moves Icelandic TimeOnly tests.
tests/Humanizer.Tests/Localisation/is/ResourcesTests.cs Adds/moves Icelandic resources tests.
tests/Humanizer.Tests/Localisation/is/OrdinalizeTests.cs Adds/moves Icelandic ordinalize tests.
tests/Humanizer.Tests/Localisation/is/CollectionFormatterTests.cs Adds/moves Icelandic collection formatting tests.
tests/Humanizer.Tests/Localisation/is/Bytes/ToStringTests.cs Adds/moves Icelandic ByteSize formatting tests.
tests/Humanizer.Tests/Localisation/is/Bytes/ToFullWordsTests.cs Adds/moves Icelandic ByteSize word formatting tests.
tests/Humanizer.Tests/Localisation/is/Bytes/ByteSizeExtensionsTests.cs Adds/moves Icelandic ByteSize extensions tests.
tests/Humanizer.Tests/Localisation/invariant/NumberToWordsTests.cs Adds/moves invariant number-to-words tests.
tests/Humanizer.Tests/Localisation/id/TimeSpanHumanizeTests.cs Adds/moves Indonesian TimeSpan humanization tests.
tests/Humanizer.Tests/Localisation/hy/OrdinalizeTests.cs Adds/moves Armenian ordinalize tests.
tests/Humanizer.Tests/Localisation/hr/TimeSpanHumanizeTests.cs Adds/moves Croatian TimeSpan humanization tests.
tests/Humanizer.Tests/Localisation/he/TimeSpanHumanizeTests.cs Adds/moves Hebrew TimeSpan humanization tests.
tests/Humanizer.Tests/Localisation/fr/TimeUnitToSymbolTests.cs Adds/moves French TimeUnit symbol tests.
tests/Humanizer.Tests/Localisation/fr/TimeOnlyHumanizeTests.cs Adds/moves French TimeOnly tests.
tests/Humanizer.Tests/Localisation/fr/DateToOrdinalWordsTests.cs Adds/moves French date-to-ordinal-words tests.
tests/Humanizer.Tests/Localisation/fr/Bytes/ToStringTests.cs Adds/moves French ByteSize formatting tests.
tests/Humanizer.Tests/Localisation/fr/Bytes/ToFullWordsTests.cs Adds/moves French ByteSize word formatting tests.
tests/Humanizer.Tests/Localisation/fil-PH/TimeSpanHumanizeTests.cs Adds/moves Filipino TimeSpan humanization tests.
tests/Humanizer.Tests/Localisation/fi-FI/DateHumanizeTests.cs Adds/moves Finnish date humanization tests.
tests/Humanizer.Tests/Localisation/fa/TimeSpanHumanizeTests.cs Adds/moves Persian TimeSpan humanization tests.
tests/Humanizer.Tests/Localisation/fa/DateHumanizeTests.cs Adds/moves Persian date humanization tests.
tests/Humanizer.Tests/Localisation/es/NumberToWordsFeminineTest.cs Adds/moves Spanish feminine number-to-words tests.
tests/Humanizer.Tests/Localisation/es/DateToOrdinalWordsTests.cs Adds/moves Spanish date-to-ordinal-words tests.
tests/Humanizer.Tests/Localisation/es/DateHumanizeTests.cs Adds/moves Spanish date humanization tests.
tests/Humanizer.Tests/Localisation/en/TimeToClockNotationTests.cs Adds/moves English clock notation tests.
tests/Humanizer.Tests/Localisation/en/DateToOrdinalWordsTests.cs Adds/moves English date-to-ordinal-words tests.
tests/Humanizer.Tests/Localisation/en-IN/NumberToWordsTests.cs Adds/moves en-IN number-to-words tests.
tests/Humanizer.Tests/Localisation/el/TimeSpanHumanizeTests.cs Adds/moves Greek TimeSpan humanization tests.
tests/Humanizer.Tests/Localisation/el/NumberToWordsTests.cs Adds/moves Greek number-to-words tests.
tests/Humanizer.Tests/Localisation/el/NumberToOrdinalWordsTests.cs Adds/moves Greek ordinal-words tests.
tests/Humanizer.Tests/Localisation/de/TimeUnitToSymbolTests.cs Adds/moves German TimeUnit symbol tests.
tests/Humanizer.Tests/Localisation/de/TimeToClockNotationTests.cs Adds/moves German clock notation tests.
tests/Humanizer.Tests/Localisation/de/OrdinalizeTests.cs Adds/moves German ordinalize tests.
tests/Humanizer.Tests/Localisation/de/DateToOrdinalWordsTests.cs Adds/moves German date-to-ordinal-words tests.
tests/Humanizer.Tests/Localisation/de/DateHumanizeTests.cs Adds/moves German date humanization tests.
tests/Humanizer.Tests/Localisation/de/CollectionFormatterTests.cs Adds/moves German collection formatting tests.
tests/Humanizer.Tests/Localisation/de/Bytes/ToStringTests.cs Adds/moves German ByteSize formatting tests.
tests/Humanizer.Tests/Localisation/de/Bytes/ToFullWordsTests.cs Adds/moves German ByteSize word formatting tests.
tests/Humanizer.Tests/Localisation/de/Bytes/ByteSizeExtensionsTests.cs Adds/moves German ByteSize extensions tests.
tests/Humanizer.Tests/Localisation/de/Bytes/ByteRateTests.cs Adds/moves German byte rate humanization tests.
tests/Humanizer.Tests/Localisation/da/TimeSpanHumanizeTests.cs Adds/moves Danish TimeSpan humanization tests.
tests/Humanizer.Tests/Localisation/ca/NumberToWordsFeminineTest.cs Adds/moves Catalan feminine number-to-words tests.
tests/Humanizer.Tests/Localisation/ca/DateToOrdinalWordsTests.cs Adds/moves Catalan date-to-ordinal-words tests.
tests/Humanizer.Tests/Localisation/bn-BD/TimeSpanHumanizeTests.cs Adds/moves Bengali (BD) TimeSpan humanization tests.
tests/Humanizer.Tests/Localisation/bn-BD/DateHumanizeTests.cs Adds/moves Bengali (BD) date humanization tests.
tests/Humanizer.Tests/Localisation/ar/TimeSpanHumanizeTests.cs Adds/moves Arabic TimeSpan humanization tests.
tests/Humanizer.Tests/Localisation/af/TimeSpanHumanizeTests.cs Adds/moves Afrikaans TimeSpan humanization tests.
tests/Humanizer.Tests/Localisation/ResourcesTests.cs Adds/moves localisation resource lookup tests.
tests/Humanizer.Tests/Localisation/DefaultFormatterTests.cs Adds/moves default formatter behaviour tests.
tests/Humanizer.Tests/Humanizer.Tests.csproj Updates test project references for new folder layout.
tests/Humanizer.Tests/GlobalUsings.cs Adds global usings for tests.
tests/Humanizer.Tests/FluentDate/PrepositionTests.cs Adds/moves FluentDate preposition tests.
tests/Humanizer.Tests/FluentDate/OnTests.cs Adds/moves FluentDate “On” tests.
tests/Humanizer.Tests/FluentDate/OnDateTests.cs Adds/moves FluentDate DateOnly “On” tests.
tests/Humanizer.Tests/FluentDate/InDateTests.cs Adds/moves FluentDate DateOnly “In” tests.
tests/Humanizer.Tests/EnumUnderTest.cs Adds/moves enums and attributes used by enum tests.
tests/Humanizer.Tests/DateTimeOffsetHumanizeTests.cs Adds/moves DateTimeOffset strategy tests.
tests/Humanizer.Tests/DateOnlyHumanizeTests.cs Adds/moves DateOnly strategy tests.
tests/Humanizer.Tests/DateHumanize.cs Adds/moves shared DateHumanize test helper.
tests/Humanizer.Tests/CasingTests.cs Adds/moves casing tests.
tests/Humanizer.Tests/Bytes/ToFullWordsTests.cs Adds/moves ByteSize ToFullWords tests.
tests/Humanizer.Tests/Bytes/CreatingTests.cs Adds/moves ByteSize creation tests.
tests/Humanizer.Tests/Bytes/ComparingTests.cs Adds/moves ByteSize comparison tests.
tests/Humanizer.Tests/Bytes/ByteRateTests.cs Adds/moves byte rate humanization tests.
tests/Humanizer.Tests/BitFieldEnumUnderTest.cs Adds/moves bit-field enums/resources used in tests.
tests/Humanizer.Tests/BitFieldEnumHumanizeTests.cs Adds/moves bit-field enum humanize tests.
tests/Humanizer.Tests/ArticlePrefixSortTests.cs Adds/moves article-prefix sort tests.
tests/Humanizer.Tests/ApiApprover/PublicApiApprovalTest.cs Adds/moves public API approval test under new layout.
tests/Humanizer.Tests/.editorconfig Adds test-project-specific analyzer configuration.
tests/Humanizer.Package.Tests/Humanizer.Package.Tests.csproj Introduces package smoke-test project.
tests/Humanizer.Analyzers.Tests/Verifiers.cs Adds/moves Roslyn test verifiers under new layout.
tests/Humanizer.Analyzers.Tests/Humanizer.Analyzers.Tests.csproj Updates analyzer test project references for new folder layout.
tests/Humanizer.Analyzers.Tests/AnalyzerAssemblyCompatibilityTests.cs Adds tests to detect analyzer assembly reference incompatibilities.
tests/Directory.Packages.props Imports central package versions from src/ for tests.
tests/Directory.Build.targets Imports build targets from src/ for tests.
tests/Directory.Build.props Imports build props from src/ for tests.
src/Humanizer.slnx Updates solution to reference moved test projects and new package test project.
src/Humanizer.Analyzers/build/Humanizer.Core.targets Fixes analyzer fallback target logic for non-versioned Roslyn environments.
src/Humanizer.Analyzers/README.md Updates analyzer testing instructions for moved test path.
azure-pipelines.yml Adds .NET 11 SDK and expands package verification smoke-test frameworks/scenarios; updates test project paths.
AGENTS.md Updates repo guidance to reflect tests now living under tests/.
.github/copilot-instructions.md Updates contributor guidance to reflect tests now living under tests/.
.github/CONTRIBUTING.md Updates documentation links to point at the new tests/ paths.

Copilot AI review requested due to automatic review settings March 6, 2026 22:51
Copy link
Copy Markdown
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

Copilot reviewed 15 out of 300 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings March 7, 2026 00:24
Copy link
Copy Markdown
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI review requested due to automatic review settings March 7, 2026 01:36
Copy link
Copy Markdown
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

Copilot reviewed 15 out of 317 changed files in this pull request and generated 3 comments.

Comment on lines +1 to +8
using Humanizer.Bytes;

namespace Humanizer.Bytes
{
public class StubFormatter
{
}
}
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

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

The using Humanizer.Bytes; is redundant because the file declares namespace Humanizer.Bytes and doesn’t reference any types that require that using. This commonly triggers CS8019 (“Unnecessary using directive”), which can break builds if warnings are treated as errors in the smoke-test projects; remove the using to keep the fixture warning-free.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in ffd9f56. The redundant using Humanizer.Bytes; was removed from the analyzer probe fixture so it stays warning-free under stricter builds.

Comment on lines +7 to +9
<Analyzer Remove="$(MSBuildThisFileDirectory)..\analyzers\dotnet\roslyn3.8\cs\Humanizer.Analyzers.dll" />
<Analyzer Remove="$(MSBuildThisFileDirectory)..\analyzers\dotnet\roslyn4.8\cs\Humanizer.Analyzers.dll" />
<Analyzer Remove="$(MSBuildThisFileDirectory)..\analyzers\dotnet\roslyn4.14\cs\Humanizer.Analyzers.dll" />
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

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

<Analyzer Remove="..."> only removes items whose item-spec exactly matches the provided string. Analyzer items are often represented with normalized/full paths, so these relative-path removes may not match and older variants may remain, causing multiple Humanizer.Analyzers.dll instances to load in the non-component-versioning fallback case. Prefer removing existing analyzer items by metadata (e.g., remove any @(Analyzer) whose %(FileName)%(Extension) matches Humanizer.Analyzers.dll) and then include only the roslyn3.8 analyzer if it exists.

Suggested change
<Analyzer Remove="$(MSBuildThisFileDirectory)..\analyzers\dotnet\roslyn3.8\cs\Humanizer.Analyzers.dll" />
<Analyzer Remove="$(MSBuildThisFileDirectory)..\analyzers\dotnet\roslyn4.8\cs\Humanizer.Analyzers.dll" />
<Analyzer Remove="$(MSBuildThisFileDirectory)..\analyzers\dotnet\roslyn4.14\cs\Humanizer.Analyzers.dll" />
<Analyzer Remove="@(Analyzer)" Condition="'%(Filename)%(Extension)' == 'Humanizer.Analyzers.dll'" />

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in ffd9f56. The fallback now first captures any existing @(Analyzer) items whose %(Filename)%(Extension) is Humanizer.Analyzers.dll, removes those exact item specs, and then includes only the Roslyn 3.8 analyzer. That avoids relying on relative-path removes.

Comment on lines +40 to 46
- task: UseDotNet@2
displayName: 'Use .NET 11 SDK'
inputs:
includePreviewVersions: true
version: 11.x

- task: DotNetCoreCLI@2
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

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

Installing .NET 11 after .NET 10 typically makes the subsequent dotnet invocations run on the latest installed SDK (11.x preview) unless the repo is pinned via global.json / useGlobalJson. If the intent is not to run all build/test steps on the preview SDK, pin the SDK selection (or scope .NET 11 usage to only the step(s) that require it) to keep CI behavior deterministic.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Checked this against the current pipeline. global.json pins the repo to 10.0.100 with rollForward=latestFeature, so the main dotnet build/test steps stay on 10.x even with 11.x installed. The 11.x SDK install is there for the package verification matrix only.

@DrEsteban
Copy link
Copy Markdown

😲 Wow huge PR for this issue 😅

Copilot AI review requested due to automatic review settings March 7, 2026 02:04
Copy link
Copy Markdown
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

Copilot reviewed 15 out of 317 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings March 7, 2026 04:05
Copy link
Copy Markdown
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

Copilot reviewed 15 out of 317 changed files in this pull request and generated 2 comments.

Comment on lines +6 to +13
<Target Name="SelectHumanizerAnalyzerFallback"
BeforeTargets="CoreCompile"
Condition="'$(SupportsRoslynComponentVersioning)' != 'true'">
<ItemGroup>
<HumanizerAnalyzer Include="@(Analyzer)" Condition="'%(Filename)%(Extension)' == 'Humanizer.Analyzers.dll'" />
<Analyzer Remove="@(HumanizerAnalyzer)" />
<Analyzer Include="$(MSBuildThisFileDirectory)..\analyzers\dotnet\roslyn3.8\cs\Humanizer.Analyzers.dll"
Condition="Exists('$(MSBuildThisFileDirectory)..\analyzers\dotnet\roslyn3.8\cs\Humanizer.Analyzers.dll')" />
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

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

The current target removes the existing Humanizer.Analyzers.dll unconditionally when SupportsRoslynComponentVersioning != true, but only adds the fallback analyzer if the roslyn3.8 DLL exists. If that file is missing for any reason (packaging/layout issue), this can result in no analyzer being included at all. Consider gating the removal behind the same Exists(...) check (or moving the Exists(...) condition to the <Target> / <ItemGroup> so removal+include happen atomically only when the fallback is present).

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 93a7d18. The fallback target now runs only when the Roslyn 3.8 analyzer DLL exists, so removal and replacement happen atomically and we never drop the analyzer set if that packaged variant is missing.

BeforeTargets="CoreCompile"
Condition="'$(SupportsRoslynComponentVersioning)' != 'true'">
<ItemGroup>
<HumanizerAnalyzer Include="@(Analyzer)" Condition="'%(Filename)%(Extension)' == 'Humanizer.Analyzers.dll'" />
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

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

The condition uses unqualified item metadata (%(Filename)%(Extension)), which can be ambiguous/harder to reason about in MSBuild item transforms. Prefer qualifying it to the source item type (e.g., %(Analyzer.Filename)%(Analyzer.Extension)) to make it explicit that you’re filtering the @(Analyzer) items.

Suggested change
<HumanizerAnalyzer Include="@(Analyzer)" Condition="'%(Filename)%(Extension)' == 'Humanizer.Analyzers.dll'" />
<HumanizerAnalyzer Include="@(Analyzer)" Condition="'%(Analyzer.Filename)%(Analyzer.Extension)' == 'Humanizer.Analyzers.dll'" />

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 93a7d18. The metadata check is now explicitly qualified as %(Analyzer.Filename)%(Analyzer.Extension) inside the fallback target item filter.

Copilot AI review requested due to automatic review settings March 7, 2026 04:11
Copy link
Copy Markdown
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

Copilot reviewed 15 out of 317 changed files in this pull request and generated 2 comments.

<PropertyGroup>
<TargetFramework>__TARGET_FRAMEWORK__</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>latest</LangVersion>
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

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

<LangVersion>latest</LangVersion> can make the fixture’s compilation behavior vary depending on which SDK is selected in CI (especially since CI installs preview SDKs). Since this is a smoke-test fixture and doesn’t appear to require a specific language version, consider removing LangVersion to use the SDK default, or pinning it to a specific version to keep the smoke test deterministic.

Suggested change
<LangVersion>latest</LangVersion>

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in d1046d7. I removed LangVersion from the SDK-style sample consumer templates so they use the SDK default, and handled the net48 console case directly in the sample fixture.


```bash
cd src/Humanizer.Analyzers.Tests
cd tests/Humanizer.Analyzers.Tests
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

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

The updated cd tests/Humanizer.Analyzers.Tests command is ambiguous about the expected starting directory. Consider clarifying that the command should be run from the repository root (or adjust the path accordingly), since this README lives under src/Humanizer.Analyzers/ and readers may try to run the command relative to that folder.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in d1046d7. The analyzer README now explicitly says the test command is run from the repository root.

@clairernovotny clairernovotny merged commit 702185d into main Mar 7, 2026
7 checks passed
@clairernovotny clairernovotny deleted the codex/fix-1681-package-regression branch March 7, 2026 05:00
clairernovotny added a commit that referenced this pull request Mar 7, 2026
* fix: cover analyzer package regressions across frameworks

* test: expand package host smoke coverage

* test: simplify package verification defaults

* test: separate package fixtures from verification

* test: template the wapproj fixture

* test: simplify package smoke verification

* test: use checked-in smoke project fixtures

* test: copy fixtures directly during verification

* test: simplify smoke verification commands

* fix: tighten analyzer fallback removal

* fix: apply analyzer fallback in target execution

* chore: rerun ci after verification fixes

* fix: gate analyzer fallback on packaged variant

* test: stabilize package smoke fixtures
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.

Humanizer 3.0.8 breaks launching applications

3 participants