Skip to content

Commit 7e8d1da

Browse files
committed
Add an Experimental APIs overview page
1 parent d8602b8 commit 7e8d1da

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
title: Experimental features in .NET 9+
3+
titleSuffix: ""
4+
description: Learn about APIs that are marked as experimental in .NET 9 and later versions that produce SYSLIB compiler warnings.
5+
ms.date: 10/21/2024
6+
---
7+
8+
# Experimental features in .NET 9+
9+
10+
Starting in .NET 9, some features make use of the <xref:System.Diagnostics.CodeAnalysis.ExperimentalAttribute> to indicate that the API shape or functionality is included in the release but not yet officially supported. Experimental features offer the opportunity to collect feedback on the API shape and functionality with the intent of refining the APIs and removing the `[Experimental]` attribute in the next major release.
11+
12+
When an experimental API is referenced, the compiler will produce an error. Each feature that is marked as experimental has a unique diagnostic ID. To express consent to using them, you suppress the specific diagnostic. You can do that via any of the means for suppressing diagnostics, but the recommended way is to add the diagnostic to the project's `<NoWarn>` property. For more information, see [Suppress warnings](#suppress-warnings).
13+
14+
Since each experimental feature has a separate ID, consenting to using one experimental feature doesn't consent to using another.
15+
16+
## Reference
17+
18+
The following table provides an index to the `SYSLIB5XXX` experimental APIs in .NET 9+.
19+
20+
| Diagnostic ID | Experimental Versions | Description |
21+
| - | - | - |
22+
| SYSLIB5001 | .NET 9 | <xref:System.Numerics.Tensors.Tensor%601> and related APIs in <xref:System.Numerics.Tensors> are experimental |
23+
| SYSLIB5002 | .NET 9 | <xref:System.Drawing.SystemColors> alternate colors are experimental |
24+
| SYSLIB5003 | .NET 9 | <xref:System.Runtime.Intrinsics.Arm.Sve> is experimental |
25+
| SYSLIB5004 | .NET 9 | <xref:System.Runtime.Intrinsics.X86.X86Base.DivRem> is experimental since performance is not as optimized as `T.DivRem` |
26+
| SYSLIB5005 | .NET 9 | <xref:System.Formats.Nrbf> is experimental |
27+
28+
29+
## Suppress warnings
30+
31+
Using an experimental feature offers the opportunity to submit feedback on the API shape and functionality before the feature is marked as stable and fully supported, but using the feature will produce a warning from the compiler. Suppressing the warning acknowledges that the API shape or functionality might change in the next major release. The warning can be suppressed through a `#pragma` directive in code or a `<NoWarn>` project setting.
32+
33+
To suppress the warnings in code:
34+
35+
```csharp
36+
// Disable the warning.
37+
#pragma warning disable SYSLIB5001
38+
39+
// Code that uses an experimental API that produces the diagnostic SYSLIB5001
40+
//...
41+
42+
// Re-enable the warning.
43+
#pragma warning restore SYSLIB5001
44+
```
45+
46+
To suppress the warnings in a project file:
47+
48+
```xml
49+
<Project Sdk="Microsoft.NET.Sdk">
50+
<PropertyGroup>
51+
<TargetFramework>net9.0</TargetFramework>
52+
<!-- NoWarn below suppresses SYSLIB5001 project-wide -->
53+
<NoWarn>$(NoWarn);SYSLIB5001</NoWarn>
54+
<!-- To suppress multiple warnings, you can use multiple NoWarn elements -->
55+
<NoWarn>$(NoWarn);SYSLIB5002</NoWarn>
56+
<NoWarn>$(NoWarn);SYSLIB5003</NoWarn>
57+
<!-- Alternatively, you can suppress multiple warnings by using a semicolon-delimited list -->
58+
<NoWarn>$(NoWarn);SYSLIB5001;SYSLIB5002;SYSLIB5003</NoWarn>
59+
</PropertyGroup>
60+
</Project>
61+
```
62+
63+
## See also
64+
65+
- [Preview APIs](../../../fundamentals/apicompat/preview-apis.md)

docs/navigate/tools-diagnostics/toc.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,6 +1800,11 @@ items:
18001800
href: ../../fundamentals/syslib-diagnostics/syslib0056.md
18011801
- name: SYSLIB0057
18021802
href: ../../fundamentals/syslib-diagnostics/syslib0057.md
1803+
- name: Experimental features
1804+
items:
1805+
- name: Overview
1806+
displayName: syslib, experimental
1807+
href: ../../fundamentals/syslib-diagnostics/experimental-overview.md
18031808
- name: Source-generated code
18041809
items:
18051810
- name: Overview

0 commit comments

Comments
 (0)