Граф коммитов

828 Коммитов

Автор SHA1 Сообщение Дата
Christopher Warrington ab4d029ca8 [grpc] Remove PingLayerData from gRPC compat test
PingLayerData was used in the old Bond Comm compat test, but is not
needed for the gRPC compat test.
2017-09-29 11:25:24 -07:00
Christopher Warrington 554125145d [c++ grpc] Drop client callback after executing
After executing the client callback upon receiving a response, clear the
stored callback to prevent a shared_ptr cycle.

Previously, when the callback function was not cleared, if the callback
happened to store the unary_call_result that it was invoked with (like
wait_callback does), there would be a shared_ptr cycle: the callback
would have a shared_ptr to the unary_call_result, which was keeping its
parent client_unary_call_data alive. This client_unary_call_data had a
copy of the callback function, which had a shared_ptr to the
unary_call_result.

This change resets the callback to empty after is has been executed,
breaking the cycle.
2017-09-28 13:53:10 -07:00
Chad Walters f96af1ffe1 Fix service/method attributes in C# and C++
In C#, attributes are now carried across to the service class and its
member methods. In C++, gRPC-based services now have compile-time metadata
with appropriate attribute support.

Fixes https://github.com/Microsoft/bond/issues/617
Closes https://github.com/Microsoft/bond/pull/618
2017-09-27 16:51:30 -07:00
Chad Walters 5f8058753e Add service attribute codegen tests for C# 2017-09-22 11:15:00 -07:00
Christopher Warrington 52a008516c [c++] Guard against min/max being function macros
Sometimes min/max are function-style macros, which interferes with use
of things like std::numeric_limits::max() and std::min(). An extra set
of parenthesis guards against this.
2017-09-22 11:12:55 -07:00
Chad Walters 42483908e2 [C++] Additional security fixes in SimpleArray
Also, extend checked_add tests.
2017-09-18 11:25:52 -07:00
Christopher Warrington afc6e9c230 [c++] Switch to std::to_string in string_stream
When using MSVC, even with _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES and
_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT enabled, sometimes the
non-sprint_s overload is chosen when a stack buffer is used (the
array-to-pointer decay and the array-of-size-N template are competing
with each other, and the char* overload wins instead of the template).

To avoid, switch to using std::to_string to format things in the
string_stream that is used to compute exception messages.
2017-09-18 11:09:44 -07:00
Christopher Warrington 8281c9f044 [c++] Check string lens in container_extensibility 2017-09-18 11:03:24 -07:00
Chad Walters 1c7165e1f4 Update third-party notices with gRPC and more
Adds appropriate attribution for gRPC and libraries used within gRPC.
2017-09-15 17:03:27 -07:00
Ara Ayvazyan 2bb2d7ea90 [c++] Assign nullptr to pointer after delete in bond::detail::any 2017-09-15 11:28:12 -07:00
Christopher Warrington 6bb107e4f3 [c++] Use boost::format instead of sprintf in tests
When using MSVC, even with _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES and
_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT enabled, sometimes the
non-sprint_s overload is chosen when a stack buffer is used (the
array-to-pointer decay and the array-of-size-N template are competing
with each other, and the char* overload wins instead of the template).

To avoid, switch to using boost::format to format string in tests.
2017-09-12 15:06:35 -07:00
Christopher Warrington e27cfa882d [c++] Suppress MSVC warning 4310 locally
Instead of suppressing warning C4310 on the command line, we now
suppress it just where we need the truncation behavior.
2017-09-12 15:06:18 -07:00
Christopher Warrington 7b978c0d0d [c++] Suppress unavoidable warnings
In the required_fields_tests, some unavoidable compiler warnings are
emitted. These are now suppressed at the file level.

* Since we're explicitly testing some exceptional code paths, some
  expansions of StaticParser are expected to produce unreachable code.
* Some of the type names for the boost::mpl::list of schema fields in
  these tests are too long for MSVC to handle without truncation.
2017-09-12 15:05:03 -07:00
Christopher Warrington d017dc4403 [gbc] Enable NX and limited ASLR for Windows builds
For Windows builds, pass linker flags to enable NX and as much of ASLR
as we can.
    * We cannot move the base address above 4GiB, as the GHC runtime
      libraries are not compiled to support this.
    * The linker used by GHC doesn't support keeping reloc information
      when emitting PE32+ executables. This will end up limiting the
      effectiveness of ASLR, but we're doing what we can.
2017-09-12 15:03:26 -07:00
Christopher Warrington e2f74ee413 [c++] Use RapidJSON's iterative parser
Use RapidJSON's iterative parser to handle deeply nested JSON data
without causing a stack overflow.

