We released MagicOnion v4 from Cysharp last week.
MagicOnion has been built on the design principles of C# as Schema, Code-First Contracts for four years, immediately following the release of gRPC 1.0. Until now, we have been using gRPC C Core from Google, and now we are using the Microsoft implementation of ASP.NET Core Pure C#.
This has allowed us to share the same foundation as ASP.NET Core MVC, etc., so it’s much easier to provide gRPC and live together, such as providing HTTP/1 REST API and HTML output.
And most importantly, performance has improved.
Thanks for the ASP.NET team, we are also using it for real-time multiplay applications in games, so performance was very important. …
I’m based in Japan, and the company I founded, Cysharp, is not as well known in besides Japan. However, you may know the OSS I’m making, as several of them have received many stars on GitHub as well.
.NET people will know of my work in high-performance serializers such as MessagePack for C#. It is used by SignalR’s binary protocol, ASP.NET Core Blazor, Visual Studio, etc.
Unity people will know of my work in UniRx — Reactive Extensions for Unity.
The only way to handle external processes in C# is with the Process class, but this API is very old, and asynchronous support would require a lot of flag and boilerplate code.
So I created a library that “just throws a line of string like writing a shell,” “receives the result in a C# 8.0 asynchronous stream, which also only requires a line of await foreach,” and “handles ExitCode, StdError, etc. appropriately.
There are other wrapper libraries for Process. However, assuming C# 8.0 Async Streams, ProcessX makes it the simplest.
What would normally take about 30 lines to write in Process, only takes one line. …
I’ve renewed ConsoleAppFramework, a framework for easily creating CLI applications and many batches in C#.
The concept of a CLI framework on top of Generic Host, the basic structure, remains unchanged.
The method definitions become command line arguments, and help is generated automatically, as well as settings of loggers and DIs, and loading and binding of options in the Generic Host (also used in ASP.NET Core, etc.), so you can do detailed configuration with it. Since the foundation is the same, it can be shared with ASP.NET Core and others.
The simplest example would look like this
It’s been a few months since we released UniTask v2, and we’re now at version 2.0.31, GitHub’s Star is achieved over 1100. We believe it is stable and will be used in production.
For more information on UniTask v2, see this article - UniTask v2 — Zero Allocation async/await for Unity, with Asynchronous LINQ.
With the introduction of async/await, it is possible to implement new designs. Let’s take UnityWebRequest as an example of an asynchronous, pluggable and extensible design.
I will introduce it under the name async decorator pattern, but it is commonly known as Middleware.
It is a common design, mainly on the server side, implemented as a Filter in ASP.NET Core, Middleware in node.js (Express) and React, WSGI in Python, and MagicOnion. This is a very powerful design pattern and is also useful in client side. …
I’ve previously published UniTask, a new async/await library for Unity, now I’ve rewritten all the code and released new one.
In UniTask v2, almost everything is zero-allocated due to a thorough rewrite of the code (Technical details to follow). In addition to significant performance improvements, the new asynchronous sequences and Asynchronous LINQ. Others, await extensions for external assets such as DOTween and Addressables Support has also been built in for added convenience.
Before I talk about v2, here’s a recap. async/await is a feature that has been included since C# 5.0. Just like writing asynchronous code in synchronous code instead of asynchronous code handled by callback chains and coroutines. Both return values and exception handling will be handled naturally. When handling only callbacks, the complexity of the process results in multiple nests, and the inner exception is not propagated outward, making it difficult to process errors. …
I’ve just released a new logging library ZLogger for .NET Core and Unity. It is very fast, and using previously introduced ZString — Zero Allocation StringBuilder in the backend, it eliminates the allocation when formatting the string.
The standard output is especially important for containerization. For example, Datadog Logs and Stackdriver Logging collect logs directly from the standard output of the container. Writing to standard output is also recommended in The Twelve-Factor App — XI. Logs section. As such, dealing with over-decorated logs for the local environment and standard output in a slow Console.WriteLine …
For .NET Core and Unity, I have released a library called ZString that enables the memory allocation to zero for string generation. Besides introducing ZString, this article also deeply disassembles and explains the C# string and explains the String’s complexities and pitfalls and the necessity of ZString.
The table below shows the performance measurement of a simple string concatenation called “x:” + x + “ y:” + y + “ z:” + z’.
Formely, I posted MicroBatchFramework — Cloud Native Batch Framework for C#, this new framework is renamed, evolved version of MicroBatchFramework.
ConsoleAppFramework is built on Microsoft.Extensions(.NET Generic Host)that covering Logging, Configuration, DI, etc. ConsoleAppFramework do parameter binding, method routing, lifecycle management etc. It is like pair of ASP.NET Core, ASP.NET Core is for Web, ConsoleAppFramework is for CLI.
And so similar concept in PHP, Laravel and Laravel Zero that is Micro-framework for console applications. Microsoft’s competitor of ConsoleAppFramework is dotnet/commandline-api, it has System.CommandLine.Hosting and System.CommandLine.DragonFruit that is similar functionally. But ConsoleAppFramework is more stable and high productivity.
SampleApp.exe -name “foo” -repeat 5. …
MessagePack for C# Version 2 was released in 2019–12–16. The main implementation was done by Andrew Arnott who is a software engineer at Microsoft, Visual Studio Team. I checked the API design and performance and took care of the Unity compatibility. This collaboration took almost a year, and I think we did a great job.
Version 1 that implemented by me greatly boosted the old serializer’s performance standards and set a new standard. Version 2 made it work with new APIs (Span, System.Buffers) and also the overall I/O pipeline was optimized upon deciding how the serializer should be. …