2022-01-30: Visual Studio 2022 for Mac Preview 5, Proposed .NET 7 Breaking Changes

Published on Sunday, 30 January 2022

Visual Studio 2022 for Mac Preview 5 がリリースされました。

このバージョンから Visual Studio for Mac 自体を動かすためのランタイムが Mono から .NET 6 (CLR) へと変更となっています。これにより Apple Silicon でのネイティブ実行やパフォーマンスの向上といった恩恵を受けることができるようになりました。

実際に使用してみたところ M1 MacBook Air での実行はエミュレーションからネイティブへと変わったことで、体感できるほどに高速になっています。


.NET (Framework) がリリースされてから20年だそうで、最初の .NET Framework がリリースされたのは2002年1月15日頃だったようです。

トピックス

Visual Studio 2022 for Mac Preview 5

https://devblogs.microsoft.com/visualstudio/visual-studio-2022-for-mac-preview-5/

Visual Studio 2022 for Mac Preview 5 がリリースされた。

このリリースでランタイムが Mono から .NET 6 (CoreCLR) へと変更された。これにより Apple Silicon へのネイティブ対応が実現したほか、パフォーマンスが大きく向上しているとしている。

その他引き続きネイティブ UI への移行が行われ、ドキュメントアウトラインウィンドウやドキュメントスイッチャーダイアログがネイティブ UI となった。

Proposed .NET 7 Breaking Changes · Issue #7131 · dotnet/core

https://github.com/dotnet/core/issues/7131

.NET 7 で行う破壊的変更のプロポーザルが Issue として作成された。

現時点では下記の変更が検討されている。

  • Multi-level lookup (複数の個所のインストールを探す) ものをデフォルト無効化
  • PATH に 32-bit .NET へのパスの追加を廃止
  • dotnet build/publish で RID が明確なアプリでは暗黙的な SDK RID をデフォルトで使用
  • dotnet build/publish で RID が明確なアプリをデフォルトで生成
  • dotnet build/publish で exe/apphost をデフォルトで生成しない
  • dotnet publish/pack でリリースアセットを生成
  • スタートアップパフォーマンスを向上するためにプリコンパイルに AVX2 (x64) または NEON (ARM64) を使用する

Highlights from Git 2.35 | The GitHub Blog

https://github.blog/2022-01-24-highlights-from-git-2-35/

Git 2.35 がリリースされた。

git stash--staged オプションの追加、git log--format における describe のカスタマイズ、SSH 署名の改善、merge.conflictStylezdiff3 モードの追加、--histogram, --color-moved のパフォーマンス改善、Windows での clean/smudge フィルター処理で4GB以上のファイルを扱えるようになった(Git for Windows 2.34には適用済み)、など。

ServiceStack V6 | Documentation

https://docs.servicestack.net/releases/v6

ServiceStack V6 がリリースされた。

これまで有償ライセンスのみであったが、個人およびオープンソースプロジェクト向けの無償のライセンスが提供されるようになった。

Release v6.0.3 · npgsql/npgsql

https://github.com/npgsql/npgsql/releases/tag/v6.0.3

Npgsql 6.0.3 がリリースされた。

コマンド実行中に接続が中断された場合に StackOverflowException が発生する問題の修正など様々なバグ修正が行われている。

Announcing .NET Community Toolkit v8.0.0 Preview 1

https://devblogs.microsoft.com/ifdef-windows/announcing-net-community-toolkit-v8-0-0-preview-1/

.NET Community Toolkit v8.0.0 Preview 1 がリリースされた。

コマンドやプロパティ周りのコード生成を行う MVVM Toolkit source generators の追加と .NET 6 への対応が行われている。

.NET Framework January 2022 Cumulative Update Preview

https://devblogs.microsoft.com/dotnet/net-framework-january-2022-cumulative-update-preview/

.NET Framework の2022年1月の累積アップデートプレビューがリリースされた。

このアップデートプレビューでは CLR がごく稀にクラッシュする問題や WPF の不具合がいくつか修正されている。

アーティクル、スライドなど

