From 0e5478822a9495c96f02f3f8b71b90036149359f Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Thu, 27 Aug 2026 14:08:44 -0700 Subject: [PATCH 1/2] Modernize snippets --- .../EventLogInformation/Attributes/Project.csproj | 12 ++++++++++++ .../EventLogInformation/Attributes/attributes.cs | 9 ++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 snippets/csharp/System.Diagnostics.Eventing.Reader/EventLogInformation/Attributes/Project.csproj diff --git a/snippets/csharp/System.Diagnostics.Eventing.Reader/EventLogInformation/Attributes/Project.csproj b/snippets/csharp/System.Diagnostics.Eventing.Reader/EventLogInformation/Attributes/Project.csproj new file mode 100644 index 00000000000..1f10bd38c58 --- /dev/null +++ b/snippets/csharp/System.Diagnostics.Eventing.Reader/EventLogInformation/Attributes/Project.csproj @@ -0,0 +1,12 @@ + + + + Exe + net10.0-windows + + + + + + + diff --git a/snippets/csharp/System.Diagnostics.Eventing.Reader/EventLogInformation/Attributes/attributes.cs b/snippets/csharp/System.Diagnostics.Eventing.Reader/EventLogInformation/Attributes/attributes.cs index c28b52bf7ac..9d1907d9982 100644 --- a/snippets/csharp/System.Diagnostics.Eventing.Reader/EventLogInformation/Attributes/attributes.cs +++ b/snippets/csharp/System.Diagnostics.Eventing.Reader/EventLogInformation/Attributes/attributes.cs @@ -1,7 +1,10 @@ -// -using System.Diagnostics.Eventing.Reader; +using System.Diagnostics.Eventing.Reader; using System.IO; -EventLogInformation eventLogInformation; +using EventLogSession session = new(); +EventLogInformation eventLogInformation = + session.GetLogInformation("Application", PathType.LogName); + +// FileAttributes? fileAttributes = (FileAttributes?)eventLogInformation.Attributes; // From 43514ce6e5c75a037f563dfd58b4f1265c4ff1d3 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Thu, 27 Aug 2026 15:27:11 -0700 Subject: [PATCH 2/2] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .../EventLogInformation/Attributes/Project.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/csharp/System.Diagnostics.Eventing.Reader/EventLogInformation/Attributes/Project.csproj b/snippets/csharp/System.Diagnostics.Eventing.Reader/EventLogInformation/Attributes/Project.csproj index 1f10bd38c58..543f1390dc5 100644 --- a/snippets/csharp/System.Diagnostics.Eventing.Reader/EventLogInformation/Attributes/Project.csproj +++ b/snippets/csharp/System.Diagnostics.Eventing.Reader/EventLogInformation/Attributes/Project.csproj @@ -2,7 +2,7 @@ Exe - net10.0-windows + net10.0