Permalink
Comparing changes
Choose two branches to see what’s changed or to start a new pull request.
If you need to, you can also .
Open a pull request
Create a new pull request by comparing changes across two branches. If you need to, you can also .
4
contributors
Commits on Jul 06, 2020
…pe should be forced, just like a single Type instance is
- add non-generic utility methods for all the new input types - promote "Type first" on the utility methods; de-promote legacy and Merge
Commits on Jul 08, 2020
Commits on Jul 13, 2020
Commits on Aug 05, 2020
Commits on Aug 06, 2020
Commits on Aug 07, 2020
* tidy up MetaType.OPTIONS_* - been meaning to do that for ages! * implement and test for #692 * support sub-type skipping in non-generic APIs * fix changed expectations; lib revs * CI * TrySerializeAny should also respect inheritance * yak for clean build
…ted at type root (#696)
Commits on Aug 10, 2020
…throw EndOfStreamException, not NullReferenceException (xref #697)
Commits on Aug 13, 2020
Commits on Aug 19, 2020
Co-authored-by: Konstantin Sharon <konstantins@sentinelone.com>
Commits on Oct 02, 2020
1. ImplementsServiceFor: don't claim nullables 2. GetServicesImpl: dive into nullables
Commits on Oct 03, 2020
* start putting hooks in place to allow surrogates to be defined externally; - new RuntimeTypeModel API to allow transform methods to be supplied - new checks in "emit" (don't emit internal serializer types) - implement "emit" in ExternalSerializer (in some cases) * yaks * fix emit of surrogates * use ProviderCache<T> directly if we're already ignoring accessibility * still need to emit non-public providers for external types (at that point: it isn't our problem) * more words * add native google / nodatime test * try to enable inbuilts to be used as surrogate targets * allow surrogates for inbuilts to go direct, bypassing GetSerializer * additional test for primitive surrogates via attributes * silly compiler-generated names... * 1. implement Instant 2. make more things work on macosx * fix more broken OS tests * fix more broken OS tests * more macosx test fixes * update the protos for the 5 impacted types from NodaTime.Serialization; snapshot the output * generalize external imports via addition of Origin; imports are now sorted alphabetically * rename API to AddNodaTime, as it isn't all via surrogates * update .proto files, and add google/type/* * fix CS1591 (missing comments) * add example for SO64101495 * add round-trip example for IPAddress * fix schema generation when using surrogates to primitive types * add example of primitive custom serializer * add baseline and binary assert to SO64101495 example * - add native (i.e. Google protobuf) test for all common nodatime tests - fix generator so that imports work on the website
This reverts commit f815a8d.
Unified
Split
Showing
with
7,162 additions
and 531 deletions.
- +1 −0 Build.csproj
- +1 −1 README.md
- +1 −1 docs/3_0.md
- +1 −0 docs/_config.yml
- +11 −0 docs/releasenotes.md
- +1 −1 src/Benchmark/Benchmark.csproj
- +2 −1 src/Benchmark/Codegen/protogen.cs
- +1 −1 src/BenchmarkBaseline/BenchmarkBaseline.csproj
- +3 −2 src/Directory.Build.props
- +4 −4 src/Examples/EnumTests.cs
- +4 −2 src/Examples/Examples.csproj
- +21 −9 src/Examples/Issues/Issue124.cs
- +2 −2 src/Examples/Issues/Issue265.cs
- +4 −4 src/Examples/Issues/Issue303.cs
- +1 −1 src/Examples/Issues/Issue304.cs
- +1 −1 src/Examples/Issues/Issue306.cs
- +1 −1 src/Examples/Issues/Issue310.cs
- +1 −1 src/Examples/Issues/Issue316.cs
- +1 −1 src/Examples/Issues/Issue329.cs
- +2 −2 src/Examples/Issues/Issue647.Generated.cs
- +1 −1 src/Examples/Issues/Issue647.cs
- +172 −0 src/Examples/Issues/Issue692.cs
- +85 −0 src/Examples/Issues/Issue695.cs
- +70 −0 src/Examples/Issues/Issue697.cs
- +110 −0 src/Examples/Issues/Issue713.cs
- +1 −1 src/Examples/Issues/SO11656439.cs
- +33 −4 src/Examples/Issues/SO12040007.cs
- +1 −1 src/Examples/Issues/SO13802844.cs
- +190 −0 src/Examples/Issues/SO64101495.cs
- +1 −1 src/Examples/Issues/SO6505590.cs
- +3 −3 src/Examples/Pipeline.cs
- +18 −18 src/Examples/ProtoGeneration.cs
- +2 −2 src/LongDataTests/LongDataTests.csproj
- +315 −0 src/NativeGoogleTests/Date.cs
- +84 −0 src/NativeGoogleTests/Dayofweek.cs
- +328 −0 src/NativeGoogleTests/Duration.cs
- +380 −0 src/NativeGoogleTests/MakeMeOneWithEverything.cs
- +34 −0 src/NativeGoogleTests/NativeGoogleTests.csproj
- +73 −0 src/NativeGoogleTests/NodaTimeTests.cs
- +551 −0 src/NativeGoogleTests/Nodatime.cs
- +346 −0 src/NativeGoogleTests/Timeofday.cs
- +357 −0 src/NativeGoogleTests/Timestamp.cs
- +2 −6 src/protobuf-net.Core/ExtensibleUtil.cs
- +1 −3 src/protobuf-net.Core/Helpers.cs
- +40 −3 src/protobuf-net.Core/Internal/DynamicStub.cs
- +1 −1 src/protobuf-net.Core/Internal/ThrowHelper.cs
- +0 −3 src/protobuf-net.Core/MeasureState.cs
- +6 −0 src/protobuf-net.Core/Meta/SchemaGenerationOptions.cs
- +96 −12 src/protobuf-net.Core/Meta/TypeModel.cs
- +45 −27 src/protobuf-net.Core/ProtoContractAttribute.cs
- +8 −5 src/protobuf-net.Core/ProtoReader.State.ReadMethods.cs
- +2 −2 src/protobuf-net.Core/ProtoReader.Stream.cs
- +0 −2 src/protobuf-net.Core/ProtoReader.cs
- +6 −2 src/protobuf-net.Core/ProtoWriter.State.WriteMethods.cs
- +0 −2 src/protobuf-net.Core/ProtoWriter.State.cs
- +1 −1 src/protobuf-net.Core/Serializers/RepeatedSerializer.cs
- +1 −1 src/protobuf-net.Core/WellKnownTypes/Duration.cs
- +1 −1 src/protobuf-net.Core/WellKnownTypes/Empty.cs
- +1 −1 src/protobuf-net.Core/WellKnownTypes/Timestamp.cs
- +0 −2 src/protobuf-net.Core/WireType.cs
- +3 −2 src/protobuf-net.MSBuild.Test/BuildTests.cs
- +1 −1 src/protobuf-net.MSBuild.Test/protobuf-net.MSBuild.Test.csproj
- +19 −0 src/protobuf-net.MSBuild/GenerateProtoBufCode.cs
- +9 −6 src/protobuf-net.MSBuild/build/protobuf-net.MSBuild.targets
- +118 −0 src/protobuf-net.NodaTime/NodaTimeExtensions.cs
- +119 −0 src/protobuf-net.NodaTime/NodaTimeSerializers.cs
- +15 −0 src/protobuf-net.NodaTime/protobuf-net.NodaTime.csproj
- +2 −2 src/protobuf-net.Protogen/protobuf-net.Protogen.csproj
- +12 −4 src/protobuf-net.Reflection.Test/Schemas/SchemaTests.cs
- +2 −2 src/protobuf-net.Reflection.Test/Schemas/google/protobuf/duration.proto
- +12 −3 src/protobuf-net.Reflection.Test/Schemas/google/protobuf/timestamp.proto
- +17 −12 src/protobuf-net.Reflection.Test/Schemas/google/type/date.proto
- +3 −3 src/protobuf-net.Reflection.Test/Schemas/google/type/dayofweek.proto
- +5 −4 src/protobuf-net.Reflection.Test/Schemas/google/type/timeofday.proto
- +14 −0 src/protobuf-net.Reflection.Test/Schemas/nodatime.proto
- +48 −0 src/protobuf-net.Reflection.Test/Schemas/opentelemetry/proto/collector/logs/v1/logs_service.proto
- +45 −0 ...otobuf-net.Reflection.Test/Schemas/opentelemetry/proto/collector/metrics/v1/metrics_service.proto
- +45 −0 src/protobuf-net.Reflection.Test/Schemas/opentelemetry/proto/collector/trace/v1/trace_service.proto
- +77 −0 src/protobuf-net.Reflection.Test/Schemas/opentelemetry/proto/common/v1/common.proto
- +130 −0 src/protobuf-net.Reflection.Test/Schemas/opentelemetry/proto/logs/v1/logs.proto
- +529 −0 src/protobuf-net.Reflection.Test/Schemas/opentelemetry/proto/metrics/v1/metrics.proto
- +34 −0 src/protobuf-net.Reflection.Test/Schemas/opentelemetry/proto/resource/v1/resource.proto
- +261 −0 src/protobuf-net.Reflection.Test/Schemas/opentelemetry/proto/trace/v1/trace.proto
- +78 −0 src/protobuf-net.Reflection.Test/Schemas/opentelemetry/proto/trace/v1/trace_config.proto
- BIN src/protobuf-net.Reflection.Test/macosx/protoc
- +16 −5 src/protobuf-net.Reflection.Test/protobuf-net.Reflection.Test.csproj
- BIN src/protobuf-net.Reflection.Test/protoc.exe
- BIN src/protobuf-net.Reflection.Test/windows/protoc.exe
- +1 −1 src/protobuf-net.Reflection/CSharpCodeGenerator.cs
- +0 −2 src/protobuf-net.Reflection/NameNormalizer.cs
- +3 −2 src/protobuf-net.Reflection/Parsers.cs
- +1 −0 src/protobuf-net.Reflection/Properties/AssemblyInfo.cs
- +6 −3 src/protobuf-net.Reflection/google/protobuf/any.proto
- +2 −4 src/protobuf-net.Reflection/google/protobuf/api.proto
- +6 −1 src/protobuf-net.Reflection/google/protobuf/compiler/plugin.proto
- +1 −1 src/protobuf-net.Reflection/google/protobuf/descriptor.proto
- +1 −1 src/protobuf-net.Reflection/google/protobuf/duration.proto
- +1 −1 src/protobuf-net.Reflection/google/protobuf/empty.proto
- +1 −1 src/protobuf-net.Reflection/google/protobuf/field_mask.proto
- +1 −1 src/protobuf-net.Reflection/google/protobuf/source_context.proto
- +1 −1 src/protobuf-net.Reflection/google/protobuf/struct.proto
- +11 −2 src/protobuf-net.Reflection/google/protobuf/timestamp.proto
- +2 −2 src/protobuf-net.Reflection/google/protobuf/type.proto
- +1 −1 src/protobuf-net.Reflection/google/protobuf/wrappers.proto
- +57 −0 src/protobuf-net.Reflection/google/type/calendar_period.proto
- +170 −0 src/protobuf-net.Reflection/google/type/color.proto
- +50 −0 src/protobuf-net.Reflection/google/type/date.proto
- +97 −0 src/protobuf-net.Reflection/google/type/datetime.proto
- +51 −0 src/protobuf-net.Reflection/google/type/dayofweek.proto
- +51 −0 src/protobuf-net.Reflection/google/type/expr.proto
- +34 −0 src/protobuf-net.Reflection/google/type/fraction.proto
- +37 −0 src/protobuf-net.Reflection/google/type/latlng.proto
- +43 −0 src/protobuf-net.Reflection/google/type/money.proto
- +66 −0 src/protobuf-net.Reflection/google/type/month.proto
- +135 −0 src/protobuf-net.Reflection/google/type/postal_address.proto
- +95 −0 src/protobuf-net.Reflection/google/type/quaternion.proto
- +44 −0 src/protobuf-net.Reflection/google/type/timeofday.proto
- +3 −0 src/protobuf-net.Reflection/protobuf-net.Reflection.csproj
- +3 −3 src/protobuf-net.Test/CompatibilityLevelAmbientAutoTupleTests.cs
- +3 −3 src/protobuf-net.Test/CompatibilityLevelListsMaps.cs
- +6 −6 src/protobuf-net.Test/CompatibilityLevelTests.cs
- +1 −3 src/protobuf-net.Test/CustomScalarAllocator.cs
- +1 −1 src/protobuf-net.Test/Issues/CustomDictionaryWithIgnoreListHandling.cs
- +1 −1 src/protobuf-net.Test/Issues/Immutables.cs
- +174 −0 src/protobuf-net.Test/Issues/Issue536.cs
- +1 −1 src/protobuf-net.Test/Issues/Issue598.cs
- +1 −1 src/protobuf-net.Test/Issues/SO_InterestingFailures.cs
- +1 −1 src/protobuf-net.Test/ManualSerializer.cs
- +3 −3 src/protobuf-net.Test/Meta/Struct.cs
- +289 −0 src/protobuf-net.Test/NodaTimeTests.cs
- +2 −2 src/protobuf-net.Test/Serializers/Proto3Tests.cs
- +19 −16 src/protobuf-net.Test/Serializers/UriTests.cs
- +54 −2 src/protobuf-net.Test/ServiceSchemas.cs
- +9 −1 src/protobuf-net.Test/SpanReadTests.cs
- +5 −2 src/protobuf-net.Test/protobuf-net.Test.csproj
- +18 −0 src/protobuf-net.sln
- +5 −7 src/protobuf-net/Compiler/CompilerContext.cs
- +1 −1 src/protobuf-net/Compiler/CompilerContextScope.cs
- +47 −3 src/protobuf-net/Internal/Serializers/ExternalSerializer.cs
- +1 −1 src/protobuf-net/Internal/Serializers/IRuntimeProtoSerializerNode.cs
- +1 −1 src/protobuf-net/Internal/Serializers/SubItemSerializer.cs
- +31 −19 src/protobuf-net/Internal/Serializers/SurrogateSerializer.cs
- +25 −15 src/protobuf-net/Internal/Serializers/TypeSerializer.cs
- +157 −76 src/protobuf-net/Meta/MetaType.cs
- +209 −100 src/protobuf-net/Meta/RuntimeTypeModel.cs
- +17 −3 src/protobuf-net/Meta/ValueMember.cs
- +0 −3 src/protobuf-net/Serializer.Serialize.cs
- +27 −11 src/protobuf-net/Serializer.cs
- +2 −2 src/protogen.site.blazor.client/Models/GeneratorViewModel.cs
- +2 −3 src/protogen.site.blazor.client/Pages/Index.razor
- +2 −2 src/protogen.site.blazor.client/protogen.site.blazor.client.csproj
- +16 −19 src/protogen.site/Controllers/HomeController.cs
- +1 −6 src/protogen.site/protogen.site.csproj
- +8 −1 src/protogen/GrpcTools.cs
- +1 −2 src/protogen/Program.cs
- +2 −2 src/protogen/protogen.csproj
| @@ -4,6 +4,7 @@ | ||
| <ProjectReference Include="src\protobuf-net\*.csproj" /> | ||
| <ProjectReference Include="src\protobuf-net.Core\*.csproj" /> | ||
| <ProjectReference Include="src\protobuf-net.MSBuild\*.csproj" /> | ||
| <ProjectReference Include="src\protobuf-net.NodaTime\*.csproj" /> | ||
| <ProjectReference Include="src\protobuf-net.Protogen\*.csproj" /> | ||
| <ProjectReference Include="src\protobuf-net.Reflection\*.csproj" /> | ||
| <ProjectReference Include="src\protobuf-net.AspNetCore\*.csproj" /> | ||
| @@ -91,7 +91,7 @@ using (var file = File.OpenRead("person.bin")) { | ||
|
|
||
| ### Inheritance | ||
|
|
||
| Inheritance must be explicitly declared, in a similar way that if must for XmlSerializer and DataContractSerializer. This is done via [ProtoInclude(...)] on each type with known sub-types: | ||
| Inheritance must be explicitly declared, in a similar way that it must for XmlSerializer and DataContractSerializer. This is done via [ProtoInclude(...)] on each type with known sub-types: | ||
|
|
||
| ```csharp | ||
| [ProtoContract] | ||
| @@ -44,7 +44,7 @@ a simple update. A few niche features have changed or been removed - more detail | ||
| and [`protobuf-net.Core`](https://www.nuget.org/packages/protobuf-net.Core/), with the "Core" package having the main serializer API but none of the runtime reflection | ||
| code; this means that future AOT-only scenarios only require the "Core" package, and can omit the overhead of shipping any of the other code *at all*; you can see | ||
| this in action already at [protogen.marcgravell.com](https://protogen.marcgravell.com/), which uses the schema parting tools *and serializer core* in the client browser | ||
| (not at the web-server) via "Blazor"/WASM, via a dependency on `protobuf-net.Core` (a huge thanks once again to [Rémi BOURGAREL](https://github.com/RemiBou) here, who leant | ||
| (not at the web-server) via "Blazor"/WASM, via a dependency on `protobuf-net.Core` (a huge thanks once again to [Remi BOURGAREL](https://github.com/RemiBou) here, who leant | ||
| their Blazor expertise) | ||
|
|
||
| ## Changes To Existing Features | ||
| @@ -0,0 +1 @@ | ||
| theme: jekyll-theme-cayman |
| @@ -11,6 +11,17 @@ Packages are available on NuGet: [protobuf-net](https://www.nuget.org/packages/p | ||
| - 3.2: protogen support for emitting pre-coded custom serializers | ||
| - future: build-time tooling from code-first (aka "generators") | ||
|
|
||
| ## unreleased | ||
|
|
||
| - add new protobuf-net.NodaTime package that adds direct support for NodaTime primitives (note: this may be relocated to a NodaTime library) | ||
| - fix #700 - new APIs to allow surrogates to be defined externally, and to be implemented over primitive backing types | ||
| - fix #703 - new options on MSBuild targets (via Konstantin Sharon) | ||
| - fix #693 - new `IgnoreUnknownSubTypes` API on `[ProtoContract(...)]` and `MetaType`; serializes the types it *does* understand, and silently ignores the unknown sub-types | ||
| - fix #695 - JIT error when serialization callbacks declared at types other than the inheritance root | ||
| - fix #713 - work correctly with arrays (etc) of nullable enum types | ||
| - fix #697 - improve error reporting for invalid end-group markers | ||
| - fix #668 - additional non-generic APIs | ||
| - fix problem with protogen website not allowing imports | ||
|
|
||
| ## 3.0.24 | ||
|
|
||
| @@ -19,7 +19,7 @@ | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="BenchmarkDotNet" Version="0.12.1" /> | ||
| <PackageReference Include="Google.Protobuf" Version="3.12.3" /> | ||
| <PackageReference Include="Google.Protobuf" Version="3.12.4" /> | ||
| <ProjectReference Include="..\protobuf-net\protobuf-net.csproj" /> | ||
| <PackageReference Include="Pipelines.Sockets.Unofficial" Version="2.1.16" /> | ||
| <PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.7.1" /> | ||
| @@ -2,6 +2,7 @@ | ||
| // Consider using 'partial classes' to extend these types | ||
| // Input: my.proto | ||
|
|
||
| #pragma warning disable IDE0079 | ||
| #pragma warning disable CS1591, CS0612, CS0618, CS3021, IDE1006 | ||
| namespace protogen | ||
| { | ||
| @@ -105,4 +106,4 @@ public partial class OrderLine : global::ProtoBuf.IExtensible | ||
|
|
||
| } | ||
|
|
||
| #pragma warning restore CS1591, CS0612, CS0618, CS3021, IDE1006 | ||
| #pragma warning restore IDE0079, CS1591, CS0612, CS0618, CS3021, IDE1006 | ||
| @@ -19,7 +19,7 @@ | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="BenchmarkDotNet" Version="0.12.1" /> | ||
| <PackageReference Include="Google.Protobuf" Version="3.12.3" /> | ||
| <PackageReference Include="Google.Protobuf" Version="3.12.4" /> | ||
| <PackageReference Include="protobuf-net" Version="2.4.6" /> | ||
| <PackageReference Include="Pipelines.Sockets.Unofficial" Version="2.1.16" /> | ||
| <PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.7.1" /> | ||
| @@ -5,7 +5,7 @@ | ||
| <OutputType>Library</OutputType> | ||
| <SignAssembly>true</SignAssembly> | ||
| <DelaySign>False</DelaySign> | ||
| <NoWarn>NU5105;CS1701;BC42016</NoWarn> | ||
| <NoWarn>NU5105;CS1701;BC42016;IDE0057</NoWarn> | ||
| <AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)ProtoBuf.snk</AssemblyOriginatorKeyFile> | ||
| <Copyright>See https://github.com/protobuf-net/protobuf-net</Copyright> | ||
| <PackageLicenseExpression>Apache-2.0</PackageLicenseExpression> | ||
| @@ -31,8 +31,9 @@ | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="all" /> | ||
| <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/> | ||
| <PackageReference Include="Nerdbank.GitVersioning" Version="3.1.91" PrivateAssets="All" /> | ||
| <PackageReference Include="Nerdbank.GitVersioning" Version="3.2.31" PrivateAssets="All" /> | ||
| <!-- oh gawd, I'm just not emotionally prepared for this... | ||
| <PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.4"> | ||
| <PrivateAssets>all</PrivateAssets> | ||
| @@ -72,7 +72,7 @@ enum blah { | ||
| A = -1; | ||
| C = 1; | ||
| } | ||
| ", proto); | ||
| ", proto, ignoreLineEndingDifferences: true); | ||
| } | ||
|
|
||
|
|
||
| @@ -96,7 +96,7 @@ enum blah { | ||
| A = -1; | ||
| C = 1; | ||
| } | ||
| ", proto); | ||
| ", proto, ignoreLineEndingDifferences: true); | ||
| } | ||
|
|
||
| [Fact] | ||
| @@ -132,7 +132,7 @@ enum OutOfRangeEnum { | ||
| // F = -2147483649; // note: enums should be valid 32-bit integers | ||
| } | ||
| */ | ||
| ", proto); | ||
| ", proto, ignoreLineEndingDifferences: true); | ||
| } | ||
|
|
||
| public enum InRangeEnum : long | ||
| @@ -181,7 +181,7 @@ enum blah { | ||
| A = -1; | ||
| C = 1; | ||
| } | ||
| ", proto); | ||
| ", proto, ignoreLineEndingDifferences: true); | ||
| } | ||
|
|
||
| [Fact] | ||
| @@ -17,16 +17,18 @@ | ||
| <ProjectReference Include="..\protobuf-net.MessagePipes\protobuf-net.MessagePipes.csproj" /> | ||
| <ProjectReference Include="..\protobuf-net\protobuf-net.csproj" /> | ||
| <ProjectReference Include="..\protobuf-net.Reflection\protobuf-net.Reflection.csproj" /> | ||
| <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" /> | ||
| <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.0" /> | ||
| <PackageReference Include="System.Threading.Channels" Version="4.7.1" /> | ||
| <PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> | ||
| <PackageReference Include="System.Collections.Immutable" Version="1.7.1" /> | ||
| <PackageReference Include="System.ValueTuple" Version="4.5.0" /> | ||
| <PackageReference Include="xunit" Version="2.4.1" /> | ||
| <PackageReference Include="xunit.runner.visualstudio" Version="2.4.2"> | ||
| <PackageReference Include="xunit.runner.visualstudio" Version="2.4.3"> | ||
| <PrivateAssets>all</PrivateAssets> | ||
| <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> | ||
| </PackageReference> | ||
| <PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" /> | ||
| <PackageReference Include="Xunit.SkippableFact" Version="1.4.13" /> | ||
| </ItemGroup> | ||
| <ItemGroup Condition="$(TargetFramework)=='net462'"> | ||
| <PackageReference Include="NHibernate" Version="4.1.1.4000" /> | ||
| @@ -4,6 +4,7 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Linq; | ||
| using System.Runtime.InteropServices; | ||
| using System.Text; | ||
| using System.Windows.Media; | ||
| using Xunit; | ||
| @@ -36,25 +37,36 @@ public class TypeWithColor | ||
| public Color Color { get; set; } | ||
| } | ||
|
|
||
| [Fact] | ||
| [SkippableFact] | ||
| public void TestMediaColorDirect() | ||
| { | ||
| var model = RuntimeTypeModel.Create(); | ||
| model.Add(typeof(Color), false).Add("A","R","G","B"); | ||
| Skip.IfNot(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)); | ||
| AvoidJit(); | ||
| static void AvoidJit() | ||
| { | ||
| var model = RuntimeTypeModel.Create(); | ||
| model.Add(typeof(Color), false).Add("A", "R", "G", "B"); | ||
|
|
||
| RoundtripTypeWithColor(model); | ||
| RoundtripTypeWithColor(model); | ||
| } | ||
| } | ||
|
|
||
| [Fact] | ||
| [SkippableFact] | ||
| public void TestMediaColorSurrogate() | ||
| { | ||
| var model = RuntimeTypeModel.Create(); | ||
| model.Add(typeof(Color), false).SetSurrogate(typeof(MyColor)); | ||
| Skip.IfNot(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)); | ||
| AvoidJit(); | ||
|
|
||
| RoundtripTypeWithColor(model); | ||
| static void AvoidJit() | ||
| { | ||
| var model = RuntimeTypeModel.Create(); | ||
| model.Add(typeof(Color), false).SetSurrogate(typeof(MyColor)); | ||
|
|
||
| RoundtripTypeWithColor(model); | ||
| } | ||
| } | ||
|
|
||
| private void RoundtripTypeWithColor(RuntimeTypeModel model) | ||
| private static void RoundtripTypeWithColor(RuntimeTypeModel model) | ||
| { | ||
| var orig = new TypeWithColor | ||
| { | ||
| @@ -105,7 +105,7 @@ enum E { | ||
| V1 = 1; | ||
| V2 = 2; | ||
| } | ||
| ", schema); | ||
| ", schema, ignoreLineEndingDifferences: true); | ||
| } | ||
|
|
||
| [Fact] | ||
| @@ -133,7 +133,7 @@ enum E { | ||
| message List_E { | ||
| repeated E items = 1; | ||
| } | ||
| ", schema); | ||
| ", schema, ignoreLineEndingDifferences: true); | ||
| } | ||
|
|
||
| private static void TestArray(TypeModel model) | ||
| @@ -40,7 +40,7 @@ public void TestEntireModel_Proto2() | ||
| } | ||
| ", | ||
|
|
||
| model.GetSchema(null, ProtoSyntax.Proto2) | ||
| model.GetSchema(null, ProtoSyntax.Proto2), ignoreLineEndingDifferences: true | ||
|
|
||
| ); | ||
| } | ||
| @@ -66,7 +66,7 @@ public void TestEntireModel_Proto3() | ||
| } | ||
| ", | ||
|
|
||
| model.GetSchema(null, ProtoSyntax.Proto3) | ||
| model.GetSchema(null, ProtoSyntax.Proto3), ignoreLineEndingDifferences: true | ||
|
|
||
| ); | ||
| } | ||
| @@ -143,7 +143,7 @@ public void TestInheritanceStartingWithBaseType() | ||
| } | ||
| ", | ||
|
|
||
| model.GetSchema(typeof(Animal), ProtoSyntax.Proto2) | ||
| model.GetSchema(typeof(Animal), ProtoSyntax.Proto2), ignoreLineEndingDifferences: true | ||
|
|
||
| ); | ||
| } | ||
| @@ -166,7 +166,7 @@ public void TestInheritanceStartingWithDerivedType() | ||
| } | ||
| ", | ||
|
|
||
| model.GetSchema(typeof(Animal), ProtoSyntax.Proto2) | ||
| model.GetSchema(typeof(Animal), ProtoSyntax.Proto2), ignoreLineEndingDifferences: true | ||
|
|
||
| ); | ||
| } | ||
| @@ -19,7 +19,7 @@ public void DefaultValuesForBoolMustBeLowerCase() | ||
| } | ||
| ", | ||
|
|
||
| Serializer.GetProto<Foo>(ProtoSyntax.Proto2) | ||
| Serializer.GetProto<Foo>(ProtoSyntax.Proto2), ignoreLineEndingDifferences: true | ||
|
|
||
| ); | ||
| } | ||
| @@ -25,7 +25,7 @@ public void TestTuple() | ||
| message Foo { | ||
| map<int32,string> Lookup = 1; | ||
| } | ||
| ", schema); | ||
| ", schema, ignoreLineEndingDifferences: true); | ||
| } | ||
|
|
||
| [ProtoContract] | ||
| @@ -33,7 +33,7 @@ public void Execute() | ||
| message Dog { | ||
| optional string OwnerName = 1; | ||
| } | ||
| ", proto); | ||
| ", proto, ignoreLineEndingDifferences: true); | ||
| } | ||
|
|
||
| [ProtoContract] | ||
| @@ -30,7 +30,7 @@ public void Execute() | ||
| message BinarySerializationSurrogate_MyException { | ||
| optional bytes objectData = 1; | ||
| } | ||
| ", proto); | ||
| ", proto, ignoreLineEndingDifferences: true); | ||
| } | ||
|
|
||
| class MyException : Exception { } | ||
| @@ -59,7 +59,7 @@ enum ETheoFlags { | ||
| message Foo { | ||
| optional ETheoFlags Flags = 1 [default = TF_P]; | ||
| } | ||
| ", proto); | ||
| ", proto, ignoreLineEndingDifferences: true); | ||
| } | ||
| } | ||
| } | ||
| @@ -5,7 +5,7 @@ | ||
| // </auto-generated> | ||
|
|
||
| #region Designer generated code | ||
| #pragma warning disable CS0612, CS0618, CS1591, CS3021, IDE1006, RCS1036, RCS1057, RCS1085, RCS1192 | ||
| #pragma warning disable CS0612, CS0618, CS1591, CS3021, IDE0079, IDE1006, RCS1036, RCS1057, RCS1085, RCS1192 | ||
| namespace ProtoBuf.Issues.Issue647Types.Bar | ||
| { | ||
|
|
||
| @@ -54,5 +54,5 @@ public partial class FooClass : global::ProtoBuf.IExtensible | ||
|
|
||
| } | ||
|
|
||
| #pragma warning restore CS0612, CS0618, CS1591, CS3021, IDE1006, RCS1036, RCS1057, RCS1085, RCS1192 | ||
| #pragma warning restore CS0612, CS0618, CS1591, CS3021, IDE0079, IDE1006, RCS1036, RCS1057, RCS1085, RCS1192 | ||
| #endregion | ||
| @@ -51,7 +51,7 @@ public void GeneratedCodeIncludesNamespaces() | ||
| }).Single().Text; | ||
| Log(actualCsharp); | ||
|
|
||
| var expectedCsharp = File.ReadAllText(@"Issues\Issue647.Generated.cs"); | ||
| var expectedCsharp = File.ReadAllText(@"Issues/Issue647.Generated.cs"); | ||
| Assert.Equal(expectedCsharp, actualCsharp, ignoreLineEndingDifferences: true); | ||
| } | ||
| } | ||
Oops, something went wrong.