Skip to content

Commit b38773e

Browse files
PowerShellTeamandyleejordan
authored andcommitted
Update files from Source Depot changeset [SD:709766]
Corresponds to 15b1623435d6a195d1e877ba5c43709d991f573a in psl-monad.
1 parent 9fbb63c commit b38773e

63 files changed

Lines changed: 1012 additions & 423 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1677,7 +1677,6 @@ public string Status
16771677
/// <summary>
16781678
///
16791679
/// </summary>
1680-
[ArchitectureSensitive]
16811680
protected override void ProcessRecord()
16821681
{
16831682

@@ -2065,7 +2064,6 @@ public string[] DependsOn
20652064
/// <summary>
20662065
/// Create the service
20672066
/// </summary>
2068-
[ArchitectureSensitive]
20692067
protected override void BeginProcessing()
20702068
{
20712069
Diagnostics.Assert(!String.IsNullOrEmpty(Name),

src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddType.cs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -490,13 +490,6 @@ public String[] ReferencedAssemblies
490490
internal bool referencedAssembliesSpecified = false;
491491
internal string[] referencedAssemblies = Utils.EmptyArray<string>();
492492

493-
/// <summary>
494-
/// Resolve referenced assembly from name or path to a platform specific form.
495-
/// </summary>
496-
/// <param name="referencedAssembly"></param>
497-
/// <returns></returns>
498-
internal abstract string ResolveReferencedAssembly(string referencedAssembly);
499-
500493
/// <summary>
501494
/// The path to the output assembly
502495
/// </summary>
@@ -998,7 +991,14 @@ private void LoadAssemblies(IEnumerable<string> assemblies)
998991
{
999992
foreach (string assemblyName in assemblies)
1000993
{
1001-
Assembly assembly = LoadFrom(ResolveReferencedAssembly(assemblyName));
994+
// CoreCLR doesn't allow re-load TPA assemblis with different API (i.e. we load them by name and now want to load by path).
995+
// LoadAssemblyHelper helps us avoid re-loading them, if they already loaded.
996+
Assembly assembly = LoadAssemblyHelper(assemblyName);
997+
if (assembly == null)
998+
{
999+
assembly = LoadFrom(ResolveReferencedAssembly(assemblyName));
1000+
}
1001+
10021002
if (passThru)
10031003
{
10041004
WriteTypes(assembly);
@@ -1072,7 +1072,7 @@ private void CheckTypesForDuplicates(Assembly assembly)
10721072

10731073
private bool InMemory { get { return String.IsNullOrEmpty(outputAssembly); } }
10741074

1075-
internal override string ResolveReferencedAssembly(string referencedAssembly)
1075+
private string ResolveReferencedAssembly(string referencedAssembly)
10761076
{
10771077
// if it's a path, resolve it
10781078
if (referencedAssembly.Contains(System.IO.Path.DirectorySeparatorChar) || referencedAssembly.Contains(System.IO.Path.AltDirectorySeparatorChar))
@@ -1143,6 +1143,9 @@ private Assembly LoadAssemblyHelper(string assemblyName)
11431143
// Generates a FileNotFoundException if you can't load the strong type.
11441144
// So we'll try from the short name.
11451145
catch (System.IO.FileNotFoundException) { }
1146+
// File load exception can happen, when we trying to load from the incorrect assembly name
1147+
// or file corrupted.
1148+
catch (System.IO.FileLoadException) { }
11461149

11471150
if (loadedAssembly != null)
11481151
return loadedAssembly;
@@ -1339,7 +1342,7 @@ internal override void PostSetLanguage(Language language)
13391342
// Internal mapping table from the shortcut name to the strong name
13401343
private static readonly Lazy<ConcurrentDictionary<string, string>> StrongNames = new Lazy<ConcurrentDictionary<string, string>>(InitializeStrongNameDictionary);
13411344

1342-
internal override string ResolveReferencedAssembly(string referencedAssembly)
1345+
private string ResolveReferencedAssembly(string referencedAssembly)
13431346
{
13441347
if (!String.Equals(System.IO.Path.GetExtension(referencedAssembly), ".dll", StringComparison.OrdinalIgnoreCase))
13451348
{

src/Microsoft.PowerShell.Commands.Utility/commands/utility/SetDateCommand.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ public DisplayHintType DisplayHint
8383
/// <summary>
8484
/// set the date
8585
/// </summary>
86-
[ArchitectureSensitive]
8786
protected override void ProcessRecord()
8887
{
8988
DateTime dateToUse;

src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1359,7 +1359,7 @@ private uint Run(CommandLineParameterParser cpp, bool isPrestartWarned)
13591359
inputFormat = cpp.InputFormat;
13601360
wasInitialCommandEncoded = cpp.WasInitialCommandEncoded;
13611361

1362-
ui.ReadFromStdin = cpp.ExplicitReadCommandsFromStdin || Console.IsInputRedirected;
1362+
ui.ReadFromStdin = cpp.ExplicitReadCommandsFromStdin || (Console.IsInputRedirected && !cpp.NonInteractive);
13631363
ui.NoPrompt = cpp.NoPrompt;
13641364
ui.ThrowOnReadAndPrompt = cpp.ThrowOnReadAndPrompt;
13651365
noExit = cpp.NoExit;

src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleShell.cs

Lines changed: 20 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -17,40 +17,28 @@ namespace Microsoft.PowerShell
1717
public static
1818
class ConsoleShell
1919
{
20-
/// <summary>
21-
/// Entry point in to ConsoleShell. This method is called by
22-
/// main of minishell.
23-
/// </summary>
24-
/// <param name="configuration">
25-
/// Configuration information which is used to create Runspace.
26-
/// </param>
27-
///
28-
/// <param name="bannerText">
29-
/// Banner text to be displayed by ConsoleHost
30-
/// </param>
31-
///
32-
/// <param name="helpText">
33-
/// Help text for minishell. This is displayed on 'minishell -?'.
34-
/// </param>
35-
///
36-
/// <param name="args">
37-
/// Commandline parameters specified by user.
38-
/// </param>
39-
///
40-
/// <returns>
41-
/// An integer value which should be used as exit code for the
42-
/// process.
43-
/// </returns>
44-
///
45-
public static
46-
int
47-
Start(RunspaceConfiguration configuration,
48-
string bannerText,
49-
string helpText,
50-
string[] args)
20+
#if CORECLR
21+
/// <summary>Entry point in to ConsoleShell. This method is called by main of minishell.</summary>
22+
/// <param name="bannerText">Banner text to be displayed by ConsoleHost</param>
23+
/// <param name="helpText">Help text for minishell. This is displayed on 'minishell -?'.</param>
24+
/// <param name="args">Commandline parameters specified by user.</param>
25+
/// <returns>An integer value which should be used as exit code for the process.</returns>
26+
public static int Start(string bannerText, string helpText, string[] args)
27+
{
28+
return Start(null, bannerText, helpText, null, args);
29+
}
30+
#else
31+
/// <summary>Entry point in to ConsoleShell. This method is called by main of minishell.</summary>
32+
/// <param name="configuration">Configuration information which is used to create Runspace.</param>
33+
/// <param name="bannerText">Banner text to be displayed by ConsoleHost</param>
34+
/// <param name="helpText">Help text for minishell. This is displayed on 'minishell -?'.</param>
35+
/// <param name="args">Commandline parameters specified by user.</param>
36+
/// <returns>An integer value which should be used as exit code for the process.</returns>
37+
public static int Start(RunspaceConfiguration configuration, string bannerText, string helpText, string[] args)
5138
{
5239
return Start(configuration, bannerText, helpText, null, args);
5340
}
41+
#endif
5442

5543
/// <summary>
5644
///
@@ -82,7 +70,7 @@ public static
8270
/// An integer value which should be used as exit code for the
8371
/// process.
8472
/// </returns>
85-
73+
8674
internal static
8775
int
8876
Start(RunspaceConfiguration configuration,

src/Microsoft.PowerShell.Security/security/CertificateProvider.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3843,7 +3843,6 @@ internal static class Crypt32Helpers
38433843
/// <summary>
38443844
/// get a list of store names at the specified location
38453845
/// </summary>
3846-
[ArchitectureSensitive]
38473846
internal static List<string> GetStoreNamesAtLocation(StoreLocation location)
38483847
{
38493848
Security.NativeMethods.CertStoreFlags locationFlag =

src/Microsoft.PowerShell.Security/security/Utils.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ internal static SecureString PromptForSecureString(PSHostUserInterface hostUI,
131131
///
132132
/// <remarks> </remarks>
133133
///
134-
[ArchitectureSensitive]
135134
internal static string GetStringFromSecureString(SecureString ss)
136135
{
137136
IntPtr p = Marshal.SecureStringToGlobalAllocUnicode(ss);
Binary file not shown.
3.41 KB
Binary file not shown.

0 commit comments

Comments
 (0)