Default to DefaultConsoleWidth when DotNet says WindowWidth is 0
This resolves an issue in an environment like VSTS when pwsh is spawned and DotNet is not able to determine the Console Width.
* Port changes from #6883 by @kalgiz
Make sure that SettingFile arg is parsed before we load the settings
- Add ability to parse some setting before console host is created
- Trigger the Parse before the console host is created
- disable snapin loading from loading setting before this point
- re-enable mac logging tests.
Also, fix the following Travis-ci issues:
- make sure the Linux and macOS caches are separate to reduce the size
- update the macOS image to the closest image as used by the official build system (equivalent to VSTS hosted mac builds)
Fix#7089. Native globbing on UNIX was turning absolute paths into relative paths when it shouldn't. The code suppresses generating a relative path for paths starting with '~'. It also need to do the same for paths starting with '/'.
`PSMemberInfoInternalCollection<T>` uses OrderedDictionary class internally. `OrderedDictionary` in dotnet core 2.1 allocates `ArrayList` and `Hashtable` after any first using any property. Even if the `OrderedDictionary` object is actually empty.
The commit postpones the internal allocations until it's really necessary. Given that `PSMemberInfoInternalCollection<T>` is used in each PSObject and is often empty, this change dramatically reduces memory allocations.
Speed up the creation of PSObjects in CSV cmdlets by
- Use the overload Add(PSMember, bool prevalidated) for all objects except the first when adding the `NoteProperty` members.
- Add a new constructor to PSObject that preallocates the `_instanceMembers` collection with an initial capacity.
- Improve performance of AddToTypesXmlCache by avoiding an expensive copying of members just to check for the existence of one of them, perf is significantly increased, and allocations are reduced.
- Reduce allocations and GC pressure by preallocating and reusing `StringBuilders` and `List<string>` for line parsing in CSV cmdlets.
- Use `List<string>` instead of `Collection<string>` to get fewer virtual calls and better inlining.
- Reduce allocations by using a preallocated value factory in `TypeTable.GetMembers(ConsolidatedString types)`.
- Replace a `Linq.Any()` with a `List.Count > 0` in binder code.
The main gain is from taking advantage of the fact that all objects created by `Import-Csv` have the same shape (the same properties).
Unescape non-literal, non-glob path in ProccessRecord and
set the context.SuppressWildcardExpansion in RenameItem.
This solve the issue where Rename-Item complains -Path does not exist
when both -Path and CWD contains special characters.
Before the fix the TryConvertTo() is implemented in terms of Convert(), but with wrapping exception handling. This is costly performance wise. By inlining the implementation of ConvertTo(), and getting access to the FigureConversion output we can determine upfront on at least some occations that a conversion is not available.
* add csproj ref to sln
* Remove Microsoft.NET.Test.Sdk NuGet reference. The xunit.runner.visualstudio package is now sufficient for running tests in VS in the latest version (15.7.5)
* use RTM versions of XUnit 2.4.0 that got published today
* Update XUnit in hosting project as well to newer release
Before the fix when using Get-Variable or Get-Alias cmdlets with the -Scope parameter with wrong value, the error message refers to 'scopeID' parameter instead of 'Scope'.
- Formatting file should be used for `MarkdownOptionInfo` object instead of the types file for adding script property.
- Downlevel windows consoles which do not support VT100 escape sequences should be handled gracefully.
- Add helpuri fwlink for cmdlets.
- Make `-Path` a positional parameter for `ConvertFrom-Markdown`
- make `-InputObject` a positional parameter for `Set-MarkdownOption`
A comment from the existing `Utils.IsComObject` mentions that: "We can't use System.Runtime.InteropServices.Marshal.IsComObject(obj) since it doesn't work in partial trust."
Partial trust is a concept of Code Access Security (CAS)/Security-Transparent. CAS and Security-Transparent are no longer supported in .NET Core, so we should use `Marshal.IsComObject` instead.
- Make switch-statement report correct error position when it fails to evaluate the condition.
- Make for-statement report correct error position when it fails to evaluate the initializer.
- For the condition of `if/for/while/do-while/do-until` statements, the sequence point update is either duplicate in some cases (for `if/for/while`) which causes debugger to stop at the condition twice before moving forward, or missing (for `do-while/do-until`) which causes debugger to skip the condition. They are fixed.
Some values are not converted from json to PSCustomObject, because Newtonsoft.Json reads them and thinks they are metadata properties only useful for deserialization. This change makes Newtonsoft.Json "ignore" those properties so they are converted correctly from json to PSCustomObject.
Related #4708.
Format Microsoft.PowerShell.Commands.Utility.csproj by codeformatter with default options.
The codeformatter is used that I compiled with newest Roslyn packages (version 2.8.2).