- Notifications
You must be signed in to change notification settings - Fork173
MessagePack implementation for Common Language Infrastructure / msgpack.org[C#]
License
msgpack/msgpack-cli
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
| Configuration | Status |
|---|---|
| Release | |
| Debug (.NET Core 2.0) | |
| Debug (.NET Core 2.0) | |
| Debug (.NET Framework 4.x) | |
| Debug (Code DOM)] | |
| Debug (miscs)] | |
| Debug (.NET Framework 3.5) | |
| Debug (.NET Framework 3.5 Code DOM) |
This is MessagePack serialization/deserialization for CLI (Common Language Infrastructure) implementations such as .NET Framework, Silverlight, Mono (including Moonlight.)This library can be used from ALL CLS compliant languages such as C#, F#, Visual Basic, Iron Python, Iron Ruby, PowerShell, C++/CLI or so.
You can serialize/deserialize objects as following:
- Create serializer via
MessagePackSerializer.Getgeneric method. This method creates dependent types serializers as well. - Invoke serializer as following:
Packmethod with destinationStreamand target object for serialization.Unpackmethod with sourceStream.
// Creates serializer.varserializer=MessagePackSerializer.Get<T>();// Pack obj to stream.serializer.Pack(stream,obj);// Unpack from stream.varunpackedObject=serializer.Unpack(stream);
' Creates serializer.Dimserializer=MessagePackSerializer.Get(OfT)()' Pack obj to stream.serializer.Pack(stream,obj)' Unpack from stream.DimunpackedObject=serializer.Unpack(stream)
For production environment, you should instantiate ownSerializationContext and manage its lifetime. It is good idea to treat it as singleton becauseSerializationContext is thread-safe.
- Fast and interoperable binary format serialization with simple API.
- Generating pre-compiled assembly for rapid start up.
- Flexible MessagePackObject which represents MessagePack type system naturally.
Note: AOT support is limited yet. Useserializer pre-generation withmpu -s utility or API.
If you do not pre-generated serializers, MsgPack for CLI uses reflection in AOT environments, it is slower and it sometimes causes AOT related error (ExecutionEngineException for runtime JIT compilation).You also have to callMessagePackSerializer.PrepareType<T> and companions in advance to avoid AOT related error. Seewiki for details.
Seewiki
- Binary files distributed via the NuGet packageMsgPack.Cli.
- You can extract binary (DLL) file as following:
- Download *.zip file fromGitHub Release page.
- Extract it.
- Under the
bindirectory, binaries are there!
- For mono, you can use
net461ornet35drops as you run with. - For Unity,
unity3ddrop is suitable.
Install Visual Studio 2017 (Community edition is OK) and 2015 (for MsgPack.Windows.sln).
- You must install .NET Framework 3.5, 4.x, .NET Core, and Xamarin dev tools to build all builds successfully.If you do not want to install options, edit
<TargetFrameworks>element in*.csprojfiles to exclude platforms you want to exclude.
- You must install .NET Framework 3.5, 4.x, .NET Core, and Xamarin dev tools to build all builds successfully.If you do not want to install options, edit
Install latest .NET Core SDK.
Run with Visual Studio Developer Command Prompt:
msbuild MsgPack.sln /t:Restoremsbuild MsgPack.sln
Or (for Unity 3D drops):
msbuild MsgPack.compats.sln /t:Restoremsbuild MsgPack.compats.slnOr (for Windows Runtime/Phone drops and Silverlight 5 drops):
msbuild MsgPack.Windows.sln /t:Restoremsbuild MsgPack.Windows.slnOr (for Xamarin unit testing, you must have Xamarin Business or upper license and Mac machine on the LAN to build on Windows):
msbuild MsgPack.Xamarin.sln /t:Restoremsbuild MsgPack.Xamarin.slnOr open one of above solution files in your IDE and run build command in it.
- Install latest Mono and .NET Core SDK.
- Now, you can build MsgPack.sln and MsgPack.Xamarin.sln with above instructions and
msbuildin latest Mono. Note thatxbuilddoes not work because it does not support latest csproj format.
First of all, there are binary drops on github release page, you should use it to save your time.
Because we will not guarantee source code organization compatibilities, we might add/remove non-public types or members, which should break source code build.
If you want to import sources, you must include just only described on MsgPack.Unity3D.csproj.
If you want to use ".NET 2.0 Subset" settings, you must use just only described on MsgPack.Unity3D.CorLibOnly.csproj file, and defineCORLIB_ONLY compiler constants.
If you run on Windows, it is recommended to use HXM instead of Hyper-V based emulator.
You can disable Hyper-V from priviledged (administrator) powershell as follows:
Disable-WindowsOptionalFeature-Online-FeatureName Microsoft-Hyper-V-Hypervisor
If you want to use Hyper-V again (such as for Docker for Windows etc.), you can do it by following in priviledged (administrator) powershell:
Enable-WindowsOptionalFeature-Online-FeatureName Microsoft-Hyper-V-Hypervisor
- Q: Javac shows compilation error.
- A: Rebuild the test project and try it run again.
You must create provisoning profiles in your MacOS devices.
SeeXamarin documents about provisining for details.
There are bundle IDs of current iOS tests:
org.msgpack.msgpack-cli-xamarin-ios-testorg.msgpack.msgpack-cli-xamarin-ios-test-packerorg.msgpack.msgpack-cli-xamarin-ios-test-unpackerorg.msgpack.msgpack-cli-xamarin-ios-test-unpackingorg.msgpack.msgpack-cli-xamarin-ios-test-timestamporg.msgpack.msgpack-cli-xamarin-ios-test-arrayserializationorg.msgpack.msgpack-cli-xamarin-ios-test-mapserialization
Note that some reflection based serializer tests failed with AOT related limitation.
SeeXamarin's official trouble shooting docs first.
- Q: An error occurred while running unit test project.
- A: Rebuild the project and rerun it. Or, login your Mac again, ant retry it.
- Q: It is hard to read English.
- A: You can read localized Xamarin docs with putting
{region}-{lang}as the first component of URL path such ashttps://developer.xamarin.com/ja-jp/guides/....
- A: You can read localized Xamarin docs with putting
This solution contains Silverlight5 and (old) UWP project for backward compability. They are required Visual Studio 2015 to build and test.
You can download Visual Studio 2015 community edition fromhere.
You do not have to install Visual Studio 2015 as long as you don't edit/test/build Silverlight and/or old UWP project.
- GitHub Page :http://cli.msgpack.org/
- Wiki (documentation) :https://github.com/msgpack/msgpack-cli/wiki
- API Reference :http://cli.msgpack.org/doc/top.html
- Issue tracker :https://github.com/msgpack/msgpack-cli/issues
- MSBuild reference :http://msdn.microsoft.com/en-us/library/0k6kkbsd.aspx
- Mono xbuild reference :http://www.mono-project.com/Microsoft.Build
About
MessagePack implementation for Common Language Infrastructure / msgpack.org[C#]
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.