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

join some declarations #4529

Merged
merged 1 commit into from
Jun 7, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,8 @@ private static void GetManagedNameAndHierarchy(MethodBase method, bool useClosed
/// </remarks>
public static MethodBase GetMethod(Assembly assembly, string managedTypeName, string managedMethodName)
{
Type? type;

var parsedManagedTypeName = ReflectionHelpers.ParseEscapedString(managedTypeName);
type = assembly.GetType(parsedManagedTypeName, throwOnError: false, ignoreCase: false);
var type = assembly.GetType(parsedManagedTypeName, throwOnError: false, ignoreCase: false);

if (type == null)
{
Expand Down Expand Up @@ -291,10 +289,8 @@ bool Filter(MemberInfo mbr, object? param)
return true;
}

MemberInfo[] methods;

var bindingFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static;
methods = type.FindMembers(MemberTypes.Method, bindingFlags, Filter, null);
var methods = type.FindMembers(MemberTypes.Method, bindingFlags, Filter, null);

return (MethodInfo?)(methods.Length switch
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,7 @@ private IEnumerable<string> GetTestExtensionsInternal(string extensionType)
var resolutionPaths = installContext.GetVisualStudioCommonLocations(vsInstallPath);
using (var assemblyResolver = new AssemblyResolver(resolutionPaths))
{
object? extensionManager;
object? settingsManager;

settingsManager = SettingsManagerType.GetMethod("CreateForApplication", new Type[] { typeof(string) })?.Invoke(null, new object[] { installContext.GetVisualStudioPath(vsInstallPath) });
var settingsManager = SettingsManagerType.GetMethod("CreateForApplication", new Type[] { typeof(string) })?.Invoke(null, new object[] { installContext.GetVisualStudioPath(vsInstallPath) });
if (settingsManager == null)
{
EqtTrace.Warning("VSExtensionManager : Unable to create settings manager");
Expand All @@ -98,7 +95,7 @@ private IEnumerable<string> GetTestExtensionsInternal(string extensionType)
try
{
// create extension manager
extensionManager = Activator.CreateInstance(ExtensionManagerServiceType, settingsManager);
var extensionManager = Activator.CreateInstance(ExtensionManagerServiceType, settingsManager);

if (extensionManager != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -665,10 +665,9 @@ public static IEnumerable<string> FilterCompatibleSources(Architecture chosenPla
bool isSettingIncompatible = IsSettingIncompatible(actualPlatform, chosenPlatform, actualFramework, chosenFramework);
if (isSettingIncompatible)
{
string incompatiblityMessage;
var onlyFileName = Path.GetFileName(source);
// Add message for incompatible sources.
incompatiblityMessage = string.Format(CultureInfo.CurrentCulture, OMResources.SourceIncompatible, onlyFileName, actualFramework.Name, actualPlatform);
var incompatiblityMessage = string.Format(CultureInfo.CurrentCulture, OMResources.SourceIncompatible, onlyFileName, actualFramework.Name, actualPlatform);

warnings.AppendLine(incompatiblityMessage);
incompatiblityFound = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ public void Initialize(string? argument)
string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestAdapterPathValueRequired));
}

string[] customAdaptersPath;

var testAdapterPaths = new List<string>();

// VSTS task add double quotes around TestAdapterpath. For example if user has given TestAdapter path C:\temp,
Expand All @@ -145,7 +143,7 @@ public void Initialize(string? argument)
}

testAdapterPaths.AddRange(SplitPaths(argument));
customAdaptersPath = testAdapterPaths.Distinct().ToArray();
var customAdaptersPath = testAdapterPaths.Distinct().ToArray();

_runSettingsManager.UpdateRunSettingsNode(RunSettingsPath, string.Join(";", customAdaptersPath));
_commandLineOptions.TestAdapterPath = customAdaptersPath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -692,8 +692,6 @@ public IVsTestConsoleWrapper GetVsTestConsoleWrapper(Dictionary<string, string?>

Console.WriteLine($"Console runner path: {consoleRunnerPath}");

VsTestConsoleWrapper vstestConsoleWrapper;

// Providing any environment variable to vstest.console will clear all existing environment variables,
// this works around it by copying all existing variables, and adding debug. But we only want to do that
// when we are setting any debug variables.
Expand All @@ -717,7 +715,7 @@ public IVsTestConsoleWrapper GetVsTestConsoleWrapper(Dictionary<string, string?>
consoleParameters.EnvironmentVariables = environmentVariables;
}

vstestConsoleWrapper = new VsTestConsoleWrapper(consoleRunnerPath, dotnetPath, consoleParameters);
var vstestConsoleWrapper = new VsTestConsoleWrapper(consoleRunnerPath, dotnetPath, consoleParameters);
vstestConsoleWrapper.StartSession();

return vstestConsoleWrapper;
Expand Down