Unity consumes messagepack as a nuget package instead of source - #1734
Conversation
|
That all sounds awesome. I'll review today or this weekend. I expect it'll cause massive merge conflicts with my work on #1691, so I'll suspend that work for now to not compound the problem. |
|
Should we bump the major version number given that it'll be a breaking change for unity folks, as well as users of the analyzer? |
|
How does this impact any hesitancy to take on other nuget dependencies? In the past, I think dependencies on other assemblies were taken only with huge justification because it complicated consumption for unity users. |
Major version 3 is appropriate because the Additional InfoUnity 2021.3 is using Roslyn v3 and it dies in 2024 April. |
|
All this sounds exciting. Do you mind holding off on this substantial refactoring until my source generator/analyzer work to switch to attributes is done? |
|
Dropping |
|
No, we can't drop netstandard2.0. I believe what neuecc is saying is because unity supports netstandard2.1, we don't need a special source-based build for it any more. |
OK. |
I've installed Unity2022.3.18 and built IL2CPP in order to assess the cost of runtime Android armv7 detection. Results
Considering the compile-time optimization of C++, the combination of MethodsTest C# codeusing System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using UnityEngine;
public unsafe class TestForConst : MonoBehaviour
{
void Update()
{
Vector3 velocity;
if (BitConverter.IsLittleEndian)
{
velocity = new(0, 1, 0);
}
else if (sizeof(nint) == 4)
{
velocity = new(0, -1, 0);
}
else
{
velocity = new();
}
velocity += GenericVector<int>.Get();
transform.position += velocity * Time.deltaTime;
}
}
internal struct GenericVector<T>
{
public static Vector3 Get()
{
if (typeof(T) == typeof(int))
{
if (RuntimeInformation.ProcessArchitecture == Architecture.Arm)
{
return new(1, 0, 1);
}
return new(1, 0, 0);
}
return new(-1, 0, 0);
}
}Generated C++ code for Update methodIL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void TestForConst_Update_mAECC56A194C2E9D162EAFFB3B9F23B0B4EBCC9F7 (TestForConst_tDA600D04A981E1B53CD873D2147332DB5AA8480E* __this, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_runtime_metadata((uintptr_t*)&GenericVector_1_Get_m49BFA61A2FA9A6589F796D73B626ED5C0562B4A7_RuntimeMethod_var);
s_Il2CppMethodInitialized = true;
}
Vector3_t24C512C7B96BBABAD472002D0BA2BDA40A5A80B2 V_0;
memset((&V_0), 0, sizeof(V_0));
{
if (!il2cpp_codegen_is_little_endian())
{
goto IL_001f;
}
}
{
Vector3__ctor_m376936E6B999EF1ECBE57D990A386303E2283DE0_inline((&V_0), (0.0f), (1.0f), (0.0f), NULL);
goto IL_0048;
}
IL_001f:
{
uint32_t L_0 = sizeof(intptr_t);
if ((!(((uint32_t)L_0) == ((uint32_t)4))))
{
goto IL_0040;
}
}
{
Vector3__ctor_m376936E6B999EF1ECBE57D990A386303E2283DE0_inline((&V_0), (0.0f), (-1.0f), (0.0f), NULL);
goto IL_0048;
}
IL_0040:
{
il2cpp_codegen_initobj((&V_0), sizeof(Vector3_t24C512C7B96BBABAD472002D0BA2BDA40A5A80B2));
}
IL_0048:
{
Vector3_t24C512C7B96BBABAD472002D0BA2BDA40A5A80B2 L_1 = V_0;
Vector3_t24C512C7B96BBABAD472002D0BA2BDA40A5A80B2 L_2;
L_2 = GenericVector_1_Get_m49BFA61A2FA9A6589F796D73B626ED5C0562B4A7(GenericVector_1_Get_m49BFA61A2FA9A6589F796D73B626ED5C0562B4A7_RuntimeMethod_var);
Vector3_t24C512C7B96BBABAD472002D0BA2BDA40A5A80B2 L_3;
L_3 = Vector3_op_Addition_m78C0EC70CB66E8DCAC225743D82B268DAEE92067_inline(L_1, L_2, NULL);
V_0 = L_3;
Transform_tB27202C6F4E36D225EE28A13E4D662BF99785DB1* L_4;
L_4 = Component_get_transform_m2919A1D81931E6932C7F06D4C2F0AB8DDA9A5371(__this, NULL);
Transform_tB27202C6F4E36D225EE28A13E4D662BF99785DB1* L_5 = L_4;
NullCheck(L_5);
Vector3_t24C512C7B96BBABAD472002D0BA2BDA40A5A80B2 L_6;
L_6 = Transform_get_position_m69CD5FA214FDAE7BB701552943674846C220FDE1(L_5, NULL);
Vector3_t24C512C7B96BBABAD472002D0BA2BDA40A5A80B2 L_7 = V_0;
float L_8;
L_8 = Time_get_deltaTime_mC3195000401F0FD167DD2F948FD2BC58330D0865(NULL);
Vector3_t24C512C7B96BBABAD472002D0BA2BDA40A5A80B2 L_9;
L_9 = Vector3_op_Multiply_m87BA7C578F96C8E49BB07088DAAC4649F83B0353_inline(L_7, L_8, NULL);
Vector3_t24C512C7B96BBABAD472002D0BA2BDA40A5A80B2 L_10;
L_10 = Vector3_op_Addition_m78C0EC70CB66E8DCAC225743D82B268DAEE92067_inline(L_6, L_9, NULL);
NullCheck(L_5);
Transform_set_position_mA1A817124BB41B685043DED2A9BA48CDF37C4156(L_5, L_10, NULL);
return;
}
}il2cpp_codegen_is_little_endian is well optimized.inline bool il2cpp_codegen_is_little_endian()
{
#if IL2CPP_BYTE_ORDER == IL2CPP_LITTLE_ENDIAN
return true;
#else
return false;
#endif
}`typeof(T) == typeof(int)` is bad.IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR Vector3_t24C512C7B96BBABAD472002D0BA2BDA40A5A80B2 GenericVector_1_Get_m49BFA61A2FA9A6589F796D73B626ED5C0562B4A7_gshared (const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_runtime_metadata((uintptr_t*)&Int32_t680FF22E76F6EFAD4375103CBBFFA0421349384C_0_0_0_var);
il2cpp_codegen_initialize_runtime_metadata((uintptr_t*)&RuntimeInformation_tB2DFA85FB9251AE3A3112904C9DF06C30D1D3EAF_il2cpp_TypeInfo_var);
il2cpp_codegen_initialize_runtime_metadata((uintptr_t*)&Type_t_il2cpp_TypeInfo_var);
s_Il2CppMethodInitialized = true;
}
{
RuntimeTypeHandle_t332A452B8B6179E4469B69525D0FE82A88030F7B L_0 = { reinterpret_cast<intptr_t> (il2cpp_rgctx_type(InitializedTypeInfo(method->klass)->rgctx_data, 0)) };
il2cpp_codegen_runtime_class_init_inline(Type_t_il2cpp_TypeInfo_var);
Type_t* L_1;
L_1 = Type_GetTypeFromHandle_m6062B81682F79A4D6DF2640692EE6D9987858C57(L_0, NULL);
RuntimeTypeHandle_t332A452B8B6179E4469B69525D0FE82A88030F7B L_2 = { reinterpret_cast<intptr_t> (Int32_t680FF22E76F6EFAD4375103CBBFFA0421349384C_0_0_0_var) };
Type_t* L_3;
L_3 = Type_GetTypeFromHandle_m6062B81682F79A4D6DF2640692EE6D9987858C57(L_2, NULL);
bool L_4;
L_4 = Type_op_Equality_m99930A0E44E420A685FABA60E60BA1CC5FA0EBDC(L_1, L_3, NULL);
if (!L_4)
{
goto IL_004d;
}
}
{
il2cpp_codegen_runtime_class_init_inline(RuntimeInformation_tB2DFA85FB9251AE3A3112904C9DF06C30D1D3EAF_il2cpp_TypeInfo_var);
int32_t L_5;
L_5 = RuntimeInformation_get_ProcessArchitecture_mB2DAF77FAF4F8F97AE4045FA7DD140D60D8BF3F3_inline(NULL);
if ((!(((uint32_t)L_5) == ((uint32_t)2))))
{
goto IL_0038;
}
}
{
Vector3_t24C512C7B96BBABAD472002D0BA2BDA40A5A80B2 L_6;
memset((&L_6), 0, sizeof(L_6));
Vector3__ctor_m376936E6B999EF1ECBE57D990A386303E2283DE0_inline((&L_6), (1.0f), (0.0f), (1.0f), NULL);
return L_6;
}
IL_0038:
{
Vector3_t24C512C7B96BBABAD472002D0BA2BDA40A5A80B2 L_7;
memset((&L_7), 0, sizeof(L_7));
Vector3__ctor_m376936E6B999EF1ECBE57D990A386303E2283DE0_inline((&L_7), (1.0f), (0.0f), (0.0f), NULL);
return L_7;
}
IL_004d:
{
Vector3_t24C512C7B96BBABAD472002D0BA2BDA40A5A80B2 L_8;
memset((&L_8), 0, sizeof(L_8));
Vector3__ctor_m376936E6B999EF1ECBE57D990A386303E2283DE0_inline((&L_8), (-1.0f), (0.0f), (0.0f), NULL);
return L_8;
}
} |
|
I've tested template<typename T>
inline T il2cpp_unsafe_read_unaligned(void* location)
{
T result;
#if IL2CPP_TARGET_ARMV7 || IL2CPP_TARGET_JAVASCRIPT
memcpy(&result, location, sizeof(T));
#else
result = *((T*)location);
#endif
return result;
}
template<typename T>
inline void il2cpp_unsafe_write_unaligned(void* location, T value)
{
#if IL2CPP_TARGET_ARMV7 || IL2CPP_TARGET_JAVASCRIPT
memcpy(location, &value, sizeof(T));
#else
*((T*)location) = value;
#endif
}
template<typename T, typename TOffset>
inline T* il2cpp_unsafe_add(void* source, TOffset offset)
{
return reinterpret_cast<T*>(source) + offset;
}
template<typename T, typename TOffset>
inline T* il2cpp_unsafe_add_byte_offset(void* source, TOffset offset)
{
return reinterpret_cast<T*>(reinterpret_cast<uint8_t*>(source) + offset);
}By the way, Unity does not generate intrinsics for |
|
I think it's time to focus on this PR. Since I introduced all the merge conflicts, I'll try to find time to freshen it up. |
|
Ok, it's freshened up, ready for someone with more Unity experience to patch up the rest. :) |
Updated [MessagePack](https://github.com/MessagePack-CSharp/MessagePack-CSharp) from 2.5.302 to 3.1.7. <details> <summary>Release notes</summary> _Sourced from [MessagePack's releases](https://github.com/MessagePack-CSharp/MessagePack-CSharp/releases)._ ## 3.1.7 ## What's Changed * Add `scoped` to `MessagePackWriter.Write(ReadOnlySpan<T>)` methods by @AArnott in MessagePack-CSharp/MessagePack-CSharp#2271 * Fix security issues in master by @AArnott in MessagePack-CSharp/MessagePack-CSharp#2274 ## Security release details This release fixes 3 high severity and 9 moderate severity security vulnerabilities. ### High severity advisory fixes - 26d4e743 GHSA-382j-8mxh-c7x2 Reject invalid DateTime ext lengths for CWE-789 - b9cb6050 GHSA-vh6j-jc39-fggf Use iteration for skipping msgpack structures for CWE-674 - 719e690a GHSA-hv8m-jj95-wg3x Bound LZ4 input reads for CWE-125 ### Moderage severity advisory fixes - 2b5a500a GHSA-v72x-2h86-7f8m Guard LZ4 decompression length for CWE-409 - f093bdc1 GHSA-qhmf-xw27-6rqr Reject nested typeless blocklist bypass for CWE-502 - f077798e GHSA-2f33-pr97-265q Default MVC input formatter to UntrustedData for CWE-1188 - 25a3493e GHSA-2x83-8g95-xh59 Limit untrusted ExpandoObject maps for CWE-407 - b414e6df GHSA-wfr3-xj75-pfwh Guard dynamic union depth for CWE-674 - 0555f07c GHSA-w567-gjr2-hm5j Validate Unity blit lengths for CWE-789 - 9b5783a7 GHSA-cxmj-83gh-fp49 Fix CWE-789 multidimensional array allocation validation - f96fcf05 GHSA-q2h6-ghwm-5qm8 Use secure lookup comparer for CWE-407 - b3af7cf7 GHSA-cj9g-3mj2-g8vv Guard JSON conversion depth for CWE-674 - 66ad0894 GHSA-cj9g-3mj2-g8vv Avoid JSON separator recursion for CWE-674 - 082ba7da GHSA-cj9g-3mj2-g8vv Guard typeless JSON depth for CWE-674 ### Fixes with no security advisory - fb0fe9f0 Honor TypeFormatter options hooks for CWE-470 - c1c06a6f Fix WriteRawX methods to advance by written length - 46c6a0fe Fix CWE-190 map header length overflow **Full Changelog**: MessagePack-CSharp/MessagePack-CSharp@v3.1.6...v3.1.7 ## 3.1.6 ## What's Changed * Add several known unsafe 'gadgets' to the disallow list by @AArnott in MessagePack-CSharp/MessagePack-CSharp#2270 **Full Changelog**: MessagePack-CSharp/MessagePack-CSharp@v3.1.5...v3.1.6 ## 3.1.5 ## What's Changed * Remove unneeded GetTypeInfo() calls by @Bykiev in MessagePack-CSharp/MessagePack-CSharp#2206 * Use 'Write' instead of 'WriteInt32' for union type keys by @VictorNicollet in MessagePack-CSharp/MessagePack-CSharp#2212 * Fix various disposable issues by @Bykiev in MessagePack-CSharp/MessagePack-CSharp#2224 * fix: prevent StackOverflow in Equals with recursive generic constraints by @khuongntrd in MessagePack-CSharp/MessagePack-CSharp#2226 * Add more types to the default disallow list of named types to be deserialized by @AArnott in MessagePack-CSharp/MessagePack-CSharp#2256 * Fix release workflow by @AArnott in MessagePack-CSharp/MessagePack-CSharp#2268 * ~~Fix Incorrect DateTimeOffset Serializer by @T0PP1ng in MessagePack-CSharp/MessagePack-CSharp#2225 * Revert DateTimeOffset encoding change by @AArnott in MessagePack-CSharp/MessagePack-CSharp#2262 ## New Contributors * @Bykiev made their first contribution in MessagePack-CSharp/MessagePack-CSharp#2206 * @VictorNicollet made their first contribution in MessagePack-CSharp/MessagePack-CSharp#2212 * @T0PP1ng made their first contribution in MessagePack-CSharp/MessagePack-CSharp#2225 * @khuongntrd made their first contribution in MessagePack-CSharp/MessagePack-CSharp#2226 **Full Changelog**: MessagePack-CSharp/MessagePack-CSharp@v3.1.4...v3.1.5 ## 3.1.4 ## What's Changed * Fix SkipClrVisibilityChecks to notice private fields in base classes by @AArnott in MessagePack-CSharp/MessagePack-CSharp#2153 * Promote analyzers to AnalyzerReleases.Shipped.md by @hanachiru in MessagePack-CSharp/MessagePack-CSharp#2169 * Add memory size check to `GetMemoryCheckResult` by @AArnott in MessagePack-CSharp/MessagePack-CSharp#2172 * AccessModifier was added to generated code. by @Nirklav in MessagePack-CSharp/MessagePack-CSharp#2185 ## New Contributors * @hanachiru made their first contribution in MessagePack-CSharp/MessagePack-CSharp#2169 **Full Changelog**: MessagePack-CSharp/MessagePack-CSharp@v3.1.3...v3.1.4 ## 3.1.3 ## What's Changed * Fix stackoverflow on analyzer by @neuecc in MessagePack-CSharp/MessagePack-CSharp#2150 **Full Changelog**: MessagePack-CSharp/MessagePack-CSharp@v3.1.2...v3.1.3 ## 3.1.2 ## What's Changed * Add missing recursion guard to `CodeAnalysisUtilities.GetTypeParameters` by @AArnott in MessagePack-CSharp/MessagePack-CSharp#2123 * Remove FluentAssertions, Use Shouldly by @neuecc in MessagePack-CSharp/MessagePack-CSharp#2124 * Fix issues about Double.MaxValue by @guojiancong in MessagePack-CSharp/MessagePack-CSharp#2135 * GitHubActions, prevent run build-unity on external contributor by @neuecc in MessagePack-CSharp/MessagePack-CSharp#2138 * Protects the generated resolver type metadata from trimmer by @mayuki in MessagePack-CSharp/MessagePack-CSharp#2134 * Add PreserveAttribute to generic formatters for Unity IL2CPP by @neuecc in MessagePack-CSharp/MessagePack-CSharp#2136 * Change ByteListFormatter behaviour to keep binary compatibility for List<byte> by @neuecc in MessagePack-CSharp/MessagePack-CSharp#2139 ## New Contributors * @guojiancong made their first contribution in MessagePack-CSharp/MessagePack-CSharp#2135 **Full Changelog**: MessagePack-CSharp/MessagePack-CSharp@v3.1.1...v3.1.2 ## 3.1.1 ## What's Changed * README.md: ÌntKey -> IntKey by @stanoddly in MessagePack-CSharp/MessagePack-CSharp#2098 * allow DynamicGenericResolver to StandardResolver in DynamicAssembly.AvoidDynamicCode by @neuecc in MessagePack-CSharp/MessagePack-CSharp#2105 * Remove PublicApiAnalyzers by @neuecc in MessagePack-CSharp/MessagePack-CSharp#2104 * Fix source generator, don't generate when abstract/interface is not union by @neuecc in MessagePack-CSharp/MessagePack-CSharp#2103 * enable analyze union / stop collect field when object marked SuppressSourceGeneration by @neuecc in MessagePack-CSharp/MessagePack-CSharp#2106 ## New Contributors * @stanoddly made their first contribution in MessagePack-CSharp/MessagePack-CSharp#2098 **Full Changelog**: MessagePack-CSharp/MessagePack-CSharp@v3.1.0...v3.1.1 ## 3.1.0 ## What's Changed * Relaxed the conditions in editor.config by @neuecc in MessagePack-CSharp/MessagePack-CSharp#2088 * Add .NET 9 by @neuecc in MessagePack-CSharp/MessagePack-CSharp#2090 * Add `Int128`, `UInt128`, `Rune`. `OrderedDictionary<T, V>`. `ReadOnlySet<T>` serialization support * Check IsGenericType before call ConstructUnboundGenericType() by @neuecc in MessagePack-CSharp/MessagePack-CSharp#2093 * Remove NerdBank.GitVersioning by @neuecc in MessagePack-CSharp/MessagePack-CSharp#2094 * Current all apis to shipped.txt by @neuecc in MessagePack-CSharp/MessagePack-CSharp#2095 **Full Changelog**: MessagePack-CSharp/MessagePack-CSharp@v3.0.301...v3.1.0 ## 3.0.301 ## Note Tag and Unity's version is 3.0.301 but published NuGet version is 3.0.308. The version mismatch due to release process inconsistencies will be fixed in the next release. ## What's Changed * Touch-ups to master by @AArnott in MessagePack-CSharp/MessagePack-CSharp#2084 * Fix Source Generator doesnt work in Unity by @neuecc in MessagePack-CSharp/MessagePack-CSharp#2087 **Full Changelog**: MessagePack-CSharp/MessagePack-CSharp@v3.0.300...v3.0.301 ## 3.0.300 Fixed version, [release notes see v3.0.3](https://github.com/MessagePack-CSharp/MessagePack-CSharp/releases/tag/v3.0.3). ## 3.0.238-rc.1 ## What's Changed * Fix simplified name for ValueTuple<T> by @AlanLiu90 in MessagePack-CSharp/MessagePack-CSharp#2033 * Avoid crashing with stack overflow on recursive generic type parameter constraints by @AArnott in MessagePack-CSharp/MessagePack-CSharp#2036 **Full Changelog**: MessagePack-CSharp/MessagePack-CSharp@v3.0.233-rc.1...v3.0.238-rc.1 ## 3.0.233-rc.1 ## Changes ### Enhancements * #2013: Secure by default ### Fixes * #2031: Use generic type argument used for custom formatters * #2029: Apply scoped in more places * #2030: Support nesting formatters within generic data types * #2024: Source code generation fails for generic type with private member serialization * #2028: Avoid collecting fields with custom formatter recusively * #2023: Suppress MsgPack004 on private base members when only public is interesting * #2022: Ignore abstract implementations of `IMessagePackFormatter<T>` * #2012: MsgPack004 Analyzer triggering on not attributed private property on base class eventhough source generator shouldn't include private properties * #2017: MsgPack013 should not report diagnostics on abstract classes * #2021: Add `scoped` modifier to `in` parameters of `ref struct` * #2016: Avoid collecting members when it doesn't have [Key] * #2005: custom formatters code source generator error ### Others * #2032: Use simpler C# syntax for nullable value types ## 3.0.214-rc.1 ## Changes: * #2015: Use a collision-resistant hash algorithm for untrusted data to address GHSA-4qm4-8hg2-g2xm * #2009: Build nuget package with semver v2 This list of changes was [auto generated](https://dev.azure.com/ils0086/MessagePack-CSharp/_build/results?buildId=2663&view=logs). ## 3.0.208-rc.1 ## Breaking changes * Drop .NET 6 support by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1991 ## Enhancements * Lower language version requirement of source generated resolver by @AlanLiu90 in MessagePack-CSharp/MessagePack-CSharp#1926 * Add ignore case option to EnumAsStringFormatter by @iguskov1810 in MessagePack-CSharp/MessagePack-CSharp#1936 * Adjusted MsgPack004 to support records by @N-Olbert in MessagePack-CSharp/MessagePack-CSharp#1932 and MessagePack-CSharp/MessagePack-CSharp#1946 * Add `MessagePackSerializer.Typeless.Deserialize` overload that takes `ReadOnlyMemory<byte>` by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1959 * Make `CompositeResolverAttribute` much more useful by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1968 * Add MsgPack014 analyzer and code fix by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1969 * Reconcile AllowPrivate behavior by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1990 * Add analyzers to help recognize breaking changes by @AArnott in MessagePack-CSharp/MessagePack-CSharp#2003 * Add AOT formatter support for init properties and required members by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1980 * Support formatters for CompositeResolverAttribute by @AlanLiu90 in MessagePack-CSharp/MessagePack-CSharp#1922 ## Fixes * Fix diagnostic and code fix for MsgPack011 on nesting types by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1910 * Fix some source generator issues by @AlanLiu90 in MessagePack-CSharp/MessagePack-CSharp#1921 * Improve handling of array types in source generation by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1960 * Honor key name overrides in source-generated formatters by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1962 * MPC String Value From Key Attribute Fix by @alimakki in MessagePack-CSharp/MessagePack-CSharp#1963 * Update DynamicAssembly usage to honor different AssemblyLoadContext's by @BertanAygun in MessagePack-CSharp/MessagePack-CSharp#1978 * Fix pack to include analyzers (more reliably) by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1994 * Migration improvements: deserializing constructors and less-frequent `partial` requirements by @AArnott in MessagePack-CSharp/MessagePack-CSharp#2002 * Fix analyzers to not mis-interpret source generated formatters as user-defined by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1982 * Fix embedded types being generated in resolver by @AlanLiu90 in MessagePack-CSharp/MessagePack-CSharp#2000 * Fix handling of name collisions in type hierarchies by @AArnott in MessagePack-CSharp/MessagePack-CSharp#2006 * Fix detecting duplicate keys by @pkindruk in MessagePack-CSharp/MessagePack-CSharp#1971 ## Other changes * Update test project to ensure default language version of generated code is C# 7.3 by @AlanLiu90 in MessagePack-CSharp/MessagePack-CSharp#1934 * Make source generation cancellable by @AlanLiu90 in MessagePack-CSharp/MessagePack-CSharp#1912 * Drop unused System.CodeDom package version by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1965 * Fix AOT README anchor by @alimakki in MessagePack-CSharp/MessagePack-CSharp#1967 * Avoid GetSemanticModel in analyzer by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1970 * Rename test class for improved discoverability by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1984 * Replace DynamicMethod use with private-capable Ref.Emit by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1981 * Reader/Writer touch-ups by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1987 * Allow trimming of benchmarked frameworks by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1988 * Build 3.0-rc.1 by @AArnott in MessagePack-CSharp/MessagePack-CSharp#2004 ## New Contributors * @N-Olbert made their first contribution in MessagePack-CSharp/MessagePack-CSharp#1932 * @iguskov1810 made their first contribution in MessagePack-CSharp/MessagePack-CSharp#1936 * @alimakki made their first contribution in MessagePack-CSharp/MessagePack-CSharp#1963 ... (truncated) ## 3.0.134-beta ## What's Changed * Fix and improve generated formatters by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1905 * Honor `ExcludeFormatterFromSourceGeneratedResolverAttribute` by suppressing certain warnings by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1907 **Full Changelog**: MessagePack-CSharp/MessagePack-CSharp@v3.0.129-beta...v3.0.134-beta ## 3.0.129-beta ## What's Changed * Fix some source generator issues by @AlanLiu90 in MessagePack-CSharp/MessagePack-CSharp#1873 * Faster multi-element serialization for primitive types by @pCYSl5EDgo in MessagePack-CSharp/MessagePack-CSharp#1872 * Remove Unity related symbols from Nuget projects by @pCYSl5EDgo in MessagePack-CSharp/MessagePack-CSharp#1888 * Simd Accelerated bool[] deserialize by @pCYSl5EDgo in MessagePack-CSharp/MessagePack-CSharp#1890 * Avoid regenerating all formatters when only one object/union/enum changes by @AlanLiu90 in MessagePack-CSharp/MessagePack-CSharp#1884 * Fix UnsafeBlitFormatter for the case of endianess mismatch by @pCYSl5EDgo in MessagePack-CSharp/MessagePack-CSharp#1894 * Offer code fix for MsgPack011: `partial` modifier required by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1893 * Build beta instead of alpha by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1896 * Offer code fix to ignore unattribute members of MessagePackObject types by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1898 * Fix UnsafeBlitFormatterBase by @pCYSl5EDgo in MessagePack-CSharp/MessagePack-CSharp#1900 **Full Changelog**: MessagePack-CSharp/MessagePack-CSharp@v3.0.111-alpha...v3.0.129-beta ## 3.0.111-alpha ## What's Changed * fixing issue with backing field naming and serialization failing by @epitka in MessagePack-CSharp/MessagePack-CSharp#1785 * Feature/1804 locate formatters only if has elements inside by @nmi-relewise in MessagePack-CSharp/MessagePack-CSharp#1805 * Enable ignoring fields by using [NonSerialized] by @mookid8000 in MessagePack-CSharp/MessagePack-CSharp#1808 * Reduce nuget dependencies by @thompson-tomo in MessagePack-CSharp/MessagePack-CSharp#1812 * Merge master and dependency updates into develop by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1814 * Fix source generator handling of inaccessible custom formatters by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1818 * Activate analyzers and source generator by default by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1822 * Add `ExcludeFormatterFromSourceGeneratedResolverAttribute` by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1824 * Raise perf tracking events when formatters are dynamically generated by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1829 * Bump Microsoft.NET.StringTools from 17.9.5 to 17.10.4 by @dependabot in MessagePack-CSharp/MessagePack-CSharp#1840 * Eliminate `#if` regions related to unity by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1825 * Preserve code comments when adding attributes to fields by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1842 * Add .NET 8 target to mpc by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1832 * Fix handling of formatters following the singleton pattern by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1850 * Report missing `[MessagePackObject]` attribute for generic types by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1859 * Unity consumes messagepack as a nuget package instead of source by @neuecc in MessagePack-CSharp/MessagePack-CSharp#1734 * Allow writing to init property setters of generic classes on .NET 6+ by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1879 * Fix issues about the equality of AnalyzerOptions and FormatterDescriptor by @AlanLiu90 in MessagePack-CSharp/MessagePack-CSharp#1874 ## New Contributors * @epitka made their first contribution in MessagePack-CSharp/MessagePack-CSharp#1785 * @nmi-relewise made their first contribution in MessagePack-CSharp/MessagePack-CSharp#1805 * @mookid8000 made their first contribution in MessagePack-CSharp/MessagePack-CSharp#1808 * @thompson-tomo made their first contribution in MessagePack-CSharp/MessagePack-CSharp#1812 **Full Changelog**: MessagePack-CSharp/MessagePack-CSharp@v3.0.54-alpha...v3.0.111-alpha ## 3.0.54-alpha ## What's Changed ### High level * `mpc` tool is gone. We use roslyn source generators now. * Source generation is enabled by default. At runtime MessagePack v3 will look for these source generated formatters and avoid generating them dynamically if found. ### Pull requests * Rollback package dependency versions for analyzers by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1641 * move code depending on UnityEditor into separate assembly by @NorbertNemec in MessagePack-CSharp/MessagePack-CSharp#1649 * remove MessagePackWindow in Unity by @neuecc in MessagePack-CSharp/MessagePack-CSharp#1651 * Union type collect by @Scormave in MessagePack-CSharp/MessagePack-CSharp#1634 * Switch from MSBuild properties to an AdditionalFiles json file by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1667 * Fix analyzer when only MessagePack.Annotations is referenced by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1674 * Allow applying `[MessagePackFormatter]` on parameters by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1678 * Revert "Allow applying `[MessagePackFormatter]` on parameters" by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1679 * Allow applying `[MessagePackFormatter]` on parameters and return values by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1680 * Remove `long` to `int` truncation of stream position by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1685 * Fix releases links in README text by @KonH in MessagePack-CSharp/MessagePack-CSharp#1688 * Better constrain dictionary detection by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1687 * Create FUNDING.yml by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1693 * Workaround mono runtime bug by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1696 * Support to analyze records by @nenoNaninu in MessagePack-CSharp/MessagePack-CSharp#1698 * Add MESSAGEPACK_FORCE_AOT preprocessor directive by @brwhelan-msft in MessagePack-CSharp/MessagePack-CSharp#1701 * .NET 8 Update(1): stylecop related small update by @pCYSl5EDgo in MessagePack-CSharp/MessagePack-CSharp#1727 * .NET 8 Update(0): global.json, Dockerfile, Packages by @pCYSl5EDgo in MessagePack-CSharp/MessagePack-CSharp#1726 * .NET 8 Update(2): TargetFrameworks by @pCYSl5EDgo in MessagePack-CSharp/MessagePack-CSharp#1728 * .NET 8 Update(3): Microsoft.CodeAnalysis.Analyzers v3.3.4 by @pCYSl5EDgo in MessagePack-CSharp/MessagePack-CSharp#1729 * .NET 8 Update(4): System.Collections.Frozen by @pCYSl5EDgo in MessagePack-CSharp/MessagePack-CSharp#1730 * .NET 8 Update(5): System.Collections.Generic.PriorityQueue<TElement, TPriority> by @pCYSl5EDgo in MessagePack-CSharp/MessagePack-CSharp#1731 * .NET 8 Update(6): CollectionsMarshal for ListFormatter by @pCYSl5EDgo in MessagePack-CSharp/MessagePack-CSharp#1732 * Source Generator configuration via attributes instead of .json file by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1736 * Improved UnityShims for better code sharing by @Scormave in MessagePack-CSharp/MessagePack-CSharp#1585 * Drop support for roslyn 3.8 by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1749 * IEnumerable<T> serialize improvement: Enumerable.TryGetNonEnumeratedCount by @pCYSl5EDgo in MessagePack-CSharp/MessagePack-CSharp#1751 * AOT by default by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1743 * Add a `[CompositeResolver]` attribute that triggers source generation by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1754 * .NET 8 Update(8): Update Benchmarks not using Dynamic PGO and BinaryFormatter by @pCYSl5EDgo in MessagePack-CSharp/MessagePack-CSharp#1746 * Include all hand-written formatters in the source generated resolver by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1796 * Fix source generated formatters for records with string keys by @dmitry-bym in MessagePack-CSharp/MessagePack-CSharp#1798 * Use LangVersion=12 everywhere except code that Unity compiles by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1801 * Source generated formatters that support private members by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1802 ## New Contributors * @NorbertNemec made their first contribution in MessagePack-CSharp/MessagePack-CSharp#1649 * @nenoNaninu made their first contribution in MessagePack-CSharp/MessagePack-CSharp#1698 * @brwhelan-msft made their first contribution in MessagePack-CSharp/MessagePack-CSharp#1701 * @dmitry-bym made their first contribution in MessagePack-CSharp/MessagePack-CSharp#1798 ... (truncated) ## 3.0.3 See our [migration guide](https://github.com/MessagePack-CSharp/MessagePack-CSharp/blob/master/doc/migration.md). Details [blog article](https://neuecc.medium.com/messagepack-for-c-v3-release-with-source-generator-support-893ed30d0e89) ## What's new - AOT source generation of formatters by default using roslyn source generators. `mpc` is no longer available. Dynamic formatters still exist (for runtimes that support them), but code that compiles against v3 are unlikely to need them, resulting in better startup performance and improved debugging experience. - AOT source generation is hugely improved. - Support most or all of the data types that `DynamicObjectResolver` supported. - Support for serializing private members. - `[MessagePackObject]` types can serialize private members without the application having to switch to `DynamicObjectResolverAllowPrivate`. - Analyzers are on by default, with many new ones to help ensure your code is correct and ready for AOT source generated formatters. - Custom formatters are *automatically* used for the data types they format when defined in the same assembly, by default. No need to attribute your data types to point to the custom formatter. Opt out by attributing the formatter with `[ExcludeFormatterFromSourceGeneratedResolverAttribute]`. - New `CompositeResolverAttribute` offers a faster runtime alternative to the `CompositeResolver` class. ### Unity - Consume through NuGetForUnity and UPM instead of through `.unitypackage` - ## What's Changed * Fix bug unsafe formatter by @pCYSl5EDgo in MessagePack-CSharp/MessagePack-CSharp#1584 * Bump Microsoft.NET.StringTools from 17.4.0 to 17.5.0 by @dependabot in MessagePack-CSharp/MessagePack-CSharp#1588 * Add built-in formatters for several more System.Numerics types by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1597 * Bump ReactiveProperty from 8.2.0 to 9.1.2 by @dependabot in MessagePack-CSharp/MessagePack-CSharp#1592 * Set nullable in unity by @Y-YoL in MessagePack-CSharp/MessagePack-CSharp#1600 * Convert mpc and msbuild task package to a roslyn source generator by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1599 * Merge master into develop by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1601 * Bring back support for the additional allow types by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1602 * Report diagnostics instead of throw from TypeCollector by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1605 * Enable P2P generic test by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1604 * Avoid copying data twice in MessagePackWriter.MemoryCopy when running… by @AlanLiu90 in MessagePack-CSharp/MessagePack-CSharp#1607 * Bump Nerdbank.GitVersioning from 3.5.119 to 3.6.128 by @dependabot in MessagePack-CSharp/MessagePack-CSharp#1615 * Bump Microsoft.Build.Locator from 1.4.1 to 1.5.5 by @dependabot in MessagePack-CSharp/MessagePack-CSharp#1613 * Bump Microsoft.CodeAnalysis.PublicApiAnalyzers from 3.3.3 to 3.3.4 by @dependabot in MessagePack-CSharp/MessagePack-CSharp#1612 * Merge master into develop by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1620 * Bump NUnit3TestAdapter from 4.3.1 to 4.4.2 by @dependabot in MessagePack-CSharp/MessagePack-CSharp#1614 * Bump System.Collections.Immutable from 6.0.0 to 7.0.0 by @dependabot in MessagePack-CSharp/MessagePack-CSharp#1611 * Fix the errant package dependency in source generator package by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1622 * Fix `ILookup<TKey, TElement>` deserialized behavior by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1623 * Merge latest Library.Template by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1640 * Bump Microsoft.NET.StringTools from 17.5.0 to 17.6.3 by @dependabot in MessagePack-CSharp/MessagePack-CSharp#1629 * Rollback package dependency versions for analyzers by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1641 * move code depending on UnityEditor into separate assembly by @NorbertNemec in MessagePack-CSharp/MessagePack-CSharp#1649 * remove MessagePackWindow in Unity by @neuecc in MessagePack-CSharp/MessagePack-CSharp#1651 * Union type collect by @Scormave in MessagePack-CSharp/MessagePack-CSharp#1634 * Switch from MSBuild properties to an AdditionalFiles json file by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1667 * Fix analyzer when only MessagePack.Annotations is referenced by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1674 * Allow applying `[MessagePackFormatter]` on parameters by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1678 * Revert "Allow applying `[MessagePackFormatter]` on parameters" by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1679 * Allow applying `[MessagePackFormatter]` on parameters and return values by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1680 * Remove `long` to `int` truncation of stream position by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1685 * Fix releases links in README text by @KonH in MessagePack-CSharp/MessagePack-CSharp#1688 ... (truncated) ## 2.6.100-alpha ## What's Changed * Avoid copying data twice in MessagePackWriter.MemoryCopy when running… by @AlanLiu90 in MessagePack-CSharp/MessagePack-CSharp#1607 * Bump System.Collections.Immutable from 6.0.0 to 7.0.0 by @dependabot in MessagePack-CSharp/MessagePack-CSharp#1611 * Fix the errant package dependency in source generator package by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1622 * Fix `ILookup<TKey, TElement>` deserialized behavior by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1623 ## New Contributors * @AlanLiu90 made their first contribution in MessagePack-CSharp/MessagePack-CSharp#1607 **Full Changelog**: MessagePack-CSharp/MessagePack-CSharp@v2.6.95-alpha...v2.6.100-alpha ## 2.6.95-alpha ## What's Changed * Convert mpc and msbuild task package to a roslyn source generator by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1599 * Fix bug unsafe formatter by @pCYSl5EDgo in MessagePack-CSharp/MessagePack-CSharp#1584 * Bump Microsoft.NET.StringTools from 17.4.0 to 17.5.0 by @dependabot in MessagePack-CSharp/MessagePack-CSharp#1588 * Add built-in formatters for several more System.Numerics types by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1597 * Set nullable in unity by @Y-YoL in MessagePack-CSharp/MessagePack-CSharp#1600 * Bring back support for the additional allow types by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1602 * Report diagnostics instead of throw from TypeCollector by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1605 * Enable P2P generic test by @AArnott in MessagePack-CSharp/MessagePack-CSharp#1604 ## New Contributors * @Y-YoL made their first contribution in MessagePack-CSharp/MessagePack-CSharp#1600 **Full Changelog**: MessagePack-CSharp/MessagePack-CSharp@v2.5.108...v2.6.95-alpha Commits viewable in [compare view](MessagePack-CSharp/MessagePack-CSharp@v2.5.302...v3.1.7). </details> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

@AArnott @pCYSl5EDgo
This is a request for a significant change in the project structure.
Currently, all the source code placed on the Unity side is to be moved to the .NET side, with Unity referencing a dll.
This change will make it easier to write as a .NET library, and also allows us to adopt C# 12.
There is no need to be conscious of Unity in regular code writing.
On the Unity side, it will reference a NuGet library built as a DLL as its core,
and use a plugin method to separately reference extensions for Unity through Unity UPM.
MessagePack for C# is widely referenced as a foundational library, but
since there is no compatibility between the Unity version and the NuGet version of the library,
NuGet libraries that depend on MessagePack for C# in Unity have become unreferenceable.
Unity is now different from the past, being .NET Standard 2.1,
and excellent package managers like NuGetForUnity have also emerged.
I recently released a new library called R3, and there, I tried the same structure as this PR.
https://github.com/Cysharp/R3/#unity
I believe adopting this PR is important for the efficiency of future development and the progress in Unity.
However, since this would break compatibility with references on the Unity side,
how about timing the release to coincide with the Source Generatorization when mpc is no longer needed?