Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FileAccessData Id and CorrelationId #9615

Merged
merged 4 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/Build.UnitTests/BackEnd/TaskHostTaskComplete_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ public void TestConstructors()
new FileAccessData(
ReportedFileOperation.CreateFile,
RequestedAccess.Read,
0,
0,
processId: 123,
id: 1,
correlationId: 0,
error: 0,
DesiredAccess.GENERIC_READ,
FlagsAndAttributes.FILE_ATTRIBUTE_NORMAL,
"foo",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ public override void HandleFileAccess(FileAccessData fileAccessData) => _fileAcc
(Experimental.FileAccess.ReportedFileOperation)fileAccessData.Operation,
(Experimental.FileAccess.RequestedAccess)fileAccessData.RequestedAccess,
fileAccessData.ProcessId,
fileAccessData.Id,
fileAccessData.CorrelationId,
fileAccessData.Error,
(Experimental.FileAccess.DesiredAccess)fileAccessData.DesiredAccess,
(Experimental.FileAccess.FlagsAndAttributes)fileAccessData.FlagsAndAttributes,
Expand Down
32 changes: 32 additions & 0 deletions src/Build/CompatibilitySuppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- https://learn.microsoft.com/en-us/dotnet/fundamentals/package-validation/diagnostic-ids -->
<Suppressions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Suppression>
dfederm marked this conversation as resolved.
Show resolved Hide resolved
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Build.Experimental.FileAccess.FileAccessData.#ctor(Microsoft.Build.Experimental.FileAccess.ReportedFileOperation,Microsoft.Build.Experimental.FileAccess.RequestedAccess,System.UInt32,System.UInt32,Microsoft.Build.Experimental.FileAccess.DesiredAccess,Microsoft.Build.Experimental.FileAccess.FlagsAndAttributes,System.String,System.String,System.Boolean)</Target>
<Left>lib/net472/Microsoft.Build.dll</Left>
<Right>lib/net472/Microsoft.Build.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Build.Experimental.FileAccess.FileAccessData.#ctor(Microsoft.Build.Experimental.FileAccess.ReportedFileOperation,Microsoft.Build.Experimental.FileAccess.RequestedAccess,System.UInt32,System.UInt32,Microsoft.Build.Experimental.FileAccess.DesiredAccess,Microsoft.Build.Experimental.FileAccess.FlagsAndAttributes,System.String,System.String,System.Boolean)</Target>
<Left>lib/net8.0/Microsoft.Build.dll</Left>
<Right>lib/net8.0/Microsoft.Build.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Build.Experimental.FileAccess.FileAccessData.#ctor(Microsoft.Build.Experimental.FileAccess.ReportedFileOperation,Microsoft.Build.Experimental.FileAccess.RequestedAccess,System.UInt32,System.UInt32,Microsoft.Build.Experimental.FileAccess.DesiredAccess,Microsoft.Build.Experimental.FileAccess.FlagsAndAttributes,System.String,System.String,System.Boolean)</Target>
<Left>ref/net472/Microsoft.Build.dll</Left>
<Right>ref/net472/Microsoft.Build.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Build.Experimental.FileAccess.FileAccessData.#ctor(Microsoft.Build.Experimental.FileAccess.ReportedFileOperation,Microsoft.Build.Experimental.FileAccess.RequestedAccess,System.UInt32,System.UInt32,Microsoft.Build.Experimental.FileAccess.DesiredAccess,Microsoft.Build.Experimental.FileAccess.FlagsAndAttributes,System.String,System.String,System.Boolean)</Target>
<Left>ref/net8.0/Microsoft.Build.dll</Left>
<Right>ref/net8.0/Microsoft.Build.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
</Suppressions>
27 changes: 25 additions & 2 deletions src/Build/FileAccess/FileAccessData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System;

using Microsoft.Build.BackEnd;

namespace Microsoft.Build.Experimental.FileAccess
Expand All @@ -17,6 +16,8 @@ public struct FileAccessData
private ReportedFileOperation _operation;
private RequestedAccess _requestedAccess;
private uint _processId;
private uint _id;
private uint _correlationId;
private uint _error;
private DesiredAccess _desiredAccess;
private FlagsAndAttributes _flagsAndAttributes;
Expand All @@ -28,6 +29,8 @@ public FileAccessData(
ReportedFileOperation operation,
RequestedAccess requestedAccess,
uint processId,
uint id,
uint correlationId,
uint error,
DesiredAccess desiredAccess,
FlagsAndAttributes flagsAndAttributes,
Expand All @@ -38,6 +41,8 @@ public FileAccessData(
_operation = operation;
_requestedAccess = requestedAccess;
_processId = processId;
_id = id;
_correlationId = correlationId;
_error = error;
_desiredAccess = desiredAccess;
_flagsAndAttributes = flagsAndAttributes;
Expand All @@ -56,7 +61,7 @@ public ReportedFileOperation Operation
/// <summary>The requested access.</summary>
public RequestedAccess RequestedAccess
{
get => _requestedAccess;
readonly get => _requestedAccess;
private set => _requestedAccess = value;
}

Expand All @@ -67,6 +72,22 @@ public uint ProcessId
private set => _processId = value;
}

/// <summary>Id of file access.</summary>
public uint Id
{
readonly get => _id;
private set => _id = value;
}


/// <summary>Correlation id of file access.</summary>
public uint CorrelationId
{
readonly get => _correlationId;
private set => _correlationId = value;
}


/// <summary>The error code of the operation.</summary>
public uint Error
{
Expand Down Expand Up @@ -114,6 +135,8 @@ void ITranslatable.Translate(ITranslator translator)
translator.TranslateEnum(ref _operation, (int)_operation);
translator.TranslateEnum(ref _requestedAccess, (int)_requestedAccess);
translator.Translate(ref _processId);
translator.Translate(ref _id);
translator.Translate(ref _correlationId);
translator.Translate(ref _error);
translator.TranslateEnum(ref _desiredAccess, (int)_desiredAccess);
translator.TranslateEnum(ref _flagsAndAttributes, (int)_flagsAndAttributes);
Expand Down