From c626b2c94c3a4813410a3e27fd61661dfe33ff1e Mon Sep 17 00:00:00 2001 From: Jason Johnston Date: Wed, 3 Dec 2025 11:01:59 -0500 Subject: [PATCH 1/3] Change snippet marker comment format The `/* */` lines don't work with OPS --- .editorconfig | 2 ++ app-auth/GraphAppOnlyTutorial/GraphHelper.cs | 16 +++++------ app-auth/GraphAppOnlyTutorial/Program.cs | 20 +++++++------- app-auth/GraphAppOnlyTutorial/Settings.cs | 4 ++- user-auth/GraphTutorial/GraphHelper.cs | 24 ++++++++--------- user-auth/GraphTutorial/Program.cs | 28 ++++++++++---------- user-auth/GraphTutorial/Settings.cs | 6 +++-- 7 files changed, 53 insertions(+), 47 deletions(-) diff --git a/.editorconfig b/.editorconfig index c1a9688..aa7ff6f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -6,6 +6,8 @@ insert_final_newline = true [*.{cs,cshtml}] indent_size = 4 dotnet_diagnostic.SA1101.severity = silent +dotnet_diagnostic.SA1512.severity = silent dotnet_diagnostic.SA1513.severity = silent +dotnet_diagnostic.SA1515.severity = silent dotnet_diagnostic.SA1600.severity = silent dotnet_diagnostic.CS1591.severity = silent diff --git a/app-auth/GraphAppOnlyTutorial/GraphHelper.cs b/app-auth/GraphAppOnlyTutorial/GraphHelper.cs index 63df230..796e86c 100644 --- a/app-auth/GraphAppOnlyTutorial/GraphHelper.cs +++ b/app-auth/GraphAppOnlyTutorial/GraphHelper.cs @@ -10,7 +10,7 @@ namespace GraphAppOnlyTutorial; public class GraphHelper { - /* */ + // // Settings object private static Settings? settings; @@ -39,9 +39,9 @@ public static void InitializeGraphForAppOnlyAuth(Settings settings) configured on the app registration */ ["https://graph.microsoft.com/.default"]); } - /* */ + // - /* */ + // public static async Task GetAppOnlyTokenAsync() { // Ensure credential isn't null @@ -53,9 +53,9 @@ public static async Task GetAppOnlyTokenAsync() var response = await clientSecretCredential.GetTokenAsync(context); return response.Token; } - /* */ + // - /* */ + // public static Task GetUsersAsync() { // Ensure client isn't null @@ -72,15 +72,15 @@ public static async Task GetAppOnlyTokenAsync() config.QueryParameters.Orderby = ["displayName"]; }); } - /* */ + // #pragma warning disable CS1998 - /* */ + // /* This function serves as a playground for testing Graph snippets or other code */ public static async Task MakeGraphCallAsync() { // INSERT YOUR CODE HERE } - /* */ + // } diff --git a/app-auth/GraphAppOnlyTutorial/Program.cs b/app-auth/GraphAppOnlyTutorial/Program.cs index cc091a4..c96f2aa 100644 --- a/app-auth/GraphAppOnlyTutorial/Program.cs +++ b/app-auth/GraphAppOnlyTutorial/Program.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -/* */ +// using GraphAppOnlyTutorial; Console.WriteLine(".NET Graph App-only Tutorial\n"); @@ -54,16 +54,16 @@ break; } } -/* */ +// -/* */ +// void InitializeGraph(Settings settings) { GraphHelper.InitializeGraphForAppOnlyAuth(settings); } -/* */ +// -/* */ +// async Task DisplayAccessTokenAsync() { try @@ -76,9 +76,9 @@ async Task DisplayAccessTokenAsync() Console.WriteLine($"Error getting app-only access token: {ex.Message}"); } } -/* */ +// -/* */ +// async Task ListUsersAsync() { try @@ -113,11 +113,11 @@ async Task ListUsersAsync() Console.WriteLine($"Error getting users: {ex.Message}"); } } -/* */ +// -/* */ +// async Task MakeGraphCallAsync() { await GraphHelper.MakeGraphCallAsync(); } -/* */ +// diff --git a/app-auth/GraphAppOnlyTutorial/Settings.cs b/app-auth/GraphAppOnlyTutorial/Settings.cs index 279929c..5943ff3 100644 --- a/app-auth/GraphAppOnlyTutorial/Settings.cs +++ b/app-auth/GraphAppOnlyTutorial/Settings.cs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. +// cSpell:ignore appsettings + /* */ using Microsoft.Extensions.Configuration; @@ -30,4 +32,4 @@ public static Settings LoadSettings() throw new Exception("Could not load app settings. See README for configuration instructions."); } } -/* */ +// diff --git a/user-auth/GraphTutorial/GraphHelper.cs b/user-auth/GraphTutorial/GraphHelper.cs index c92e1ab..a3ac9d3 100644 --- a/user-auth/GraphTutorial/GraphHelper.cs +++ b/user-auth/GraphTutorial/GraphHelper.cs @@ -11,7 +11,7 @@ namespace GraphTutorial; public class GraphHelper { - /* */ + // // Settings object private static Settings? settings; @@ -38,9 +38,9 @@ public static void InitializeGraphForUserAuth( userClient = new GraphServiceClient(deviceCodeCredential, settings.GraphUserScopes); } - /* */ + // - /* */ + // public static async Task GetUserTokenAsync() { // Ensure credential isn't null @@ -55,9 +55,9 @@ public static async Task GetUserTokenAsync() var response = await deviceCodeCredential.GetTokenAsync(context); return response.Token; } - /* */ + // - /* */ + // public static Task GetUserAsync() { // Ensure client isn't null @@ -70,9 +70,9 @@ public static async Task GetUserTokenAsync() config.QueryParameters.Select = ["displayName", "mail", "userPrincipalName"]; }); } - /* */ + // - /* */ + // public static Task GetInboxAsync() { // Ensure client isn't null @@ -92,9 +92,9 @@ public static async Task GetUserTokenAsync() config.QueryParameters.Orderby = ["receivedDateTime DESC"]; }); } - /* */ + // - /* */ + // public static async Task SendMailAsync(string subject, string body, string recipient) { // Ensure client isn't null @@ -130,15 +130,15 @@ await userClient.Me Message = message, }); } - /* */ + // #pragma warning disable CS1998 - /* */ + // /* This function serves as a playground for testing Graph snippets */ /* or other code */ public static async Task MakeGraphCallAsync() { // INSERT YOUR CODE HERE } - /* */ + // } diff --git a/user-auth/GraphTutorial/Program.cs b/user-auth/GraphTutorial/Program.cs index d0c36ed..ef95c8c 100644 --- a/user-auth/GraphTutorial/Program.cs +++ b/user-auth/GraphTutorial/Program.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -/* */ +// using GraphTutorial; Console.WriteLine(".NET Graph Tutorial\n"); @@ -62,9 +62,9 @@ break; } } -/* */ +// -/* */ +// void InitializeGraph(Settings settings) { GraphHelper.InitializeGraphForUserAuth( @@ -79,9 +79,9 @@ void InitializeGraph(Settings settings) return Task.FromResult(0); }); } -/* */ +// -/* */ +// async Task GreetUserAsync() { try @@ -98,9 +98,9 @@ async Task GreetUserAsync() Console.WriteLine($"Error getting user: {ex.Message}"); } } -/* */ +// -/* */ +// async Task DisplayAccessTokenAsync() { try @@ -113,9 +113,9 @@ async Task DisplayAccessTokenAsync() Console.WriteLine($"Error getting user access token: {ex.Message}"); } } -/* */ +// -/* */ +// async Task ListInboxAsync() { try @@ -151,9 +151,9 @@ async Task ListInboxAsync() Console.WriteLine($"Error getting user's inbox: {ex.Message}"); } } -/* */ +// -/* */ +// async Task SendMailAsync() { try @@ -182,11 +182,11 @@ await GraphHelper.SendMailAsync( Console.WriteLine($"Error sending mail: {ex.Message}"); } } -/* */ +// -/* */ +// async Task MakeGraphCallAsync() { await GraphHelper.MakeGraphCallAsync(); } -/* */ +// diff --git a/user-auth/GraphTutorial/Settings.cs b/user-auth/GraphTutorial/Settings.cs index f02c4f9..a0301f2 100644 --- a/user-auth/GraphTutorial/Settings.cs +++ b/user-auth/GraphTutorial/Settings.cs @@ -1,7 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -/* */ +// cSpell:ignore appsettings + +// using Microsoft.Extensions.Configuration; namespace GraphTutorial; @@ -30,4 +32,4 @@ public static Settings LoadSettings() throw new Exception("Could not load app settings. See README for configuration instructions."); } } -/* */ +// From a210e6e962672877e3ed1f33b07b881fbf77c7c1 Mon Sep 17 00:00:00 2001 From: Jason Johnston Date: Wed, 3 Dec 2025 11:04:20 -0500 Subject: [PATCH 2/3] Update to .NET 10 --- .vscode/launch.json | 4 ++-- .../GraphAppOnlyTutorial/GraphAppOnlyTutorial.csproj | 10 +++++----- user-auth/GraphTutorial/GraphTutorial.csproj | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 6f1f61b..3df1ee2 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -10,7 +10,7 @@ "request": "launch", "preLaunchTask": "build user-auth", // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceFolder}/user-auth/GraphTutorial/bin/Debug/net9.0/GraphTutorial.dll", + "program": "${workspaceFolder}/user-auth/GraphTutorial/bin/Debug/net10.0/GraphTutorial.dll", "args": [], "cwd": "${workspaceFolder}/user-auth/GraphTutorial", // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console @@ -26,7 +26,7 @@ "request": "launch", "preLaunchTask": "build app-auth", // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceFolder}/app-auth/GraphAppOnlyTutorial/bin/Debug/net9.0/GraphAppOnlyTutorial.dll", + "program": "${workspaceFolder}/app-auth/GraphAppOnlyTutorial/bin/Debug/net10.0/GraphAppOnlyTutorial.dll", "args": [], "cwd": "${workspaceFolder}/app-auth/GraphAppOnlyTutorial", // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console diff --git a/app-auth/GraphAppOnlyTutorial/GraphAppOnlyTutorial.csproj b/app-auth/GraphAppOnlyTutorial/GraphAppOnlyTutorial.csproj index 444a57b..f4c632a 100644 --- a/app-auth/GraphAppOnlyTutorial/GraphAppOnlyTutorial.csproj +++ b/app-auth/GraphAppOnlyTutorial/GraphAppOnlyTutorial.csproj @@ -1,10 +1,10 @@ - + Exe - net9.0 + net10.0 enable enable 2275df63-2eb2-47b9-a11f-710535686d4b @@ -23,9 +23,9 @@ - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/user-auth/GraphTutorial/GraphTutorial.csproj b/user-auth/GraphTutorial/GraphTutorial.csproj index 55515b0..fdabd55 100644 --- a/user-auth/GraphTutorial/GraphTutorial.csproj +++ b/user-auth/GraphTutorial/GraphTutorial.csproj @@ -1,9 +1,9 @@ - + Exe - net9.0 + net10.0 enable enable 2275df63-2eb2-47b9-a11f-710535686d4b @@ -22,9 +22,9 @@ - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive From 55eeaff2315e918678df22dddeba0aad69223f35 Mon Sep 17 00:00:00 2001 From: Jason Johnston Date: Wed, 3 Dec 2025 11:06:04 -0500 Subject: [PATCH 3/3] Update dotnet.yml --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 2a4e324..15ebbe8 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -16,7 +16,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v5 with: - dotnet-version: 9.x + dotnet-version: 10.x - name: Restore dependencies working-directory: user-auth/GraphTutorial/ run: dotnet restore