Skip to content

upgrade Azure.Core to 1.2.2 #12253

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

Merged
merged 1 commit into from
Jun 29, 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
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static class CustomAssemblyResolver
private static IDictionary<string, Version> NetFxPreloadAssemblies =
new Dictionary<string, Version>(StringComparer.InvariantCultureIgnoreCase)
{
{"Azure.Core", new Version("1.2.1.0")},
{"Azure.Core", new Version("1.2.2.0")},
{"Microsoft.Bcl.AsyncInterfaces", new Version("1.0.0.0")},
{"Microsoft.IdentityModel.Clients.ActiveDirectory", new Version("3.19.2.6005")},
{"Microsoft.IdentityModel.Clients.ActiveDirectory.Platform", new Version("3.19.2.6005")},
Expand Down
Binary file modified src/lib/NetCorePreloadAssemblies/Azure.Core.dll
Binary file not shown.
Binary file modified src/lib/NetFxPreloadAssemblies/Azure.Core.dll
Binary file not shown.
56 changes: 41 additions & 15 deletions tools/StaticAnalysis/HelpAnalyzer/HelpAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using System.IO;
using System.Linq;
using System.Management.Automation;
using System.Reflection;
using System.Text.RegularExpressions;
using Tools.Common.Issues;
using Tools.Common.Loaders;
Expand All @@ -43,7 +44,7 @@ public HelpAnalyzer()
public AnalysisLogger Logger { get; set; }
public string Name { get; private set; }

// TODO: Remove IfDef code
// TODO: Remove IfDef code
#if !NETSTANDARD
private AppDomain _appDomain;
#endif
Expand Down Expand Up @@ -95,6 +96,7 @@ public void Analyze(IEnumerable<string> scopes, IEnumerable<string> modulesToAna
var helpLogger = Logger.CreateLogger<HelpIssue>("HelpIssues.csv");
foreach (var baseDirectory in scopes.Where(s => Directory.Exists(Path.GetFullPath(s))))
{
PreloadSharedAssemblies(baseDirectory);
foreach (var directory in Directory.EnumerateDirectories(Path.GetFullPath(baseDirectory)))
{
if (modulesToAnalyze != null &&
Expand All @@ -114,6 +116,30 @@ public void Analyze(IEnumerable<string> scopes, IEnumerable<string> modulesToAna
}
}

private static void PreloadSharedAssemblies(string directory)
{
var sharedAssemblyFolder = Path.Combine(directory, "Az.Accounts", "NetCoreAssemblies");
if (Directory.Exists(sharedAssemblyFolder))
{
foreach (var file in Directory.GetFiles(sharedAssemblyFolder))
{
try
{
Console.WriteLine($"PreloadSharedAssemblies: Starting to load assembly {file}.");
Assembly.LoadFrom(file);
}
catch (Exception e)
{
Console.WriteLine($"PreloadSharedAssemblies: Failed to load assembly {Path.GetFileNameWithoutExtension(file)} with {e}");
}
}
}
else
{
Console.WriteLine($"PreloadSharedAssemblies: Could not find directory {sharedAssemblyFolder}.");
}
}

private void AnalyzeMamlHelp(
IEnumerable<string> scopes,
string directory,
Expand Down Expand Up @@ -158,7 +184,7 @@ private void AnalyzeMamlHelp(
h.Assembly = cmdletFileName;
}, "Cmdlet");

// TODO: Remove IfDef
// TODO: Remove IfDef
#if NETSTANDARD
var proxy = new CmdletLoader();
#else
Expand All @@ -169,7 +195,7 @@ private void AnalyzeMamlHelp(
var helpRecords = CmdletHelpParser.GetHelpTopics(helpFile, helpLogger);
ValidateHelpRecords(cmdlets, helpRecords, helpLogger);
helpLogger.Decorator.Remove("Cmdlet");
// TODO: Remove IfDef code
// TODO: Remove IfDef code
#if !NETSTANDARD
AppDomain.Unload(_appDomain);
#endif
Expand Down Expand Up @@ -229,13 +255,13 @@ private void AnalyzeMarkdownHelp(
powershell.AddScript(script);
var cmdletResult = powershell.Invoke();
var nestedModules = new List<string>();
foreach(var module in cmdletResult)
foreach (var module in cmdletResult)
{
if(module != null && module.ToString().StartsWith("."))
if (module != null && module.ToString().StartsWith("."))
{
nestedModules.Add(module.ToString().Substring(2));
}
else if(module != null)
}
else if (module != null)
{
nestedModules.Add(module.ToString());
}
Expand Down Expand Up @@ -270,7 +296,7 @@ private void AnalyzeMarkdownHelp(
h.Assembly = assemblyFileName;
}, "Cmdlet");
processedHelpFiles.Add(assemblyFileName);
// TODO: Remove IfDef
// TODO: Remove IfDef
#if NETSTANDARD
var proxy = new CmdletLoader();
#else
Expand All @@ -280,7 +306,7 @@ private void AnalyzeMarkdownHelp(
var cmdlets = module.Cmdlets;
allCmdlets.AddRange(cmdlets);
helpLogger.Decorator.Remove("Cmdlet");
// TODO: Remove IfDef code
// TODO: Remove IfDef code
#if !NETSTANDARD
AppDomain.Unload(_appDomain);
#endif
Expand All @@ -290,7 +316,7 @@ private void AnalyzeMarkdownHelp(
script = $"Import-LocalizedData -BaseDirectory {parentDirectory} -FileName {psd1FileName} -BindingVariable ModuleMetadata; $ModuleMetadata.FunctionsToExport;";
cmdletResult = PowerShell.Create().AddScript(script).Invoke();
var functionCmdlets = cmdletResult.Select(c => c.ToString()).ToList();
foreach(var cmdlet in functionCmdlets)
foreach (var cmdlet in functionCmdlets)
{
var metadata = new CmdletMetadata();
metadata.VerbName = cmdlet.Split("-")[0];
Expand All @@ -302,7 +328,7 @@ private void AnalyzeMarkdownHelp(
ValidateHelpMarkdown(helpFolder, helpFiles, helpLogger);

Directory.SetCurrentDirectory(savedDirectory);

}

private void ValidateHelpRecords(IList<CmdletMetadata> cmdlets, IList<string> helpRecords,
Expand All @@ -321,7 +347,7 @@ private void ValidateHelpRecords(IList<CmdletMetadata> cmdlets, IList<string> he
ProblemId = MissingHelp,
Remediation = string.Format("Add Help record for cmdlet {0} to help file.", cmdlet.Name)
};
if(cmdlet.ClassName != null)
if (cmdlet.ClassName != null)
{
issue.Description = $"Help missing for cmdlet {cmdlet.Name} implemented by class {cmdlet.ClassName}";
}
Expand All @@ -335,16 +361,16 @@ private void ValidateHelpRecords(IList<CmdletMetadata> cmdlets, IList<string> he

foreach (var helpRecord in helpRecords)
{
if(!cmdletDict.ContainsKey(helpRecord))
if (!cmdletDict.ContainsKey(helpRecord))
{
Console.Error.WriteLine($"Help record {helpRecord} has no cmdlet.");
}
}
}
}

private void ValidateHelpMarkdown(string helpFolder, IList<string> helpRecords, ReportLogger<HelpIssue> helpLogger)
{
foreach(var helpMarkdown in helpRecords)
foreach (var helpMarkdown in helpRecords)
{
var file = Path.Combine(helpFolder, helpMarkdown + ".md");
var content = File.ReadAllText(file);
Expand Down