Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
[Feature] fix macOS build + 1st attempt to address review comments
  • Loading branch information
daxian-dbw committed Nov 30, 2018
commit 35abe344bfa3f86f1b94c2f5e5bd317e2fcd3cdc
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dotnet-uninstall-debian-packages.sh
# Visual Studio IDE directory
.vs/

# VS Code directory
# VSCode directories that are not at the repository root
/**/.vscode/
Comment thread
daxian-dbw marked this conversation as resolved.
Outdated

# Project Rider IDE files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private List<string> GetApplicableAccessRights(int accessMask, AccessRightTypeNa
{
foreach (string memberName in Enum.GetNames(accessRightType))
{
int memberValue = (int) Enum.Parse(accessRightType, memberName);
int memberValue = (int)Enum.Parse(accessRightType, memberName);
if (!foundAccessRightValues.Contains(memberValue))
{
foundAccessRightValues.Add(memberValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,32 @@ public enum TextEncodingType
Ascii,
}

/// <summary>
/// Utility class to contain resources for the Microsoft.PowerShell.Utility module.
/// </summary>
[Obsolete("This class is obsolete", true)]
public static class UtilityResources
{
/// <summary>
/// </summary>
public static string PathDoesNotExist { get { return UtilityCommonStrings.PathDoesNotExist; } }
/// <summary>
/// </summary>
public static string FileReadError { get { return UtilityCommonStrings.FileReadError; } }
/// <summary>
/// The resource string used to indicate 'PATH:' in the formating header.
/// </summary>
public static string FormatHexPathPrefix { get { return UtilityCommonStrings.FormatHexPathPrefix; } }
/// <summary>
/// Error message to indicate that requested algorithm is not supported on the target platform.
/// </summary>
public static string AlgorithmTypeNotSupported { get { return UtilityCommonStrings.AlgorithmTypeNotSupported; } }
/// <summary>
/// The file '{0}' could not be parsed as a PowerShell Data File.
/// </summary>
public static string CouldNotParseAsPowerShellDataFile { get { return UtilityCommonStrings.CouldNotParseAsPowerShellDataFile; } }
}

/// <summary>
/// ByteCollection is used as a wrapper class for the collection of bytes.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@
<data name="FormatHexOnlySupportsFileSystemPaths" xml:space="preserve">
<value>The given path '{0}' is not supported. This command only supports the FileSystem Provider paths.</value>
</data>
<data name="FormatHexPathPrefix" xml:space="preserve">
<value>Path: </value>
</data>
<data name="GroupObjectWithHashTable" xml:space="preserve">
<value>The command cannot be run because the AsString parameter requires that you specify the AsHashtable parameter.</value>
</data>
Expand Down
1 change: 1 addition & 0 deletions src/ResGen/ResGen.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<TargetFramework>netcoreapp2.0</TargetFramework>
<AssemblyName>resgen</AssemblyName>
<OutputType>Exe</OutputType>
<TieredCompilation>true</TieredCompilation>
<RuntimeIdentifiers>win7-x86;win7-x64;osx-x64;linux-x64</RuntimeIdentifiers>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,9 @@ private ExperimentAction EffectiveAction
}

/// <summary>
/// A readonly Hashset
/// A readonly Hashset.
/// </summary>
public sealed class ReadOnlyHashSet<T> : ISet<T>
internal sealed class ReadOnlyHashSet<T> : ISet<T>
{
private HashSet<T> _hashset;

Expand All @@ -362,7 +362,7 @@ internal ReadOnlyHashSet(HashSet<T> hashset)
/// <summary>
/// Get an empty singleton.
/// </summary>
public static readonly ReadOnlyHashSet<T> Empty = new ReadOnlyHashSet<T>(new HashSet<T>(capacity: 0));
internal static readonly ReadOnlyHashSet<T> Empty = new ReadOnlyHashSet<T>(new HashSet<T>(capacity: 0));

/// <summary>
/// Get the count of the Hashset.
Expand All @@ -377,160 +377,37 @@ internal ReadOnlyHashSet(HashSet<T> hashset)
/// <summary>
/// Check if the set contains an item.
/// </summary>
public bool Contains(T item)
{
return _hashset.Contains(item);
}
public bool Contains(T item) => _hashset.Contains(item);

/// <summary>
/// Copy items to an array.
/// </summary>
public void CopyTo(T[] array, int arrayIndex)
{
_hashset.CopyTo(array, arrayIndex);
}
public void CopyTo(T[] array, int arrayIndex) => _hashset.CopyTo(array, arrayIndex);

/// <summary>
/// GetEnumerator method.
/// </summary>
public IEnumerator<T> GetEnumerator()
{
return _hashset.GetEnumerator();
}

/// <summary>
/// IsProperSubsetOf method.
/// </summary>
public bool IsProperSubsetOf(IEnumerable<T> other)
{
return _hashset.IsProperSubsetOf(other);
}

/// <summary>
/// IsProperSupersetOf method.
/// </summary>
public bool IsProperSupersetOf(IEnumerable<T> other)
{
return _hashset.IsProperSupersetOf(other);
}

/// <summary>
/// IsSubsetOf method.
/// </summary>
public bool IsSubsetOf(IEnumerable<T> other)
{
return _hashset.IsSubsetOf(other);
}

/// <summary>
/// IsSupersetOf method.
/// </summary>
public bool IsSupersetOf(IEnumerable<T> other)
{
return _hashset.IsSupersetOf(other);
}

/// <summary>
/// Overlaps method.
/// </summary>
public bool Overlaps(IEnumerable<T> other)
{
return _hashset.Overlaps(other);
}

/// <summary>
/// SetEquals method.
/// </summary>
public bool SetEquals(IEnumerable<T> other)
{
return _hashset.SetEquals(other);
}

/// <summary>
/// Add method.
/// </summary>
/// <exception cref="NotSupportedException">
/// Not supported for a readonly Hashset.
/// </exception>
public bool Add(T item)
{
throw new NotSupportedException();
}
public IEnumerator<T> GetEnumerator() => _hashset.GetEnumerator();

/// <summary>
/// Remove method.
/// </summary>
/// <exception cref="NotSupportedException">
/// Not supported for a readonly Hashset.
/// </exception>
public bool Remove(T item)
{
throw new NotSupportedException();
}
#region NonPublic Interface Member Implementation

/// <summary>
/// Clear method.
/// </summary>
/// <exception cref="NotSupportedException">
/// Not supported for a readonly Hashset.
/// </exception>
public void Clear()
{
throw new NotSupportedException();
}
bool ISet<T>.IsProperSubsetOf(IEnumerable<T> other) => _hashset.IsProperSubsetOf(other);
bool ISet<T>.IsProperSupersetOf(IEnumerable<T> other) => _hashset.IsProperSupersetOf(other);
bool ISet<T>.IsSubsetOf(IEnumerable<T> other) => _hashset.IsSubsetOf(other);
bool ISet<T>.IsSupersetOf(IEnumerable<T> other) => _hashset.IsSupersetOf(other);
bool ISet<T>.Overlaps(IEnumerable<T> other) => _hashset.Overlaps(other);
bool ISet<T>.SetEquals(IEnumerable<T> other) => _hashset.SetEquals(other);
IEnumerator IEnumerable.GetEnumerator() => _hashset.GetEnumerator();

/// <summary>
/// ExceptWith method.
/// </summary>
/// <exception cref="NotSupportedException">
/// Not supported for a readonly Hashset.
/// </exception>
public void ExceptWith(IEnumerable<T> other)
{
throw new NotSupportedException();
}
bool ISet<T>.Add(T item) => throw new NotSupportedException();
void ISet<T>.ExceptWith(IEnumerable<T> other) => throw new NotSupportedException();
void ISet<T>.IntersectWith(IEnumerable<T> other) => throw new NotSupportedException();
void ISet<T>.SymmetricExceptWith(IEnumerable<T> other) => throw new NotSupportedException();
void ISet<T>.UnionWith(IEnumerable<T> other) => throw new NotSupportedException();
void ICollection<T>.Add(T item) => throw new NotSupportedException();
void ICollection<T>.Clear() => throw new NotSupportedException();
bool ICollection<T>.Remove(T item) => throw new NotSupportedException();

/// <summary>
/// IntersectWith method.
/// </summary>
/// <exception cref="NotSupportedException">
/// Not supported for a readonly Hashset.
/// </exception>
public void IntersectWith(IEnumerable<T> other)
{
throw new NotSupportedException();
}

/// <summary>
/// SymmetricExceptWith method.
/// </summary>
/// <exception cref="NotSupportedException">
/// Not supported for a readonly Hashset.
/// </exception>
public void SymmetricExceptWith(IEnumerable<T> other)
{
throw new NotSupportedException();
}

/// <summary>
/// UnionWith method.
/// </summary>
/// <exception cref="NotSupportedException">
/// Not supported for a readonly Hashset.
/// </exception>
public void UnionWith(IEnumerable<T> other)
{
throw new NotSupportedException();
}

void ICollection<T>.Add(T item)
{
throw new NotSupportedException();
}

IEnumerator IEnumerable.GetEnumerator()
{
return _hashset.GetEnumerator();
}
#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Management.Automation.Configuration;
using System.Management.Automation.Internal;
Expand Down Expand Up @@ -50,10 +49,7 @@ internal CompiledScriptBlockData(IParameterMetadataProvider ast, bool isFilter)

internal CompiledScriptBlockData(string scriptText, bool isProductCode)
{
if (isProductCode)
{
_isProductCode = true;
}
_isProductCode = isProductCode;
_scriptText = scriptText;
this.Id = Guid.NewGuid();
}
Expand Down Expand Up @@ -203,8 +199,7 @@ private void PerformSecurityChecks()
var scriptFile = scriptExtent.File;

if (scriptFile != null &&
StringLiterals.PowerShellDataFileExtension.Equals(
Path.GetExtension(scriptFile), StringComparison.OrdinalIgnoreCase)
scriptFile.EndsWith(StringLiterals.PowerShellDataFileExtension, StringComparison.OrdinalIgnoreCase)
Comment thread
daxian-dbw marked this conversation as resolved.
Outdated
&& !ForceMaliciousCodeScan)
{
// Skip the check for .psd1 files, unless it's being executed by 'Import-LocalizedData',
Expand Down
1 change: 1 addition & 0 deletions src/TypeCatalogGen/TypeCatalogGen.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<TargetFramework>netcoreapp2.0</TargetFramework>
<AssemblyName>TypeCatalogGen</AssemblyName>
<OutputType>Exe</OutputType>
<TieredCompilation>true</TieredCompilation>
<RuntimeIdentifiers>win7-x86;win7-x64;osx-x64;linux-x64</RuntimeIdentifiers>
</PropertyGroup>

Expand Down
4 changes: 2 additions & 2 deletions test/powershell/Host/Logging.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ $pid
$script | Out-File -FilePath $testScriptPath -Force
$testPid = & $powershell -NoProfile -SettingsFile $configFile -Command $testScriptPath

Export-PSOsLog -After $after -LogPid $testPid -TimeoutInMilliseconds 30000 -IntervalInMilliseconds 3000 -MinimumCount 18 |
Export-PSOsLog -After $after -LogPid $testPid -TimeoutInMilliseconds 30000 -IntervalInMilliseconds 3000 -MinimumCount 17 |
Set-Content -Path $contentFile
$items = @(Get-PSOsLog -Path $contentFile -Id $logId -After $after -Verbose)

Expand Down Expand Up @@ -385,7 +385,7 @@ $pid
$script | Out-File -FilePath $testScriptPath -Force
$testPid = & $powershell -NoProfile -SettingsFile $configFile -Command $testScriptPath

Export-PSOsLog -After $after -LogPid $testPid -TimeoutInMilliseconds 30000 -IntervalInMilliseconds 3000 -MinimumCount 18 |
Export-PSOsLog -After $after -LogPid $testPid -TimeoutInMilliseconds 30000 -IntervalInMilliseconds 3000 -MinimumCount 17 |
Set-Content -Path $contentFile
$items = @(Get-PSOsLog -Path $contentFile -Id $logId -After $after -Verbose)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Describe "ConvertFrom-SddlString Tests" -Tags "CI", "RequireAdminOnWindows" {
$result = ConvertFrom-SddlString @arguments
foreach ($property in $expectedProperties)
{
$result.$property | Should Not Be $null
$result.$property | Should -Not -Be $null
}
}

Expand All @@ -44,7 +44,7 @@ Describe "ConvertFrom-SddlString Tests" -Tags "CI", "RequireAdminOnWindows" {
$result = $sddl | ConvertFrom-SddlString @arguments
foreach ($property in $expectedProperties)
{
$result.$property | Should Not Be $null
$result.$property | Should -Not -Be $null
}
}
}
2 changes: 1 addition & 1 deletion test/tools/Modules/PSSysLog/PSSysLog.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ function Export-PSOsLog
Write-Output $log
}
else {
throw "did not recieve at least $MinimumCount records but $($log.Count) instead."
throw "did not recieve at least $MinimumCount records but $($logToCount.Count) instead."
}
} -TimeoutInMilliseconds $TimeoutInMilliseconds -IntervalInMilliseconds $IntervalInMilliseconds -LogErrorSb {
$log = Start-NativeExecution -command {log show --info @extraParams}
Expand Down
1 change: 1 addition & 0 deletions test/tools/TestExe/TestExe.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<Description>Very simple little console class that you can use to for testing PowerShell interaction with native commands</Description>
<AssemblyName>testexe</AssemblyName>
<OutputType>Exe</OutputType>
<TieredCompilation>true</TieredCompilation>
<RuntimeIdentifiers>win7-x86;win7-x64;osx-x64;linux-x64</RuntimeIdentifiers>
</PropertyGroup>

Expand Down
1 change: 1 addition & 0 deletions test/tools/TestService/TestService.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<Description>Very tiny windows service to do service testing</Description>
<AssemblyName>TestService</AssemblyName>
<OutputType>Exe</OutputType>
<TieredCompilation>true</TieredCompilation>
<RuntimeIdentifiers>win7-x86;win7-x64</RuntimeIdentifiers>
</PropertyGroup>

Expand Down