Comments (5)
Yeah, that's quite understandable... I've been looking at this for a while now as well trying to understand what's going on. It seems that it might be due to a bug in dotnet itself, on later versions of dotnet 8 this is a non-issue. It just won't repro in that case when on dotnet 8.0.200
from messagepack-csharp.
I'm no windows developer, but fired up a windows box and did some digging, seems that just changing <TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
eg adding net8.0
and rebuilding MessagePack.Generator
locally and running with --framework net8.0
makes the error go away. Still puzzled over how this works when I run it on Linux and macOS, the main difference there is that I'm in complete control over the environment and ONLY have dotnet 8 SDK installed
So I guess the real solution to this problem in general is to just update MessagePack-CSharp to dotnet 8 and it should not be a problem. And seems that #1725 is on it's way? But perhaps it might be a good? or maybe a really bad? Idea to just update MPC to support net8.0
as it seems only bumping that tool solves at least the issue reported here?
In the meantime, my workaround was to just clone the repo, from master
branch build it and then you can either invoke your mpc commands using dotnet run
as below, or take the binary and put it in your $PATH
somewhere and call your local build instead of the NuGet provided one for now.
dotnet run --project "C:\Dev\Repos\MessagePack-CSharp\src\MessagePack.Generator\MessagePack.Generator.csproj" -i <YOUR_PROJ_FILE> -n <YOUR_NAMESPACE> -o <YOUR_OUTPUT_PATH> --framework net8.0
from messagepack-csharp.
Thanks for the report and sharing your workaround. I don't know why merely targeting .NET 8 would fix this, but it seems like a bug is present and a .NET 8 target may just be masking it. The repro may be useful.
That said, we're not investing in mpc
any more. The next major version will have a roslyn source generator. It's based on a lot of the same code, but a lot is different too, so I don't know whether this bug will repro with it or not.
from messagepack-csharp.
Alright, good to know.
Would it possible to do a small patch release with just the workaround similar to what I did enabling others that might be upgrading to dotnet8 and happens to be on Windows?
I could do the work needed and submit a PR if it would be an acceptable solution. For my specific use case we can always build and carry our own mpc for the windows folks.
I haven't found any bugs from the generated code we have so far and the code we generate is used quite a lot and using dotnet8 server side and il2cpp client side.
from messagepack-csharp.
Thank you for offering the PR. However I hesitate to take a PR that makes a problem go away without understanding why it works.
from messagepack-csharp.
Related Issues (20)
- Typeless serializer fails to serialize simple type, unless fields are prefixed with "_" HOT 2
- Explicit interface implementation
- Help request - using different (derived-)types for serialize/deserialize (IMessagePackFormatter<Tser, Tdes>)? HOT 2
- Discrepancy in Serialized Size with MessagePack for Complex Object Graphs HOT 1
- Serialize/deserialize of interface types failing with ContractlessStandardResolver HOT 1
- Make System.Runtime.CompilerServices.Unsafe a conditional based on TFM
- Serializing a property without a setter throws "No set accessor" when the class has a constructor HOT 4
- Source generated formatter support of sparse/patch objects via BitArray HOT 5
- A conflict issue using MessagePack.Unityshims HOT 2
- Securely Save and Load for my game? HOT 1
- Wrong type of formatter for record with string keys HOT 2
- GeneratedResolver does not exist in the namespace MessagePack.Resolvers
- Recursive serialization with custom formatter only writes last member HOT 2
- How to avoid cast and multiple Deserialize in code. HOT 1
- [Optimization] Locate formatters only if dictionary has elements HOT 1
- Unable to Deserialize Data Serialized with Typeless Resolver after Migrating to Attributed Objects HOT 16
- [Performance][Optimization] Method inline question HOT 3
- Message Pack Compiler just freezes HOT 1
- Help with removing from Unity HOT 2
- Dependency review to enable optimisations. HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from messagepack-csharp.