Skip to content

Commit fc58d36

Browse files
authored
Document DriveInfo.DriveFormat Linux breaking change for .NET 10 (#46929)
1 parent 17f6fdf commit fc58d36

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

docs/core/compatibility/10.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ If you're migrating an app to .NET 10, the breaking changes listed here might af
2929
| [C# 14 overload resolution with span parameters](core-libraries/10.0/csharp-overload-resolution.md) | Behavioral change | Preview 1 |
3030
| [Consistent shift behavior in generic math](core-libraries/10.0/generic-math.md) | Behavioral change | Preview 1 |
3131
| [Default trace context propagator updated to W3C standard](core-libraries/10.0/default-trace-context-propagator.md) | Behavioral change | Preview 4 |
32+
| [DriveInfo.DriveFormat returns Linux filesystem types](core-libraries/10.0/driveinfo-driveformat-linux.md) | Behavioral change | Preview 6 |
3233
| [LDAP DirectoryControl parsing is now more stringent](core-libraries/10.0/ldap-directorycontrol-parsing.md) | Behavioral change | Preview 1 |
3334
| [MacCatalyst version normalization](core-libraries/10.0/maccatalyst-version-normalization.md) | Behavioral change | Preview 1 |
3435
| [.NET runtime no longer provides default SIGTERM signal handler](core-libraries/10.0/sigterm-signal-handler.md) | Behavioral change | Preview 5 |
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: "Breaking change: DriveInfo.DriveFormat returns Linux filesystem types"
3+
description: Learn about the .NET 10 breaking change in core .NET libraries where DriveInfo.DriveFormat on Linux systems returns Linux kernel filesystem type strings instead of mapped magic constants.
4+
ms.date: 06/24/2025
5+
---
6+
# DriveInfo.DriveFormat returns Linux filesystem types
7+
8+
On Linux systems, <xref:System.IO.DriveInfo.DriveFormat?displayProperty=nameWithType> now returns Linux kernel filesystem type strings. These strings represent a more granular representation of the filesystem type than the previous implementation. For example, it's now possible to distinguish between `ext3` and `ext4`.
9+
10+
## Previous behavior
11+
12+
Previously, .NET returned a string representation by mapping magic constants to strings. Because several different filesystem types use the same magic constants, it wasn't possible to distinguish between them.
13+
14+
For cgroup file systems, `DriveFormat` returned `cgroupfs`/`cgroup2fs`. For the SELinux filesystem, the value was `selinux`.
15+
16+
## New behavior
17+
18+
Starting in .NET 10, .NET returns the string representation used by the Linux kernel for the filesystem type.
19+
20+
For cgroup file systems, `DriveFormat` returns `cgroup`/`cgroup2`. For the SELinux filesystem, the value is `selinuxfs`.
21+
22+
## Version introduced
23+
24+
.NET 10 Preview 6
25+
26+
## Type of breaking change
27+
28+
This change is a [behavioral change](../../categories.md#behavioral-change).
29+
30+
## Reason for change
31+
32+
Provide more granular filesystem type information.
33+
34+
## Recommended action
35+
36+
Check and update usages of <xref:System.IO.DriveInfo.DriveFormat?displayProperty=nameWithType> to include the Linux filesystem type strings. On a Linux system, you can read the type strings of the drives from the `/proc/self/mountinfo` file. On each line, the filesystem type string is the first field after the `-` separator.
37+
38+
## Affected APIs
39+
40+
- <xref:System.IO.DriveInfo.DriveFormat?displayProperty=fullName>

docs/core/compatibility/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ items:
2424
href: core-libraries/10.0/generic-math.md
2525
- name: Default trace context propagator updated to W3C Standard
2626
href: core-libraries/10.0/default-trace-context-propagator.md
27+
- name: DriveInfo.DriveFormat returns Linux filesystem types
28+
href: core-libraries/10.0/driveinfo-driveformat-linux.md
2729
- name: LDAP DirectoryControl parsing is now more stringent
2830
href: core-libraries/10.0/ldap-directorycontrol-parsing.md
2931
- name: MacCatalyst version normalization

0 commit comments

Comments
 (0)