Optimizing CPU-Bound and Memory-Bound .NET Applications: 11 Best Practices - Michael's Coding Spot

https://michaelscodingspot.com/cpu-bound-memory-bound/

CPU バウンドとメモリーバウンドな .NET アプリケーションを最適化するための11のベストプラクティスを紹介している記事。

EF Core 6 Features - Part 2

https://blog.okyrylchuk.dev/entity-framework-core-6-features-part-2

Entity Framework Core 6 の機能について紹介する記事 (Part 2)。

Writing Automated UI tests in .NET using Playwright and SpecFlow

https://levelup.gitconnected.com/writing-automated-ui-tests-in-net-using-playwright-and-specflow-f923411a65bc

SpecFlow と Playwright で UI 自動テストを書く方法についての記事。

Why Your Ticket May End Up in a Different Tracker | The .NET Tools Blog

https://blog.jetbrains.com/dotnet/2022/01/24/why-your-ticket-may-end-up-in-a-different-tracker/

Rider の問題を報告したチケットが別なプロダクトのトラッカーに送られることがある理由についての記事。

Rider は IntelliJ IDEA と ReSharper というコンポーネントの上に構築されていること、そのため Rider の問題として報告した場合でもそれぞれ依存先のコンポーネントへと送られることがある。

Generic型のインターフェイスの型をダイナミックに定義する - Qiita

https://qiita.com/TsuyoshiUshio@github/items/b77b465a21a9e8d84239

オープンジェネリック型から構築されたジェネリック型を作る Type.MakeGenericType についての記事。

記事ではネストされたジェネリック型での挙動についても触れている。

Colors in .NET: An In-Depth Guide

https://www.infoq.com/articles/colors-dotnet-guide/

.NET で色相、彩度、輝度といった色を扱うための要素とその操作についての記事。

F# and WebAssembly

https://dev.to/tunaxor/f-and-webassembly-n0a

Blazor WebAssembly 上で F# のアプリケーションを動かす Web フレームワーク Bolero を使う方法についての記事。

Troubleshooting .NET performance issues with Datadog toolbox

https://chnasarre.medium.com/troubleshooting-net-performance-issues-with-datadog-toolbox-3b9919792344

Datadog の APM や新機能の .NET Continuous Profiler を使用してパフォーマンス問題を解決する方法についての記事。

Azure DevOps requires TLS 1.2 on all connections including Visual Studio

https://devblogs.microsoft.com/visualstudio/azure-devops-requires-tls-1-2-on-all-connections-including-visual-studio/

Azure DevOps は1月31日から接続に TLS 1.2 を必要とするようになるため、Visual Studio を含め TLS 1.2 の有効化が必要となるというアナウンス。

【C# 11 候補】 トップ レベル ステートメントの Main に属性を付ける | ++C++; // 未確認飛行 C ブログ

https://ufcpp.net/blog/2022/1/main-attribute/

C# 11 候補となっているトップレベルステートメントの暗黙的な Main メソッドに属性をつける(つまり今はつける方法がない)という話についての記事。

Solving the source generator 'marker attribute' problem - Part 1: Creating a source generator - Part 7

https://andrewlock.net/creating-a-source-generator-part-7-solving-the-source-generator-marker-attribute-problem-part1/

Unity - Unity Test Framework 2.0 ready for feedback

https://forum.unity.com/threads/unity-test-framework-2-0-ready-for-feedback.1230126/

Unity の Unity Test Framework v2.0 のプレビューがリリースされた。

非同期メソッドの対応などが行われている。v2.0 は 2022.2 からデフォルトとなるとのこと。

How to lie with Benchmarks

https://leveluppp.ghost.io/how-to-lie-with-benchmarks/

ベンチマークで嘘をつく方法についての記事。

ベンチマークは正しく行うことが難しいという話を紹介している。例えば簡単な例ではウォームアップの必要性、難しいものではメソッドのアドレスによる変化といったものがあるとしている。

How to get ASP.NET Core server URLs

https://dev.to/swimburger/how-to-get-aspnet-core-server-urls-g8h

