トピックス
Early peek at C# 11 features - .NET Blog
https://devblogs.microsoft.com/dotnet/early-peek-at-csharp-11-features/
Visual Studio 2022 17.1 と .NET SDK 6.0.200 以降で利用できるようになった C# 11 プレビュー機能の紹介記事。
記事では有効にする方法と次の機能について紹介している。
- 文字列補完の中の改行
- リストパターン
- パラメーター
null
チェック
Requiring two-factor authentication on NuGet.org - The NuGet Blog
https://devblogs.microsoft.com/nuget/requiring-two-factor-authentication-on-nuget-org/
NuGet.org が3月8日から二要素認証 (2FA) を必須にするというアナウンス。
サプライチェーンセキュリティの強化のためログインに二要素認証が必須となる。二要素認証は Microsoft アカウントまたは職場または学校のアカウント (Azure Active Directory) のものが使用され、サインイン時にそれらがサポートするいずれかの二要素認証が要求される。
ユーザーログインは3月8日からすべてのアカウントに対して有効となり、API キーは今後二要素認証コンテキストで作成されていないものが無効とされる予定。無効化を実施する30日前には通知される。
Release ILSpy 7.2 · icsharpcode/ILSpy
https://github.com/icsharpcode/ILSpy/releases/tag/v7.2
ILSpy 7.2 がリリースされた。
このリリースでは C# のパターンマッチングやネストされた stackalloc のコンテキスト、SkipLocalInit のようないくつかの機能に対応し、多くの改善や修正が含まれている。
Release Release v2.43.0 · grpc/grpc-dotnet
https://github.com/grpc/grpc-dotnet/releases/tag/v2.43.0
gRPC (.NET) 2.43.0 がリリースされた。
.NET 6 での deflate 圧縮やヘルスチェックのマッピング設定といった機能の追加といくつかの改善と修正が含まれている。
Introducing the .NET 6 runtime for AWS Lambda | Amazon Web Services
https://aws.amazon.com/jp/blogs/compute/introducing-the-net-6-runtime-for-aws-lambda/
AWS Lambda における .NET 6 ランタイムサポートについての記事。
- ロギングの改善
- JSON シリアライズのための Source Generator
- トップレベルステートメント
- ASP.NET Core Minimal API
- オープンソース Lambda ランタイムクライアント
Edge Developer Tools - Visual Studio Marketplace
https://marketplace.visualstudio.com/items?itemName=ms-edgedevtools.VisualStudioEdgeDevTools
Visual Studio に Edge と Developer Tools を統合して ASP.NET / ASP.NET Core アプリケーションを開発時にシームレスにあつかえるようにする拡張がプレビューリリースされた。
アーティクル、スライドなど
EFCoreに深入り(DbContextをnewするあたり) - enrike3のブログ
https://enrike3.hatenablog.com/entry/2022/02/20/163821
Entity Framework Core で DbContext が作成するのに必要な要素がどのように用意されているのかについての記事。
[C#] Vector<T>で配列の最大値を高速取得 - Qiita
https://qiita.com/radian-jp/items/186862f355ac5625a704
SIMD が有効になる Vector<T>
を使用することで配列の最大要素の高速に取得するという記事。
【C# 10.0 変更点】 構造体のフィールド初期化子にはコンストラクター必須 | ++C++; // 未確認飛行 C ブログ
https://ufcpp.net/blog/2022/2/csharp10-breaking-change-field-init/
構造体のフィールド初期化子を持つ場合コンストラクターが必須となる修正が Visual Studio 2022 17.1 以降で行われた件についての記事。
Serilog 5.0.0 バージョンアップ時に引っかかった2点 - Qiita
https://qiita.com/karuakun/items/ecaaa6d151c4985d23e0
Serilog を 4.1.0 から 5.0.0 へバージョンアップした際の発生した非互換の挙動に関する記事。
How to access configuration values from appsettings.json file inside ValidationAttribute class? - Nuthan Murarysetty - Medium
ValidationAttribute
から appsettings.json の設定値にアクセスする方法についての記事。
Validate
メソッドに渡される ValidateContext
は IServiceProvider
を提供しているため、GetService<IConfiguration>
などで設定を取得できる。また、ユニットテストでは ValidationContext
を作成する際に IServiceProvider
のモックを渡すことでテストできる。
Comparing IAsyncEnumerable and IObservable for event streams - DEV Community
https://dev.to/asik/comparing-iasyncenumerable-and-iobservable-for-event-streams-5g96
IAsyncEnumerable
と IObservable
の違いについての記事。
.NET build tool using Bullseye and SimpleExec - DEV Community
https://dev.to/mysticmind/net-build-tool-using-bullseye-and-simpleexec-1jbe
NAnt のようなビルドの仕組みをターゲット依存グラフの構築実行を実現する Bullseye
とコマンド実行ラッパーの SimpleExec
を利用して作るという記事。
単純な二つのライブラリーを組みわせることで理解しやすい形でビルドツールを構築できるとしている。
- adamralph/bullseye: 🎯 A .NET library for running a target dependency graph.
- adamralph/simple-exec: 🏃 A .NET library that runs external commands.
A Deep Dive into C#’s CancellationToken | by Mitesh Shah | Feb, 2022 | Medium
https://medium.com/@mitesh_shah/a-deep-dive-into-c-s-cancellationtoken-44bc7664555f
CancellationToken が提供している機能やそれらを使用する方法についての記事。
Recommended container limits for dotnet-monitor
https://www.poppastring.com/blog/recommended-container-limits-for-dotnetmonitor
dotnet-monitor
をコンテナー環境で動かす場合の推奨されるリソース設定についての記事。
Creating a clean Style Library for Xamarin.Forms
https://dev.to/danielmonettelli/creating-a-clean-style-library-for-xamarinforms-3cde
Xamarin.Forms でクリーンなスタイルライブラリーを構築することについての記事。
[ASP.NET Core 6] WebApplicationFactoryの利用の互換性が失われることに対処する
https://zenn.dev/shimat/articles/372d16077ecdf6
ASP.NET Core 6 (.NET 6) で WebApplicationFactory を利用する場合に .NET 5 やそれ以前のバージョンとの構成が異なることによる問題についての記事。
.NET 💜 GitHub Actions: intro to GitHub Actions for .NET - .NET Blog
https://devblogs.microsoft.com/dotnet/dotnet-loves-github-actions/
.NET アプリケーションの GitHub Actions での利用について紹介している記事。
PostgreSQL EF CoreでのJsonの処理 - Qiita
https://qiita.com/hiro_t/items/2bfd91fcc3603ce02a47
Entity Framework Core 7.0 プレビューと PostgreSQL (Npgsql) での JSON をマッピングを試してみたという記事。
Building .NET project docs with DocFX on GitHub Pages - James Croft
https://www.jamescroft.co.uk/building-net-project-docs-with-docfx-on-github-pages/
DocFX を使って .NET プロジェクトのドキュメントを生成し、GitHub Pages にアップロードする方法についての記事。カスタマイズなどにも触れている。
Blazor WebAssemblyでMudBlazorを使ってPie Chartを表示してみた - Qiita
https://qiita.com/michimichix521/items/208b89a8750f8d9b962c
Blazor WebAssembly で MudBlazor のチャート機能で Pie Chart を表示してみるという記事。
【競プロ】C#: 競技プログラミング環境構築 2022年版
https://zenn.dev/naminodarie/articles/1ff02beff572d2
C# で競技プログラミング固有の事情に合わせた環境構築についての記事。
Please stop lying about .NET Standard 2.0 support!
https://andrewlock.net/stop-lying-about-netstandard-2-support/
一部のコアライブラリーは TFM として .NET Standard 2.0 をサポートしているように見えるが、.NET Core 2.1 や .NET Core 3.0 のようなサポートの終了しているランタイムではビルドエラーとなる問題についての記事。
それらのランタイムはサポートが終了しているが積極的にブロックするのは .NET Standard の約束を破るものではないかという筆者の主張。
Migrating from Redis-64 to Memurai
https://blog.marcgravell.com/2022/02/migrating-from-redis-64-to-memurai.html?m=1
Windows で Redis を使用したい場合、Redis-64 に代わる Memurai という Windows ネイティブな Redis 5.0 フォークがあるのでそれに移行するという記事。
Debug .NET applications running in local containers with VS Code | Red Hat Developer
ローカルのコンテナーで動作する .NET アプリケーションに Visual Studio Code からアタッチしてデバッグする方法についての記事。
Debug .NET applications running on Kubernetes with VS Code | Red Hat Developer
https://developers.redhat.com/articles/2022/01/07/debug-net-applications-running-kubernetes-vs-code
Kubernetes で動作する .NET アプリケーションに Visual Studio Code からアタッチしてデバッグする方法についての記事。
.NET 6によるHTTP Client SDKの作成と利用
https://www.infoq.com/jp/articles/creating-http-sdks-dotnet-6/
HTTP クライアント SDK を作る上でのポイントを解説している記事(日本語)。
HttpClient のカスタムや IHttpClientFactory との統合、拡張性やテストについて。Refit や NSwag を使用した実装についても触れている。
Training a ML.NET Model with Azure ML - .NET Blog
https://devblogs.microsoft.com/dotnet/training-a-ml-dotnet-model-with-azure-ml/
Azure Machine Learning を使用して ML.NET のモデルをトレーニングするという記事。
Sharing code between ASP.NET and ASP.NET Core - .NET Blog
https://devblogs.microsoft.com/dotnet/sharing-code-between-aspnet-and-aspnetcore/
ASP.NET と ASP.NET Core でコードを共有するための Tips の記事。
.NET Annotated Monthly | March 2022 | The .NET Tools Blog
https://blog.jetbrains.com/dotnet/2022/03/01/net-annotated-monthly-march-2022/
.NET 6 と Daprを使った分散サービス開発 その1 環境構築 - Qiita
https://qiita.com/kazumihirose/items/57e3aeaab65a1a68977b
How to Send Emails using C# .NET with Azure Functions and SendGrid Bindings
https://www.twilio.com/blog/send-emails-csharp-dotnet-with-azure-functions-and-sendgrid-bindings
Azure Functions で SendGrid Bindings を利用してメールを送信する方法についての記事。
Distributed Locks Manager (C# and Redis)
https://towardsdev.com/distributed-locks-manager-c-and-redis-fd3d86cd1250
Redis を使用した分散ロックを実装する方法についての記事。
記事では RedLock.net を使用した例が紹介されている。
Using AWS ECS Service Discovery for communication between Microservices in .NET & C#
Amazon ECS で動作するアプリケーションでサービス間の通信のために AWS Cloud Map を使用して Service Discovery を行う方法についての記事。
Building a C# Blazor App with NoSQL and SQL Using HarperDB
https://dev.to/towernter/building-a-c-blazor-app-with-nosql-and-sql-using-harperdb-lc
Blazor アプリケーションで HarperDB と呼ばれる NoSQL/SQL をサポートするデータベースを使用する方法についての記事。
ライブラリ、リポジトリ、ツールなど
Alias: An approach to .NET Assembly Conflict Resolution
https://blog.sentry.io/2022/02/24/alias-an-approach-to-net-assembly-conflict-resolution
アセンブリーの競合を解決するためのコマンドラインツール Alias の紹介記事。
複数のバージョンの Newtonsoft.Json.dll や Unity での UPM からインストールされるパッケージの System.Memory.dll, System.Buffers.dll などで発生するバージョンの競合を解決するため、依存関係も含めてエイリアスのパッチを当てるツール。Sentry for Unity SDK で実際に使用されている。
例えば、MyLibrary.dll
が System.Memory.dll
, System.Buffers.dll
に依存している場合、MyLibrary.
をプレフィックスとしてパッチを当てると、internal
化された MyLibrary.System.Memory.dll
と MyLibrary.System.Buffers.dll
が生成され、MyLibrary.dll
からはそれらを参照するようになる。
bflattened/bflat: C# as you know it but with Go-inspired tooling (small, selfcontained, and native executables)
https://github.com/bflattened/bflat
NativeAOT と Roslyn を統合して golang のように直接ネイティブ実行バイナリーを出力するというツール。
なおライセンスは AGPL となっているため注意が必要。
bflat, my take on C# with Go-like tooling, is now open source. New builds coming as soon as I write the Github actions to create them. You can build it from source in the meantime: https://t.co/VWiqKUjDgk
— Michal Strehovský (@MStrehovsky) February 21, 2022
サイト、ドキュメントなど
Create JSON Web APIs from gRPC
https://docs.microsoft.com/en-us/aspnet/core/grpc/httpapi?view=aspnetcore-6.0
gRPC を JSON ベースの HTTP Web API として公開できる実験的なライブラリー Microsoft.AspNetCore.Grpc.HttpApi についての記事。
ツイート
To celebrate .NET's 20 year anniversary, I've put up a mirror of Chris Brumme's weblog: https://t.co/wP5JGEnegI pic.twitter.com/l4h5vxBTUz
— J☁e Duffy (@funcOfJoe) February 19, 2022
.NET CLR の開発者であった Chris Brumme 氏のブログ (濃い話が書かれている) を20周年を記念してミラーサイトとして用意したという話。Chris Brumme 氏は5年前に亡くなっているそう。
What's this - is it a completely normal https://t.co/iVNZYgvf9Y Core application?
— Steve Sanderson (@stevensanderson) February 25, 2022
No, it's https://t.co/iVNZYgvf9Y Core running on WASI (WebAssembly on the server)! Just got a prototype working this week. pic.twitter.com/Hd4rrqSmLA
WASI で ASP.NET Core が動作するプロトタイプができたという話。つまり Blazor ではない ASP.NET Core を WebAssembly で動かせている。
And what if Key doesn't exist? Our .𝗡𝗘𝗧 𝗶𝗻 𝗣𝗶𝗰𝘁𝘂𝗿𝗲𝘀 infographic will explain! 🧐#dotnet #collections #dictionary #dotnetInPictures pic.twitter.com/B6zZHhsSZu
— Dotnetos (@dotnetosorg) February 23, 2022
New week, new .Net in Pictures! Let's get a break from .NET Diagnostics Expert and take a look at our new collection of infographics ✨#dotnet #collections #dictionary #dotnetInPictures pic.twitter.com/4Ytud17h5N
— Dotnetos (@dotnetosorg) February 21, 2022
Dictionary の内部に関するインフォグラフィック。
Did you know that Compiler Explorer lets you see C# .NET outputs for different Operating Systems and Architectures?
— Bartosz Adamczewski (@badamczewski01) February 21, 2022
Example: https://t.co/1wKb7G7FM1#dotnet pic.twitter.com/vw3AiKCnGo
Compiler Explorer では様々な OS とアーキテクチャー向けの逆アセンブル結果を確認できるという話。
Deep Dive
Speed up contended HTTP/2 frame writing (500% gRPC h2 70x1 improvement) by halter73 · Pull Request #40407 · dotnet/aspnetcore
https://github.com/dotnet/aspnetcore/pull/40407
HTTP/2 のフレーム書き込みを高速化するという PR。
これにより TLS 上の HTTP/2 で一つのコネクションに70ストリーム持った場合、500%程度高速になるという。