GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Convert mpc and msbuild task package to a roslyn source generator by AArnott · Pull Request #1599 · MessagePack-CSharp/MessagePack-CSharp

Conversation

@AArnott

@AArnott AArnott commented Apr 12, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

This completely replaces mpc and the msbuild task package with a C# roslyn Source Generator.

NuGet package impact:

Package Impact
MessagePack.MSBuild.Tasks Deprecated, and no longer built. This carried the msbuild integration that ran source generation before invoking the compiler. Users should stop referencing it and switch to MessagePack.SourceGenerator
MessagePack.Generator Deprecated, and no longer built. This carried the .NET CLI tool mpc. Unity users should now consume the source generator contained in the MessagePack.SourceGenerator.Unity.zip file.
MessagePack.SourceGenerator The new roslyn source generator for msbuild/VS users.
MessagePack.SourceGenerator.Unity.zip A new zip archive (not a nuget package), containing a source generator that targets Roslyn 3 for use by unity.

Ideas for future work (after this PR)

  1. Now that source generation can be totally automatic, should it just be on by default, and should we find a way to always find the generated formatters instead of requiring the user to specify the right resolver? For example, the source generator could add a [MessagePackFormatter] attribute on each [MessagePackObject] (provided the class is declared as partial) so that the default in-library resolvers will find the source generated formatter.
  2. A massive refactoring of the TypeCollector and analyzers so we don't have so much repeated and inconsistently updated code. For example, the check that the type passed to MessagePackFormatterAttribute derives from IMessagePackFormatter<T> is only performed for one possible place where the attribute can appear instead of everywhere it may appear. Field and property searches are also repeated in many places, again with inconsistent code handling them.

Remaining tasks

  • Add tests for the Roslyn3 project.
  • Confirm that this works with Unity.
  • Confirm that incremental source generation works, including that every type in the FullModel type hierarchy has functional equality comparers.
  • Stop building a roslyn3 nuget package and instead build a .zip that will be added to github releases alongside the .unitypackage we already ship.
  • Rename the Generator package to SourceGenerator so we aren't radically changing the type of an existing package, which will likely cause more confusion than no longer updating an existing package.
  • Remove diagnostic reporting from generator and add a dependency on the analyzer package.
  • Re-enable or remove the remaining Compile Remove items in the source generator test projects.
  • Unify TypeCollector across source generator and analyzer.
  • Source generator (and analyzer) to use precise assembly versioning

