Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 502856c

Browse files
committed
Declare Sequential layout on FileStatus to remove the uninitialized field warnings
* Sequential is correct, because it's an interop type * When no attributes are specified csc emits sequential, not auto, to the IL; so this doesn't change the output at all.
1 parent 501d998 commit 502856c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Common/src/Interop/Unix/System.Native/Interop.Stat.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ internal static partial class Interop
88
{
99
internal static partial class Sys
1010
{
11+
// Even though csc will by default use a sequential layout, a CS0649 warning as error
12+
// is produced for un-assigned fields when no StructLayout is specified.
13+
//
14+
// Explicitly saying Sequential disables that warning/error for consumers which only
15+
// use Stat in debug builds.
16+
[StructLayout(LayoutKind.Sequential)]
1117
internal struct FileStatus
1218
{
1319
internal FileStatusFlags Flags;

0 commit comments

Comments
 (0)