Fix source generator delivery + DI mapper resolution; bump deps#30
Merged
Conversation
The 1.0.0 packages never delivered the Roslyn generator to consumers, so `dotnet add package OpenAutoMapper` generated nothing and generic `ProjectTo<T>` threw CS1061. This fixes packaging so a single install delivers the generator, fixes a DI runtime bug found while verifying, adds a packaged-consumer smoke test, and applies pending dependency bumps. Packaging - Bundle the generator into the OpenAutoMapper meta-package under analyzers/dotnet/cs. The generator DLL is staged into this project's own obj/ during build and packed via a static None item from there; this is safe under the release `--no-build` pack and avoids a multi-TFM pack race that intermittently dropped the analyzer when pointing at the sibling project's bin output. - DependencyInjection: PrivateAssets="contentfiles" so the single analyzer copy flows transitively to DI-only consumers (no duplicate generator). - release.yml: fail the release if the meta-package lacks the generator. DI runtime fix - The generator now registers MapperFactoryWithServiceCtor (used by CreateMapper(serviceCtor)); previously resolving IMapper from DI threw "No mapper factory registered". Adds a generator regression test. Testing - eng/package-smoke-test.sh + CI `package-smoke` job: pack, install into a throwaway consumer, and assert direct + DI mapping actually work. Dependencies - GitHub Actions: upload-artifact v7, configure-pages v6, upload-pages-artifact v5, deploy-pages v5, action-gh-release v3. - NuGet: DI.Abstractions/Logging.Abstractions 10.0.8, SourceLink 10.0.300, NET.Test.Sdk 18.6.0, coverlet 10.0.1, FluentAssertions 8.10.0, Mapster 10.0.7. - Keep Microsoft.CodeAnalysis.* on 4.x/3.x (5.x raises the consumer SDK floor and disables the generator on .NET 8/9 SDKs); dependabot.yml now ignores major bumps for those packages. - Version -> 1.0.1.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The 1.0.0 packages never delivered the Roslyn generator to consumers —
dotnet add package OpenAutoMappergenerated nothing and genericProjectTo<T>threw CS1061. This PR makes a single install deliver the generator, fixes a DI runtime bug found while verifying, adds a packaged-consumer smoke test, and applies the pending Dependabot bumps.Packaging fix
analyzers/dotnet/cs. The generator DLL is staged into the project's ownobj/during build and packed via a staticNonefrom there — safe under the release--no-buildpack and free of the multi-TFM pack race that intermittently dropped the analyzer.PrivateAssets="contentfiles"so the single analyzer copy flows transitively to DI-only consumers (no duplicate generator → no double-generation).DI runtime fix
MapperFactoryWithServiceCtor(used byCreateMapper(serviceCtor)); previously resolvingIMapperfrom DI threw "No mapper factory registered". Adds a generator regression test.Testing
eng/package-smoke-test.sh+ CIpackage-smokejob: packs the real packages, installs them into a throwaway consumer, and asserts direct + DI mapping actually work — the gap that let both bugs ship (in-repo tests don't wire the generator as an analyzer).Dependencies (Dependabot #12/#15/#16/#19/#20/#21/#28 + part of #29)
Microsoft.CodeAnalysis.*stays on 4.x/3.x — 5.x (ships with the .NET 10 SDK) would emit CS9057 and disable the generator for consumers on .NET 8/9 SDKs.dependabot.ymlnow ignores major bumps for those packages.