Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unblock Core build by fixing snippet error #14966

Merged
1 commit merged into from
Sep 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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