Added a unit test with a deeply nested JSON array to test this.
2017-09-12 15:02:41 -07:00
Chad Walters 04a5cb5662 [c++] Check for memory allocation overflow errors
Detect overflow errors related to memory allocation and memory access,
specifically in: bond::OutputMemoryStream, bond::blob, and
bond::detail::SimpleArray.
2017-09-08 14:05:12 -07:00
Christopher Warrington bd9f8b2ab4 [doc] Fix typos in Bond-over-gRPC documentation 2017-09-08 11:26:14 -07:00
Ted Stein ec14c17ae6 c++ clang: Compile -Wno-null-dereference
This is a mitigation for issue
https://github.com/Microsoft/bond/issues/536. A proper fix is still
needed.

Closes https://github.com/Microsoft/bond/pull/598
2017-09-07 14:02:07 -07:00
Christopher Warrington 1127832811 [c++] Fix some MSVC static analysis issues
* `isspace` takes ints, not chars, so promote.
* Instead of dealing with a potentially non-null terminated string when
  finding a field by ordinal in Simple JSON, attempt to parse the field
  ID and then compare the numeric values.
* Indicate that the `die` function never returns so that the analyzer
  can tell that we've checked for things like malloc returning null.
* The printf format string for unsigned ints is u, not d.
* Disable the code analysis warning C6326, "constant constant
  comparison". A lot of our template functions trigger this when they do
  things like: if (T == traits<U>::some_value) { ... } else { ... }
