Commit Graph

537 Commits

Author SHA1 Message Date
Adam Cozzette
9d64d740a1 Removed duplicate using statement from ReflectionUtil.cs 2018-05-29 14:29:59 -07:00
Jisi Liu
45eb28b588 Update version number to 3.6.0 2018-05-14 16:06:22 -07:00
Paul Yang
b61dd9d9a2
Add file option php_metadata_namespace and ruby_package (#4609) 2018-05-11 13:57:06 -07:00
David Chennells
513b35dc4e Add VS2017 optional component dependency details to the C# readme (#4128)
Add mention to the "Build" section of the ReadMe of the requirement of installing an optional component to VS2017.
2018-05-03 15:59:36 -07:00
Jon Skeet
1b219a174c Fix to allow AOT compilers to play nicely with reflection
With this fix, Unity using IL2CPP should work with one of two
approaches:

- Call `FileDescriptor.ForceReflectionInitialization<T>` for every
  enum present in generated code (including oneof case enums)
- Ensure that IL2CPP uses the same code for int and any int-based
  enums

The former approach is likely to be simpler, unless IL2CPP changes
its default behavior. We *could* potentially generate the code
automatically, but that makes me slightly uncomfortable in terms of
generating code that's only relevant in one specific scenario. It
would be reasonably easy to write a tool (separate from protoc) to
generate the code required for any specific set of assemblies, so
that Unity users can include it in their application. We can always
decide to change to generate it automatically later.
2018-04-27 16:47:46 +01:00
Sydney Acksman
4ca46ede5c Write messages to backing field in generated C# cloning code (#4440)
* Edited MessageFieldGenerator to clone to backing field instead of property

* Generated C# proto code
2018-04-19 11:57:31 -07:00
Jon Skeet
da3ce67171 Deliberately call simple code to avoid Unity linker pruning
The SampleEnumMethod method was previously only called via
reflection, so the Unity linker thought it could be removed. Ditto
the parameterless constructor in ReflectionHelper.

This PR should avoid that issue, reducing the work needed by
customers to use Google.Protobuf from Unity.
2018-04-06 08:05:32 +01:00
Feng Xiao
e7e6c6b8d1
Merge pull request #4283 from ObsidianMinor/csharp/better-test-runners
[C#] Update test project to be used with dotnet test and Visual Studio Test Explorer
2018-04-04 17:01:09 -07:00
ObsidianMinor
f72ac9f987 Updated csharp/README.md to reflect testing changes 2018-04-04 16:04:12 -05:00
Paul Yang
c931743461
Merge branch (#4466)
* Fix setup.py for windows build.

* Bump version number to 3.5.2

* Cat the test-suite.log on errors for presubits
2018-04-02 15:55:28 -07:00
Jon Skeet
9c05c35341 Address review comments 2018-03-27 10:17:44 +01:00
Jon Skeet
8e23d4e49c Work around an "old runtime" issue with reflection
For oneofs, to get the case, we need to call the property that
returns the enum value. We really want it as an int, and modern
runtimes allow us to create a delegate which returns an int from the
method. (I suspect that the MS runtime has always allowed that.)
Old versions of Mono (e.g. used by Unity3d) don't allow that, so we
have to convert the enum value to an int via boxing. It's ugly, but
it should work.
2018-03-27 08:42:27 +01:00
Jon Skeet
aa59eaa77b Introduce a compatiblity shim to support .NET 3.5 delegate creation 2018-03-27 08:42:27 +01:00
Jon Skeet
8ba420f040 Change C# reflection to avoid using expression trees
This should work on Unity, Mono and .NET 3.5 as far as I'm aware.
It won't work on platforms where reflection itself is prohibited,
but that's a non-starter basically.
2018-03-27 08:42:26 +01:00
Adam Cozzette
ed4321d1cb
Merge pull request #4387 from acozzette/down-integrate
Integrated internal changes from Google
2018-03-20 16:14:32 -07:00
Feng Xiao
88a4884b55
Merge pull request #4345 from jskeet/list-json-null
Allow null value in JSON representation of ListValue
2018-03-20 15:19:42 -07:00
Adam Cozzette
b1216d95db Updated checked-in generated code 2018-03-14 11:17:06 -07:00
Jon Skeet
822b924d59 Allow list values to be null when parsing 2018-03-01 13:20:40 +00:00
ObsidianMinor
e823897005 Updated NUnit packages, removed NUnitLite added packages for dotnet and Visual Studio, changed dotnet command in buildall to dotnet test, and deleted Program.cs (because it's no longer required). 2018-02-06 12:59:20 -06:00
John Brock
864df890a7 Remove 64MB memory limit when deserializing messages in C#
Increased `CodedInputStream.DefaultSizeLimit` to `Int32.MaxValue` to make it consistent with the Java implementation.
2018-01-31 14:08:02 -08:00
Jon Skeet
0c52335587 Update .NET SDK to 2.0.3
This will allow SourceLink as per #4179, and mean that we can use C#
7.0 language features in the library (but not in generated code).
This does not affect which platforms we're *targeting*, so end users
won't see any difference.

It would be nice to update to 2.1.4, but AppVeyor's "Visual Studio
2017" environment is only 2.0.3.
2018-01-25 19:42:15 +00:00
Jon Skeet
47b7d2c7ca Add DiscardUnknownFields support for C#
By default, unknown fields are preserved when parsing. To discard
them, use a parser configured to do so:

var parser = MyMessage.Parser.WithDiscardUnknownFields(true);
2018-01-15 02:53:45 -05:00
Jisi Liu
383a4941d5 Merge remote-tracking branch 'origin/3.5.x' into master 2018-01-03 09:28:40 -08:00
Jisi Liu
d106399d39
Merge pull request #4072 from google/jieluo
Cherrypick for csharp, including:
2017-12-19 17:45:56 -08:00
Jie Luo
b308580bb1 Cherrypick for csharp, including:
Add preserve UnknownFields
Compare floating point values bitwise
Add auto-generated header to C# generated files
2017-12-19 15:38:02 -08:00
Jisi Liu
050fc9a437 Update version number to 3.5.1 2017-12-19 11:00:33 -08:00
Jan Tattermusch
426cf6f31e Add auto-generated header to C# generated files (#4038)
* Add auto-generated header to C# generated files

* regenerate C# protos
2017-12-13 14:36:29 -08:00
Jie Luo
bfd254e14f
Add unknown field support for csharp (#3936)
Add unknown field support for csharp
2017-12-13 13:48:58 -08:00
Feng Xiao
75eceb8424 Update generated code. 2017-12-12 14:57:34 -08:00
Jon Skeet
31c54d1289 Regenerated code from previous C# codegen commit
With this in place, all tests should pass.

Fixes #3725.
2017-12-09 09:49:24 +00:00
Jon Skeet
f3e9a65d75 Compare floating point values bitwise in C#
This is the manual code part of the Google.Protobuf library, and tests.
Some tests will fail until codegen is changed and rerun.
2017-12-09 09:49:24 +00:00
Adam Cozzette
0ba8eea655 Merge branch 'master' into down-integrate 2017-12-01 10:05:19 -08:00
Adam Cozzette
92a7e778e7 Integrated internal changes from Google 2017-12-01 10:05:10 -08:00
Adam Cozzette
a27da09339 Merge branch '3.5.x' into 3.5.x-merge 2017-11-30 13:34:51 -08:00
Jie Luo
6d6099553b
Update csharp version number (#3958) 2017-11-29 16:10:44 -08:00
Jon Skeet
74f64b667c Fix JsonTokenizer exception message 2017-11-29 07:14:57 +00:00
Jon Skeet
91ff83c024 Remove non-C# options from C#-only test protos 2017-11-14 07:31:59 +00:00
Jon Skeet
8cf53f8dfc MMinor fix-ups to C# tests from changes in earlier commits 2017-11-12 15:29:15 +00:00
Jon Skeet
b5cdf0eac6 Regenerated test code for C# 2017-11-12 15:29:15 +00:00
Jon Skeet
aa77eab622 Move C#-only test protos to csharp/protos
unittest_proto3 had been changed in a very backward-incompatible
way which was never going to work with C# as it imports proto2 messages.

This is now a copy of the old file, but with a package name change for
compatibility with the remaining files in src/google/protobuf.

The other moves are for files that are only used by C#.
2017-11-12 15:29:15 +00:00
Jan Tattermusch
5f96191459 ParseFrom<T> for array slice is missing 2017-11-10 09:01:32 +01:00
Jan Tattermusch
4a5e1bd043 check already performed by MergeFrom 2017-11-10 09:01:07 +01:00
Jan Tattermusch
435f61102b allow message parsing from an array slice 2017-11-10 09:00:52 +01:00
Jan Tattermusch
30b6e54327 ParseFrom<T> for array slice is missing 2017-11-09 18:33:15 +01:00
Jan Tattermusch
07542e78da check already performed by MergeFrom 2017-11-09 18:27:45 +01:00
Jan Tattermusch
0c874a6a19 allow message parsing from an array slice 2017-11-09 14:23:14 +01:00
Jisi Liu
97dd175a91 Update version number to 3.5.0 2017-11-02 14:16:22 -07:00
Jon Skeet
cbe250591f Fix merging with message-valued oneof
If messages A and B have the same oneof case, which is a message
type, and we merge B into A, those sub-messages should be merged.

Fixes #3200.

Note that I haven't regenerated all the code, as some of the protos
have been changed, breaking generation.
2017-10-31 17:11:40 -07:00
xuwei-k
05b56d01c1 update joda-time javadoc url 2017-10-30 17:48:54 +09:00
Jon Skeet
e8c9ae1209 Add parser settings WithXyz methods 2017-10-28 07:47:43 +01:00