ASP.NET Core のアプリケーションがサーバーのアドレスを取得する方法についての記事。

IServerAddressesFeature を取得することでサーバーのアドレスを取得できる。

Performance improvements in ASP.NET Core 6

https://devblogs.microsoft.com/dotnet/performance-improvements-in-aspnet-core-6/

ASP.NET Core 6 で行われたパフォーマンス改善についての記事。

記事ではパフォーマンスが改善された部分をベンチマークとともに紹介している。

(C#) ModuleInitializer からのみ呼べるメソッドを作る - ネコのために鐘は鳴る

https://ikorin2.hatenablog.jp/entry/2022/01/26/034653

.NET 6 の ModuleInitializer 属性を付けたメソッドをユーザーコードから呼び出せなくする方法についての記事。

記事では Obsolete 属性でのコンパイルエラーとする方法を紹介している。

Code search in Visual Studio 2022 is about to get much faster

https://devblogs.microsoft.com/visualstudio/code-search-in-visual-studio-is-about-to-get-much-faster/

Visual Studio 2022 17.1 Preview 3 で導入されたインデックス化されたコード検索についての記事。

95パーセンタイルで従来の3から10倍以上高速であるとしている。インデックスは Visual Studio のプロセスからは切り離され、優先度の低いバックグラウンドプロセスで作っているとのこと。

ライブラリ、リポジトリ、ツールなど

usausa/munin-node-alternative: Munin node alternative implementation by .NET

https://github.com/usausa/munin-node-alternative

Munin-node の C# (.NET) による代替実装。

microsoft/FeatureManagement-Dotnet: Microsoft.FeatureManagement provides standardized APIs for enabling feature flags within applications. Utilize this library to secure a consistent experience when developing applications that use patterns such as beta access, rollout, dark deployments, and more.

https://github.com/microsoft/FeatureManagement-Dotnet

ASP.NET Core アプリケーションでフィーチャーフラグを実装するためのライブラリー。

Giorgi/EntityFramework.Exceptions: Handle database errors easily when working with Entity Framework Core. Supports SQLServer, PostgreSQL, SQLite, Oracle and MySql

https://github.com/Giorgi/EntityFramework.Exceptions

Entity Framework Core でクエリーを実行した際のエラーがすべて DbUpdateException となってしまい、取り扱いが不便な問題を解消するライブラリー。

例えばユニークキー制約違反などが発生した場合は UniqueConstraintException に変換した後でスローするようになる。

xoofx/dotnet-releaser: Easily cross-compile, package and publish your .NET application to NuGet and GitHub.

https://github.com/xoofx/dotnet-releaser

.NET アプリケーションを NuGet や GitHub に簡単にリリースするツール。

クロスコンパイルからパッケージング、発行までをワンストップで行えるとのこと。

サイト、ドキュメントなど

ツイート

Visual Studio 2022 17.1 Preview 1 以降では Azure App Service (Windows) の .NET (Framework, Core, 5 以降)のプロセスにプロジェクトやソリューションなしでアタッチできるようになったという話。

SignalR でサーバーからクライアントを呼び出した際に戻り値を待機できるようにするというプロトタイプを検討中という話。

Deep Dive

Detect license changes in packages · Issue #11520 · NuGet/Home

https://github.com/NuGet/Home/issues/11520

NuGet パッケージのライセンスが変更されたことを検出したいという Issue。

特に互換性のないライセンスとなった場合に気が付かずインストールしてしまうとライセンス違反となってしまうのでそういった問題を防ぎたいという話。

Json features by CyrusNajmabadi · Pull Request #59034 · dotnet/roslyn

https://github.com/dotnet/roslyn/pull/59034

文字列リテラル内の JSON を認識してシンタックスハイライトなどを行えるようにするという PR。

ReSharper の Language injections のような // lang=json といった形で認識される模様。

Design proposal: Bind get/set/after modifiers · Issue #39837 · dotnet/aspnetcore

https://github.com/dotnet/aspnetcore/issues/39837

Blazor の @bind でバインドの前後や get/set を個別にバインドできるようにしたいという提案 Issue。