@@ -153,7 +153,7 @@ public string[] Path
153153
154154 string [ ] pathValue = value ;
155155
156- List < string > resolvedPaths = new List < string > ( ) ;
156+ List < string > resolvedPaths = new ( ) ;
157157
158158 // Verify that the paths are resolved and valid
159159 foreach ( string path in pathValue )
@@ -198,7 +198,7 @@ public string[] LiteralPath
198198 return ;
199199 }
200200
201- List < string > resolvedPaths = new List < string > ( ) ;
201+ List < string > resolvedPaths = new ( ) ;
202202 foreach ( string path in value )
203203 {
204204 string literalPath = SessionState . Path . GetUnresolvedProviderPathFromPSPath ( path ) ;
@@ -230,7 +230,7 @@ private void ProcessPaths(List<string> resolvedPaths)
230230
231231 // Throw an error if it is an unrecognized extension
232232 default :
233- ErrorRecord errorRecord = new ErrorRecord (
233+ ErrorRecord errorRecord = new (
234234 new Exception (
235235 StringUtil . Format ( AddTypeStrings . FileExtensionNotSupported , currentExtension ) ) ,
236236 "EXTENSION_NOT_SUPPORTED" ,
@@ -248,7 +248,7 @@ private void ProcessPaths(List<string> resolvedPaths)
248248 else if ( ! string . Equals ( activeExtension , currentExtension , StringComparison . OrdinalIgnoreCase ) )
249249 {
250250 // All files must have the same extension otherwise throw.
251- ErrorRecord errorRecord = new ErrorRecord (
251+ ErrorRecord errorRecord = new (
252252 new Exception (
253253 StringUtil . Format ( AddTypeStrings . MultipleExtensionsNotSupported ) ) ,
254254 "MULTIPLE_EXTENSION_NOT_SUPPORTED" ,
@@ -327,7 +327,7 @@ public string OutputAssembly
327327
328328 // Try to resolve the path
329329 ProviderInfo provider = null ;
330- Collection < string > newPaths = new Collection < string > ( ) ;
330+ Collection < string > newPaths = new ( ) ;
331331
332332 try
333333 {
@@ -336,7 +336,7 @@ public string OutputAssembly
336336 // Ignore the ItemNotFound -- we handle it.
337337 catch ( ItemNotFoundException ) { }
338338
339- ErrorRecord errorRecord = new ErrorRecord (
339+ ErrorRecord errorRecord = new (
340340 new Exception (
341341 StringUtil . Format ( AddTypeStrings . OutputAssemblyDidNotResolve , _outputAssembly ) ) ,
342342 "INVALID_OUTPUT_ASSEMBLY" ,
@@ -520,7 +520,7 @@ private static string GetUsingTemplate(Language language)
520520 // Generate the code for the using statements
521521 private string GetUsingSet ( Language language )
522522 {
523- StringBuilder usingNamespaceSet = new StringBuilder ( ) ;
523+ StringBuilder usingNamespaceSet = new ( ) ;
524524
525525 switch ( language )
526526 {
@@ -578,7 +578,7 @@ protected override void EndProcessing()
578578 // assembly type without an output assembly
579579 if ( string . IsNullOrEmpty ( _outputAssembly ) && this . MyInvocation . BoundParameters . ContainsKey ( nameof ( OutputType ) ) )
580580 {
581- ErrorRecord errorRecord = new ErrorRecord (
581+ ErrorRecord errorRecord = new (
582582 new Exception (
583583 string . Format (
584584 CultureInfo . CurrentCulture ,
@@ -630,21 +630,21 @@ protected override void EndProcessing()
630630 private static readonly string s_frameworkFolder = PathType . GetDirectoryName ( typeof ( object ) . Assembly . Location ) ;
631631
632632 // These assemblies are always automatically added to ReferencedAssemblies.
633- private static readonly Lazy < PortableExecutableReference [ ] > s_autoReferencedAssemblies = new Lazy < PortableExecutableReference [ ] > ( InitAutoIncludedRefAssemblies ) ;
633+ private static readonly Lazy < PortableExecutableReference [ ] > s_autoReferencedAssemblies = new ( InitAutoIncludedRefAssemblies ) ;
634634
635635 // A HashSet of assembly names to be ignored if they are specified in '-ReferencedAssemblies'
636- private static readonly Lazy < HashSet < string > > s_refAssemblyNamesToIgnore = new Lazy < HashSet < string > > ( InitRefAssemblyNamesToIgnore ) ;
636+ private static readonly Lazy < HashSet < string > > s_refAssemblyNamesToIgnore = new ( InitRefAssemblyNamesToIgnore ) ;
637637
638638 // These assemblies are used, when ReferencedAssemblies parameter is not specified.
639- private static readonly Lazy < IEnumerable < PortableExecutableReference > > s_defaultAssemblies = new Lazy < IEnumerable < PortableExecutableReference > > ( InitDefaultRefAssemblies ) ;
639+ private static readonly Lazy < IEnumerable < PortableExecutableReference > > s_defaultAssemblies = new ( InitDefaultRefAssemblies ) ;
640640
641641 private bool InMemory { get { return string . IsNullOrEmpty ( _outputAssembly ) ; } }
642642
643643 // These dictionaries prevent reloading already loaded and unchanged code.
644644 // We don't worry about unbounded growing of the cache because in .Net Core 2.0 we can not unload assemblies.
645645 // TODO: review if we will be able to unload assemblies after migrating to .Net Core 2.1.
646- private static readonly HashSet < string > s_sourceTypesCache = new HashSet < string > ( ) ;
647- private static readonly Dictionary < int , Assembly > s_sourceAssemblyCache = new Dictionary < int , Assembly > ( ) ;
646+ private static readonly HashSet < string > s_sourceTypesCache = new ( ) ;
647+ private static readonly Dictionary < int , Assembly > s_sourceAssemblyCache = new ( ) ;
648648
649649 private static readonly string s_defaultSdkDirectory = Utils . DefaultPowerShellAppBase ;
650650
@@ -995,7 +995,7 @@ private void SourceCodeProcessing()
995995 }
996996
997997 SourceText sourceText ;
998- List < SyntaxTree > syntaxTrees = new List < SyntaxTree > ( ) ;
998+ List < SyntaxTree > syntaxTrees = new ( ) ;
999999
10001000 switch ( ParameterSetName )
10011001 {
@@ -1074,12 +1074,12 @@ private void CompileToAssembly(List<SyntaxTree> syntaxTrees, CompilationOptions
10741074
10751075 private void CheckDuplicateTypes ( Compilation compilation , out ConcurrentBag < string > newTypes )
10761076 {
1077- AllNamedTypeSymbolsVisitor visitor = new AllNamedTypeSymbolsVisitor ( ) ;
1077+ AllNamedTypeSymbolsVisitor visitor = new ( ) ;
10781078 visitor . Visit ( compilation . Assembly . GlobalNamespace ) ;
10791079
10801080 foreach ( var symbolName in visitor . DuplicateSymbols )
10811081 {
1082- ErrorRecord errorRecord = new ErrorRecord (
1082+ ErrorRecord errorRecord = new (
10831083 new Exception (
10841084 string . Format ( AddTypeStrings . TypeAlreadyExists , symbolName ) ) ,
10851085 "TYPE_ALREADY_EXISTS" ,
@@ -1090,7 +1090,7 @@ private void CheckDuplicateTypes(Compilation compilation, out ConcurrentBag<stri
10901090
10911091 if ( ! visitor . DuplicateSymbols . IsEmpty )
10921092 {
1093- ErrorRecord errorRecord = new ErrorRecord (
1093+ ErrorRecord errorRecord = new (
10941094 new InvalidOperationException ( AddTypeStrings . CompilerErrors ) ,
10951095 "COMPILER_ERRORS" ,
10961096 ErrorCategory . InvalidData ,
@@ -1106,8 +1106,8 @@ private void CheckDuplicateTypes(Compilation compilation, out ConcurrentBag<stri
11061106 // Visit symbols in all namespaces and collect duplicates.
11071107 private class AllNamedTypeSymbolsVisitor : SymbolVisitor
11081108 {
1109- public readonly ConcurrentBag < string > DuplicateSymbols = new ConcurrentBag < string > ( ) ;
1110- public readonly ConcurrentBag < string > UniqueSymbols = new ConcurrentBag < string > ( ) ;
1109+ public readonly ConcurrentBag < string > DuplicateSymbols = new ( ) ;
1110+ public readonly ConcurrentBag < string > UniqueSymbols = new ( ) ;
11111111
11121112 public override void VisitNamespace ( INamespaceSymbol symbol )
11131113 {
@@ -1243,7 +1243,7 @@ private void HandleCompilerErrors(ImmutableArray<Diagnostic> compilerDiagnostics
12431243 }
12441244 else
12451245 {
1246- ErrorRecord errorRecord = new ErrorRecord (
1246+ ErrorRecord errorRecord = new (
12471247 new Exception ( errorText ) ,
12481248 "SOURCE_CODE_ERROR" ,
12491249 ErrorCategory . InvalidData ,
@@ -1255,7 +1255,7 @@ private void HandleCompilerErrors(ImmutableArray<Diagnostic> compilerDiagnostics
12551255
12561256 if ( IsError )
12571257 {
1258- ErrorRecord errorRecord = new ErrorRecord (
1258+ ErrorRecord errorRecord = new (
12591259 new InvalidOperationException ( AddTypeStrings . CompilerErrors ) ,
12601260 "COMPILER_ERRORS" ,
12611261 ErrorCategory . InvalidData ,
@@ -1288,7 +1288,7 @@ private static string BuildErrorMessage(Diagnostic diagnisticRecord)
12881288 var errorLineString = textLines [ errorLineNumber ] . ToString ( ) ;
12891289 var errorPosition = lineSpan . StartLinePosition . Character ;
12901290
1291- StringBuilder sb = new StringBuilder ( diagnisticMessage . Length + errorLineString . Length * 2 + 4 ) ;
1291+ StringBuilder sb = new ( diagnisticMessage . Length + errorLineString . Length * 2 + 4 ) ;
12921292
12931293 sb . AppendLine ( diagnisticMessage ) ;
12941294 sb . AppendLine ( errorLineString ) ;
@@ -1314,7 +1314,7 @@ private static string BuildErrorMessage(Diagnostic diagnisticRecord)
13141314 private static int SyntaxTreeArrayGetHashCode ( IEnumerable < SyntaxTree > sts )
13151315 {
13161316 // We use our extension method EnumerableExtensions.SequenceGetHashCode<T>().
1317- List < int > stHashes = new List < int > ( ) ;
1317+ List < int > stHashes = new ( ) ;
13181318 foreach ( var st in sts )
13191319 {
13201320 stHashes . Add ( SyntaxTreeGetHashCode ( st ) ) ;
0 commit comments