Skip to content

Commit 052ae8f

Browse files
authored
Unblock Core build by fixing snippet error (#14966)
1 parent 23fd89a commit 052ae8f

File tree

4 files changed

+18
-10
lines changed

4 files changed

+18
-10
lines changed

eng/SnippetGenerator/DirectoryProcessor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ public class DirectoryProcessor
2121
private readonly Lazy<List<Snippet>> _snippets;
2222
private static readonly Regex _markdownOnlyRegex = new Regex(
2323
@"(?<indent>\s*)//@@\s*(?<line>.*)",
24-
RegexOptions.Compiled | RegexOptions.Singleline);
24+
RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.CultureInvariant);
2525
private const string _codeOnlyPattern = "/*@@*/";
2626
private static readonly Regex _regionRegex = new Regex(
2727
@"^(?<indent>\s*)(#region|#endregion)\s*(?<line>.*)",
28-
RegexOptions.Compiled | RegexOptions.Singleline);
28+
RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.CultureInvariant);
2929

3030
private UTF8Encoding _utf8EncodingWithoutBOM;
3131

eng/SnippetGenerator/Program.cs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4+
using System;
45
using System.IO;
6+
using System.Linq;
57
using System.Threading.Tasks;
68
using McMaster.Extensions.CommandLineUtils;
79
using Microsoft.CodeAnalysis.Options;
@@ -20,20 +22,26 @@ public void OnExecuteAsync()
2022
var baseDirParent = Directory.GetParent(BasePath).Name;
2123
if (baseDirectory.Equals("sdk") || baseDirParent.Equals("sdk"))
2224
{
23-
foreach (var sdkDir in Directory.GetDirectories(BasePath))
24-
{
25-
new DirectoryProcessor(sdkDir).Process();
26-
}
25+
Parallel.ForEach(Directory.GetDirectories(BasePath), sdkDir => new DirectoryProcessor(sdkDir).Process());
2726
}
28-
else
27+
else
2928
{
3029
new DirectoryProcessor(BasePath).Process();
3130
}
3231
}
3332

3433
public static int Main(string[] args)
3534
{
36-
return CommandLineApplication.Execute<Program>(args);
35+
try
36+
{
37+
return CommandLineApplication.Execute<Program>(args);
38+
}
39+
catch (Exception e)
40+
{
41+
Console.Error.WriteLine(e.ToString());
42+
return 1;
43+
}
44+
3745
}
3846
}
3947
}

sdk/schemaregistry/Microsoft.Azure.Data.SchemaRegistry.ApacheAvro/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ The simpliest way is to use the [Azure portal][azure_portal] and navigate to you
4141

4242
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.
4343

44-
```C# Snippet:CreateSchemaRegistryClient
44+
```C# Snippet:CreateSchemaRegistryClient2
4545
string endpoint = "<event_hubs_namespace_hostname>";
4646
var credentials = new ClientSecretCredential(
4747
"<tenant_id>",

sdk/schemaregistry/Microsoft.Azure.Data.SchemaRegistry.ApacheAvro/tests/Samples/Sample01_ReadmeSnippets.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class Sample01_ReadmeSnippets : SamplesBase<SchemaRegistryClientTestEnvir
1717
[Test]
1818
public void CreateSchemaRegistryClient()
1919
{
20-
#region Snippet:CreateSchemaRegistryClient
20+
#region Snippet:CreateSchemaRegistryClient2
2121
string endpoint = "<event_hubs_namespace_hostname>";
2222
var credentials = new ClientSecretCredential(
2323
"<tenant_id>",

0 commit comments

Comments
 (0)