Skip to content

Commit

Permalink
Unblock Core build by fixing snippet error (#14966)
Browse files Browse the repository at this point in the history
  • Loading branch information
pakrym authored Sep 8, 2020
1 parent 23fd89a commit 052ae8f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
4 changes: 2 additions & 2 deletions eng/SnippetGenerator/DirectoryProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ public class DirectoryProcessor
private readonly Lazy<List<Snippet>> _snippets;
private static readonly Regex _markdownOnlyRegex = new Regex(
@"(?<indent>\s*)//@@\s*(?<line>.*)",
RegexOptions.Compiled | RegexOptions.Singleline);
RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.CultureInvariant);
private const string _codeOnlyPattern = "/*@@*/";
private static readonly Regex _regionRegex = new Regex(
@"^(?<indent>\s*)(#region|#endregion)\s*(?<line>.*)",
RegexOptions.Compiled | RegexOptions.Singleline);
RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.CultureInvariant);

private UTF8Encoding _utf8EncodingWithoutBOM;

Expand Down
20 changes: 14 additions & 6 deletions eng/SnippetGenerator/Program.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -20,20 +22,26 @@ 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();
}
}

public static int Main(string[] args)
{
return CommandLineApplication.Execute<Program>(args);
try
{
return CommandLineApplication.Execute<Program>(args);
}
catch (Exception e)
{
Console.Error.WriteLine(e.ToString());
return 1;
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<event_hubs_namespace_hostname>";
var credentials = new ClientSecretCredential(
"<tenant_id>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class Sample01_ReadmeSnippets : SamplesBase<SchemaRegistryClientTestEnvir
[Test]
public void CreateSchemaRegistryClient()
{
#region Snippet:CreateSchemaRegistryClient
#region Snippet:CreateSchemaRegistryClient2
string endpoint = "<event_hubs_namespace_hostname>";
var credentials = new ClientSecretCredential(
"<tenant_id>",
Expand Down

0 comments on commit 052ae8f

Please sign in to comment.