2017-08-24 15:35:07 -07:00
Christopher Warrington 5c6c8ea51e [c#] Always serialize DateTime as UTC
In order to avoid round-tripping problems due to changing local time
zones, the DateTime example now serializes and deserializes DateTime
instances as UTC.

This does mean, that if you have a Local DateTime that you round-trip,
you will get back a UTC DateTime instead. This is better expected
behavior than random time zone offset changes.
2017-08-24 15:34:50 -07:00
Chad Walters 9394d82720 [c#] Fix interaction with CBv2 and bonded fields
Serialization of bonded fields was interacting with the state in the
CompactBinaryWriter because it triggered first-pass again. This fix
prevents the first-pass writer from being returned in the middle of the
second pass.
2017-08-21 16:30:23 -07:00
Christopher Warrington 9639030f53 [c#] Append to list in serialization example
The previous code in the serialization example created a new
List<double> for the vector<double> field `items`, implying that the
field was not initialized to an empty List<double>.

Since the `items` field is initialized to an empty list, we now just
append to the existing list.
2017-08-14 17:22:55 -07:00
Ted Stein 8c9f427d08 c# core: Add documentation for untagged bonded. 2017-08-14 11:13:58 -07:00
Ted Stein b1c16dcada c# core: Fix a typo in simple binary documentation. 2017-08-14 11:13:58 -07:00
Ted Stein 5709676706 c++ core: Add documentation for untagged bonded. 2017-08-14 11:13:58 -07:00
Ted Stein f09b047212 c++ core: Fix a typo in simple binary documentation. 2017-08-14 11:13:58 -07:00
Christopher Warrington 5391636d5b Indicate that version 6.0.1 was not used. 2017-08-07 13:51:20 -07:00
Christopher Warrington a42b2938a9 [linux] Add haskell-stack to prerequisites list 2017-08-02 17:07:46 -07:00
Christopher Warrington 3cb9469a5a [c++] Fix G++ 5.4 errors
* Deserialize was used as the name for both a struct and a member
  function. This causes some versions of G++ to emit errors, so rename
  the helper struct. Fixes https://github.com/Microsoft/bond/issues/538
* The Protocols template argument could not be deduced in one place
  where bond::SelectProtocolAndApply was called. It is now explicitly
  specified.
2017-08-02 17:06:23 -07:00
Christopher Warrington 6478f4b538 Skip gRPC for initial build on macOS in README
Also, lay out the CMake commands following the template that `cmake
--help` documents: `cmake [options] <path-to-source>`

Partial fix for https://github.com/Microsoft/bond/issues/535
2017-07-25 16:27:47 -07:00
Christopher Warrington 0b22da6371 [c++] Fix potential simultaneous codegen
In some CMakeLists.txt files, codegen was being run on the same .bond
files multiple times. Depending on build scheduling, this could result
in build failures (if the generation were to happen at the same time) or
spurious rebuilds (due to spurious rewrites of the generated files).

Now, .bond files that are shared across targets within the same
directory are generated once and compiled into a static library that is
then linked into all the consumers.

Since we're compiling the .bond files into a static library, we can take
advantage of the _apply.cpp precompilation as well.
2017-07-21 12:08:47 -07:00
Christopher Warrington 1907803169 [c#] Handle non-seekable streams in InputStream
InputStream would always try to call Stream.Seek when it needed to skip
over some bytes in the underlying stream, even if the stream didn't
support Seek.

Now, it checks whether the stream can seek. If not, it makes dummy Read
calls to advance the underlying stream.

Regression test added, and all the implementations of IInputStream that
ship with Bond are tested against these tests.

Existing InputStream tests folded into these IInputStreams tests, and
tested against both seekable and non-seekable streams.

Fixes https://github.com/Microsoft/bond/issues/498
2017-07-18 13:14:35 -07:00
Eduardo Salinas 0310220c3f [msbuild] Find gbc in a clean build
- Correctly find the just compiled gbc
- Add fail condition to appveyor CI
- Closes https://github.com/Microsoft/bond/issues/526
2017-07-12 19:05:38 -07:00
Chad Walters 350e0d7bb0 [c#] Fully support uint64 in JSON when possible
Use Newtonsoft's JSON.NET BigInteger support -- when available -- to
handle the full range of uint64 values in the SimpleJson protocol (.NET
4.5 or greater, .NET Standard 1.6 or greater).
2017-07-12 18:50:58 -07:00
Chad Walters d80983ac3f [c++] Fix SimpleJSON map deserializtion
Correctly handle issues when deserializing invalid map data in
SimpleJSON protocol, specifically:

* When keys aren't of primitive type
* When there isn't a matching value for evey key

Also:

* Change bond::basic_string_stream operator << to support various forms
  of std::basic_string<char>
* Fix ElementNotFoundException to work with wstrings
2017-07-12 14:36:28 -07:00
Chad Walters 3d67501110 [c++] Address failure in JSON Unicode conversion
Throw a bond::CoreException insteand of a Boost exception when Unicode
conversion fails during JSON deserialization to wstring.
2017-07-12 14:36:18 -07:00
Ted Stein e90294c562 [c++] Don't build Comm by default 2017-07-12 14:28:44 -07:00
Chad Walters 3f0cbdbd25 Update README for Win C++ Core build without gRPC 2017-07-11 17:03:10 -07:00
Chad Walters f49eba5247 [c#] Fix Reflection.IsBonded for custom impls
Reflection.IsBonded now correctly returns true for custom IBonded
implementations. In addition, corrected reversed logic in test utility
code that was likely related to the incorrect predicate.
2017-07-11 13:42:30 -07:00
Christopher Warrington 0236301fe8 Link to issues in the changelog 2017-06-29 21:23:41 -07:00
Christopher Warrington 82e7dad616 Update Nuget test to version 6.0.0
* Use new version of packages
* Switch solution to use Visual Studio 2015
* Removed Visual Studio 2012/2013 cruft from csproj file.
* Re-sync test files with the core test.
* Fix up some tests that access internal variables that can be accessed
  using public properties.
2017-06-29 20:43:28 -07:00
Christopher Warrington 2435544269 Update changelog for 6.0.0 release 2017-06-29 17:06:06 -07:00
Ted Stein fe3135cc4a [c#] JSON/XML: Throw on null, non-nullable strings
Resolves https://github.com/Microsoft/bond/issues/417
Closes https://github.com/Microsoft/bond/pull/515
2017-06-29 14:40:31 -07:00
Chad Walters 31211e1070 [C#] Remove .NET 4.5 reflection shim
The reflection shim adapting across .NET 4.0 and .NET 4.5 is no longer
needed now that support for .NET v4.0 has been removed.
2017-06-29 13:24:14 -07:00
Chad Walters 3bbe401069 [C#] Remove support for .NET 4.0 2017-06-29 13:24:14 -07:00
Christopher Warrington 6969b59b74 [c#] Stamp version info into Bond assemblies
Support for embedding assembly and file version information has been
added to the MSBuild and .NET Core builds.

When building Bond, if the environment variable BOND_CORE_VERSION (or,
for Bond Comm, BOND_COMM_VERSION) is set to a valid NuGet package
version string, the generated assemblies will have versions details
embedded in them as well.

* For developer builds without any version set, the version 0.0.0.1 will
  be used.
* For pre-release builds (versions of the form x.y.z-someTag), the
  version x.y.z.0 will be used.
* For release builds (version of the form x.y.z), the version x.y.z.100
  will be used.

Fixes https://github.com/Microsoft/bond/issues/325
Closes https://github.com/Microsoft/bond/pull/514
2017-06-29 08:40:43 -07:00
Eduardo Salinas 0c06fbbddf [appveyor] Remove duplicate entry 2017-06-27 11:33:33 -07:00
Eduardo Salinas 52dbdb0ba8 [gbc] Migrate from cabal to stack
- cmake will use stack instead of cabal to
  build gbc
- update readme
- unpin ansi-terminal version
2017-06-26 20:53:28 -07:00
Christopher Warrington 0bce7292c0 [c#] Improve codegen targets comments 2017-06-26 15:46:53 -07:00
Christopher Warrington 100a1b5028 [c#] Re-run codegen when gbc itself is updated 2017-06-26 15:46:48 -07:00