From d9983180bf6f11b8bd9e5adda512fb99c0b8bf0d Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Tue, 8 Sep 2020 09:41:51 -0700 Subject: [PATCH] Unblock Core build by fixing snippet error --- eng/SnippetGenerator/DirectoryProcessor.cs | 4 ++-- eng/SnippetGenerator/Program.cs | 20 +++++++++++++------ .../README.md | 2 +- .../tests/Samples/Sample01_ReadmeSnippets.cs | 2 +- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/eng/SnippetGenerator/DirectoryProcessor.cs b/eng/SnippetGenerator/DirectoryProcessor.cs index 5fc82cb7e959c..2f4f304458bf4 100644 --- a/eng/SnippetGenerator/DirectoryProcessor.cs +++ b/eng/SnippetGenerator/DirectoryProcessor.cs @@ -21,11 +21,11 @@ public class DirectoryProcessor private readonly Lazy> _snippets; private static readonly Regex _markdownOnlyRegex = new Regex( @"(?\s*)//@@\s*(?.*)", - RegexOptions.Compiled | RegexOptions.Singleline); + RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.CultureInvariant); private const string _codeOnlyPattern = "/*@@*/"; private static readonly Regex _regionRegex = new Regex( @"^(?\s*)(#region|#endregion)\s*(?.*)", - RegexOptions.Compiled | RegexOptions.Singleline); + RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.CultureInvariant); private UTF8Encoding _utf8EncodingWithoutBOM; diff --git a/eng/SnippetGenerator/Program.cs b/eng/SnippetGenerator/Program.cs index e05754c2424db..803f7f3ddc639 100644 --- a/eng/SnippetGenerator/Program.cs +++ b/eng/SnippetGenerator/Program.cs @@ -1,7 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; using System.IO; +using System.Linq; using System.Threading.Tasks; using McMaster.Extensions.CommandLineUtils; using Microsoft.CodeAnalysis.Options; @@ -20,12 +22,9 @@ public void OnExecuteAsync() var baseDirParent = Directory.GetParent(BasePath).Name; if (baseDirectory.Equals("sdk") || baseDirParent.Equals("sdk")) { - foreach (var sdkDir in Directory.GetDirectories(BasePath)) - { - new DirectoryProcessor(sdkDir).Process(); - } + Parallel.ForEach(Directory.GetDirectories(BasePath), sdkDir => new DirectoryProcessor(sdkDir).Process()); } - else + else { new DirectoryProcessor(BasePath).Process(); } @@ -33,7 +32,16 @@ public void OnExecuteAsync() public static int Main(string[] args) { - return CommandLineApplication.Execute(args); + try + { + return CommandLineApplication.Execute(args); + } + catch (Exception e) + { + Console.Error.WriteLine(e.ToString()); + return 1; + } + } } } diff --git a/sdk/schemaregistry/Microsoft.Azure.Data.SchemaRegistry.ApacheAvro/README.md b/sdk/schemaregistry/Microsoft.Azure.Data.SchemaRegistry.ApacheAvro/README.md index a46cd9d4ec391..0214cf7d47d50 100644 --- a/sdk/schemaregistry/Microsoft.Azure.Data.SchemaRegistry.ApacheAvro/README.md +++ b/sdk/schemaregistry/Microsoft.Azure.Data.SchemaRegistry.ApacheAvro/README.md @@ -41,7 +41,7 @@ The simpliest way is to use the [Azure portal][azure_portal] and navigate to you Once you have the Azure resource credentials and the Event Hubs namespace hostname, you can create the [SchemaRegistryClient][schema_registry_client]. You'll also need the [Azure.Identity][azure_identity] package to create the credential. -```C# Snippet:CreateSchemaRegistryClient +```C# Snippet:CreateSchemaRegistryClient2 string endpoint = ""; var credentials = new ClientSecretCredential( "", diff --git a/sdk/schemaregistry/Microsoft.Azure.Data.SchemaRegistry.ApacheAvro/tests/Samples/Sample01_ReadmeSnippets.cs b/sdk/schemaregistry/Microsoft.Azure.Data.SchemaRegistry.ApacheAvro/tests/Samples/Sample01_ReadmeSnippets.cs index 3daf069bca298..e230ac3ebb2c4 100644 --- a/sdk/schemaregistry/Microsoft.Azure.Data.SchemaRegistry.ApacheAvro/tests/Samples/Sample01_ReadmeSnippets.cs +++ b/sdk/schemaregistry/Microsoft.Azure.Data.SchemaRegistry.ApacheAvro/tests/Samples/Sample01_ReadmeSnippets.cs @@ -17,7 +17,7 @@ public class Sample01_ReadmeSnippets : SamplesBase",