Closes #1495

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Y-YoL and others added 30 commits December 2, 2022 21:39
@Y-YoL
Change globa.json rollForward to feature
a8eba95
@Y-YoL
Change generator project setting
fe3c6e5
- remove project dependency
- update dependency package version
@Y-YoL
Add dependency reference
539f7d7
@Y-YoL
Replace Generator
ceefa17
@Y-YoL
Replace GeneratedResolver to ModuleInitializer
9f695cc
@Y-YoL
Add Generator.Roslyn3 csproj
4db4342
@Y-YoL
Fix GetFormatterWithVerify missing error
e962638
@Y-YoL
Fix array formatters is not registered
af3f8e4
@Y-YoL
Fix formatter duplicate definisions
51dac96
@AArnott
Merge in source generator work by @Y-YoL
7652a91
@AArnott
Delete MessagePack.MSBuild.Tasks project
f911a00
The source generator will altogether deprecate this.
@AArnott
Refactor source generating projects
267ba7f
@AArnott
Rollback Roslyn3 to 3.9
4763459
It presumably should be 3.8, but it doesn't compile with 3.8 at this point.
@AArnott
Got first new test passing
7ede56c
@AArnott
Fix package restore
4d99531
@AArnott
Remove checked-in generated code
c9e9a10
@AArnott
Get the first source generator test running as it should
19c252c
@AArnott
Merge branch 'develop' into sourceGenerator1495
339bd72
@AArnott
Simplify test pattern
cf1e1d4
@AArnott
Remove unnecessary new public API
d6b11bb
@AArnott
Delete some dead code
0069a97
@AArnott
Break up the outputs into individual files
3c27946
This will help with cacheability.
@AArnott
Get rid of unnecessary arrays in transforms
9bdd6f1
@AArnott
Split out Definitions into separate files
da6659b
@AArnott
Remove useless interface
1098dac
@AArnott
Use records for brevity
306bf9b
@AArnott
Share namespace prefixing code
54a2eb2
@AArnott
Condense #pragmas in generated code
bb71f8c
@AArnott
Capture full model in a record
ff5afe2
@AArnott
Start refactoring TypeCollector
e9ce2d6
This was referenced Nov 9, 2026
Bump MessagePack from 2.5.303 to 3.1.12 Franchef/Pifeon#5
Merged
Bump AWSSDK.S3 and 16 others PauloVianaR/ViverAppWeb#25
Closed
Bump the dotnet-dependencies group with 17 updates PauloVianaR/ViverAppWeb#26
Closed
Bump the nuget-major group with 9 updates Tjeerd-menno/nats-manager-ui#380
Closed
chore: Bump the nuget-updates group with 2 updates w1ck3ds0d4/GrainWallet#1
Closed
Bump the nuget group with 17 updates NikiforovAll/adaptive-rate-limiting-dotnet#16
Closed
Bump the nuget group with 1 update TanmayS0406/SSMSClaude-Script#14
Closed
deps: Bump MessagePack from 2.5.307 to 3.1.12 RMBarros-Dev/Hydra-Digital-Shop#14
Closed
Bump Avalonia and 11 others jeremychn/amarre#8
Closed
Bump the dotnet-major group with 8 updates chelomama-dev/finances-hub#32
Open
deps: Bump MessagePack from 2.5.307 to 3.1.12 erikdarlingdata/PerformanceStudio#715
Closed
This was referenced Nov 16, 2026
Bump AWSSDK.S3 and 16 others PauloVianaR/ViverAppWeb#27
Closed
Bump the dotnet-dependencies group with 17 updates PauloVianaR/ViverAppWeb#28
Open
Bump MessagePack from 2.5.307 to 3.1.12 afernandes/DiscoveryDeviceAndroid#5
Open
Bump MessagePack from 2.5.307 to 3.1.12 ErikEJ/SqlServer.Rules#820
Closed
Bump MessagePack from 2.5.307 to 3.1.12 thekim1/kalla#837
Closed
Bump the nuget-major group with 9 updates Tjeerd-menno/nats-manager-ui#386
Closed
Bump MessagePack from 2.5.307 to 3.1.12 jonnymuir/Heliograph#34
Closed
Bump AWSSDK.S3 and 15 others PauloVianaR/ViverAppWeb#30
Open
Bump the nuget-shipped group with 2 updates alexFinn97/scaffolder-for-optimizely#8
Closed
Bump the nuget group with 17 updates NikiforovAll/adaptive-rate-limiting-dotnet#17
Closed
Bump MessagePack from 2.5.307 to 3.1.12 Tjeerd-menno/nats-manager-ui#398
Merged
Bump the nuget group with 3 updates TanmayS0406/SSMSClaude-Script#17
Open
Bump MessagePack and 7 others chelomama-dev/finances-hub#34
Open
This was referenced Nov 23, 2026
Bump AWSSDK.S3 and 15 others PauloVianaR/ViverAppWeb#32
Closed
Bump the dotnet-dependencies group with 16 updates PauloVianaR/ViverAppWeb#33
Open
Bump MessagePack from 2.5.303 to 3.1.12 mortenbrudvik/Obfy#43
Closed
deps: Bump the "weekly" group with 1 update across multiple ecosystems ftichy/MiniShop#192
Merged
Bump MessagePack from 2.5.303 to 3.1.12 D-WIS/DWIS-Blackboard-Tests#45
Open
Bump the nuget group with 17 updates NikiforovAll/adaptive-rate-limiting-dotnet#18
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@neuecc neuecc Awaiting requested review from neuecc
1 more reviewer
@Y-YoL Y-YoL Y-YoL left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

v3.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@AArnott @Y-YoL
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.