dotnet new api -aot: ‘-aot’ is not a valid option
The correct syntax for generating a project with AOT is --aot
(with 2 hyphens). In this particular case, the correct command would be:
dotnet new api --aot
Code language: Bash (bash)
The correct syntax for generating a project with AOT is --aot
(with 2 hyphens). In this particular case, the correct command would be:
dotnet new api --aot
Code language: Bash (bash)
.NET 8 brings some neat performance for existing APIs that handle type information. One such API that has seen a significant improvement is GetGenericTypeDefinition. In my benchmarks, the .NET 8 implementation is almost 10 times faster compared to the .NET 7 version. You can run this benchmark yourself if you’d like using BenchmarkDotNet: Or if…
Files opened or saved using WPF’s file dialogs (OpenFileDialog, SaveFileDialog or OpenFolderDialog) are by default added to the Windows Explorer’s recent files list and can also impact the Recommended section of the Start Menu in Windows 11. To disable this behavior, you can set AddToRecent to false on your dialog before calling the ShowDialog() method….
The easiest way to shuffle an array in C# is using Random.Shuffle. This method has been introduced in .NET 8 and works both with arrays and spans. The suffling is done in-place (the existing array/span is modified, as opposed to creating a new one and leaving the source unchanged). In terms of signatures, we’ve got:…
JsonStringEnumConverter is not compatible with native AOT. To fix that, NET 8 introduces a new converter type JsonStringEnumConverter<TEnum> that is compatible with native AOT. To use the new type, simply annotate your types as follows: Keep in mind: enum deserialization is case insensitive, while serialization can be cusomized via JsonNamingPolicy. What happens if you try…
This article will guide you through building your first .NET Aspire application. If you want an overview of .NET Aspire and what it brings to the table, check out our What is .NET Aspire article. Prerequisites There are a few things you need to have ready before you get started with .NET Aspire: If you…
A new ClientGuid property, introduced with .NET 8, allows you to uniquely identify dialogs such as the OpenFileDialog and the OpenFolderDialog, with the purpose of storing state – such as window size, position and last used folder – separately per dialog. To benefit from this behavior, configure the ClientGuid of your dialog to a known…