Enable SA1003: Symbols should be spaced correctly (#14476)

https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1003.md
This commit is contained in:
xtqqczze 2020-12-23 16:21:26 +00:00 committed by GitHub
parent fd934e08a1
commit 9d4665f32f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
42 changed files with 465 additions and 304 deletions

View File

@ -1022,7 +1022,7 @@ dotnet_diagnostic.SA1001.severity = none
dotnet_diagnostic.SA1002.severity = warning
# SA1003: Symbols should be spaced correctly
dotnet_diagnostic.SA1003.severity = none
dotnet_diagnostic.SA1003.severity = warning
# SA1004: Documentation lines should begin with single space
dotnet_diagnostic.SA1004.severity = none

View File

@ -115,8 +115,8 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
/// <param name="cancellationDisposable"></param>
public AsyncResultCompleteEventArgs(
CimSession session,
IObservable<object> observable) :
base(session, observable, AsyncResultType.Completion)
IObservable<object> observable)
: base(session, observable, AsyncResultType.Completion)
{
}
}
@ -137,8 +137,8 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
public AsyncResultObjectEventArgs(
CimSession session,
IObservable<object> observable,
object resultObject) :
base(session, observable, AsyncResultType.Result)
object resultObject)
: base(session, observable, AsyncResultType.Result)
{
this.resultObject = resultObject;
}
@ -162,8 +162,8 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
public AsyncResultErrorEventArgs(
CimSession session,
IObservable<object> observable,
Exception error) :
base(session, observable, AsyncResultType.Exception)
Exception error)
: base(session, observable, AsyncResultType.Exception)
{
this.error = error;
}
@ -179,8 +179,8 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
CimSession session,
IObservable<object> observable,
Exception error,
CimResultContext cimResultContext) :
base(session, observable, AsyncResultType.Exception, cimResultContext)
CimResultContext cimResultContext)
: base(session, observable, AsyncResultType.Exception, cimResultContext)
{
this.error = error;
}

View File

@ -164,11 +164,11 @@ namespace Microsoft.PowerShell.Commands
FrenchCultureId, new List<Tuple<char, char>>()
{
// 'APOSTROPHE' to 'RIGHT SINGLE QUOTATION MARK'
new Tuple<char, char>((char) 0x0027, (char) 0x2019),
new Tuple<char, char>((char)0x0027, (char)0x2019),
// 'MODIFIER LETTER APOSTROPHE' to 'RIGHT SINGLE QUOTATION MARK'
new Tuple<char, char>((char) 0x02BC, (char) 0x2019),
new Tuple<char, char>((char)0x02BC, (char)0x2019),
// 'HEAVY SINGLE COMMA QUOTATION MARK ORNAMENT' to 'RIGHT SINGLE QUOTATION MARK'
new Tuple<char, char>((char) 0x275C, (char) 0x2019),
new Tuple<char, char>((char)0x275C, (char)0x2019),
}
}
};

View File

@ -1609,8 +1609,7 @@ namespace Microsoft.PowerShell.Commands
if (!Force && drive == SessionState.Drive.Current)
{
PSInvalidOperationException invalidOperation =
(PSInvalidOperationException)
PSTraceSource.NewInvalidOperationException(
(PSInvalidOperationException)PSTraceSource.NewInvalidOperationException(
NavigationResources.RemoveDriveInUse,
drive.Name);
@ -2637,8 +2636,7 @@ namespace Microsoft.PowerShell.Commands
if (isCurrentLocationOrAncestor)
{
PSInvalidOperationException invalidOperation =
(PSInvalidOperationException)
PSTraceSource.NewInvalidOperationException(
(PSInvalidOperationException)PSTraceSource.NewInvalidOperationException(
NavigationResources.RemoveItemInUse,
resolvedPath.Path);
@ -3012,8 +3010,7 @@ namespace Microsoft.PowerShell.Commands
if (!InvokeProvider.Item.Exists(path, currentContext))
{
PSInvalidOperationException invalidOperation =
(PSInvalidOperationException)
PSTraceSource.NewInvalidOperationException(
(PSInvalidOperationException)PSTraceSource.NewInvalidOperationException(
NavigationResources.MoveItemDoesntExist,
path);
@ -3099,8 +3096,7 @@ namespace Microsoft.PowerShell.Commands
if (isCurrentLocationOrAncestor)
{
PSInvalidOperationException invalidOperation =
(PSInvalidOperationException)
PSTraceSource.NewInvalidOperationException(
(PSInvalidOperationException)PSTraceSource.NewInvalidOperationException(
NavigationResources.MoveItemInUse,
path);
@ -3354,8 +3350,7 @@ namespace Microsoft.PowerShell.Commands
if (!InvokeProvider.Item.Exists(path, currentContext))
{
PSInvalidOperationException invalidOperation =
(PSInvalidOperationException)
PSTraceSource.NewInvalidOperationException(
(PSInvalidOperationException)PSTraceSource.NewInvalidOperationException(
NavigationResources.RenameItemDoesntExist,
path);
@ -3441,8 +3436,7 @@ namespace Microsoft.PowerShell.Commands
if (isCurrentLocationOrAncestor)
{
PSInvalidOperationException invalidOperation =
(PSInvalidOperationException)
PSTraceSource.NewInvalidOperationException(
(PSInvalidOperationException)PSTraceSource.NewInvalidOperationException(
NavigationResources.RenamedItemInUse,
path);

View File

@ -551,8 +551,7 @@ namespace Microsoft.PowerShell
{
var handle = NativeMethods.CreateFile(
"CONIN$",
(UInt32)
(NativeMethods.AccessQualifiers.GenericRead | NativeMethods.AccessQualifiers.GenericWrite),
(UInt32)(NativeMethods.AccessQualifiers.GenericRead | NativeMethods.AccessQualifiers.GenericWrite),
(UInt32)NativeMethods.ShareModes.ShareRead,
(IntPtr)0,
(UInt32)NativeMethods.CreationDisposition.OpenExisting,
@ -2171,8 +2170,7 @@ namespace Microsoft.PowerShell
{
for (int c = atContentsCol; c < bufferSize.X + atContentsCol; c++, characterBufferIndex++)
{
contents[r, c].Character = (char)
characterBuffer[characterBufferIndex].UnicodeChar;
contents[r, c].Character = (char)characterBuffer[characterBufferIndex].UnicodeChar;
ConsoleColor fgColor, bgColor;
WORDToColor(characterBuffer[characterBufferIndex].Attributes,
out fgColor,

View File

@ -124,7 +124,7 @@ namespace Microsoft.PowerShell
try
{
string profileDir = Platform.CacheDirectory;
#if ! UNIX
#if !UNIX
if (!Directory.Exists(profileDir))
{
Directory.CreateDirectory(profileDir);
@ -2870,15 +2870,13 @@ namespace Microsoft.PowerShell
{
internal
ConsoleHostStartupException()
:
base()
: base()
{
}
internal
ConsoleHostStartupException(string message)
:
base(message)
: base(message)
{
}
@ -2886,15 +2884,13 @@ namespace Microsoft.PowerShell
ConsoleHostStartupException(
System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context)
:
base(info, context)
: base(info, context)
{
}
internal
ConsoleHostStartupException(string message, Exception innerException)
:
base(message, innerException)
: base(message, innerException)
{
}
}

View File

@ -13,8 +13,7 @@ namespace Microsoft.PowerShell
{
internal
ConsoleTextWriter(ConsoleHostUserInterface ui)
:
base(System.Globalization.CultureInfo.CurrentCulture)
: base(System.Globalization.CultureInfo.CurrentCulture)
{
Dbg.Assert(ui != null, "ui needs a value");

View File

@ -47,8 +47,7 @@ namespace Microsoft.PowerShell
/// </summary>
internal
ProgressNode(Int64 sourceId, ProgressRecord record)
:
base(record.ActivityId, record.Activity, record.StatusDescription)
: base(record.ActivityId, record.Activity, record.StatusDescription)
{
Dbg.Assert(record.RecordType == ProgressRecordType.Processing, "should only create node for Processing records");

View File

@ -58,8 +58,7 @@ namespace Microsoft.PowerShell
{
internal
WrappedSerializer(DataFormat dataFormat, string streamName, TextWriter output)
:
base(dataFormat, streamName)
: base(dataFormat, streamName)
{
Dbg.Assert(output != null, "output should have a value");
@ -147,8 +146,7 @@ namespace Microsoft.PowerShell
{
internal
WrappedDeserializer(DataFormat dataFormat, string streamName, TextReader input)
:
base(dataFormat, streamName)
: base(dataFormat, streamName)
{
Dbg.Assert(input != null, "input should have a value");

View File

@ -32,7 +32,8 @@ namespace System.Management.Automation.Runspaces
/// <summary>
/// This is the default constructor.
/// </summary>
public FormatTableLoadException() : base()
public FormatTableLoadException()
: base()
{
SetDefaultErrorRecord();
}
@ -43,7 +44,8 @@ namespace System.Management.Automation.Runspaces
/// <param name="message">
/// A localized error message.
/// </param>
public FormatTableLoadException(string message) : base(message)
public FormatTableLoadException(string message)
: base(message)
{
SetDefaultErrorRecord();
}
@ -70,8 +72,8 @@ namespace System.Management.Automation.Runspaces
/// <param name="loadErrors">
/// The errors that occured
/// </param>
internal FormatTableLoadException(ConcurrentBag<string> loadErrors) :
base(StringUtil.Format(FormatAndOutXmlLoadingStrings.FormatTableLoadErrors))
internal FormatTableLoadException(ConcurrentBag<string> loadErrors)
: base(StringUtil.Format(FormatAndOutXmlLoadingStrings.FormatTableLoadErrors))
{
_errors = new Collection<string>(loadErrors.ToArray());
SetDefaultErrorRecord();

View File

@ -1122,9 +1122,9 @@ namespace Microsoft.PowerShell.Commands.Internal.Format
{
frameInfoDefinition =
{
leftIndentation = (int) frame.LeftIndent,
rightIndentation = (int) frame.RightIndent,
firstLine = frame.FirstLineHanging != 0 ? -(int) frame.FirstLineHanging : (int) frame.FirstLineIndent
leftIndentation = (int)frame.LeftIndent,
rightIndentation = (int)frame.RightIndent,
firstLine = frame.FirstLineHanging != 0 ? -(int)frame.FirstLineHanging : (int)frame.FirstLineIndent
}
};

View File

@ -1895,9 +1895,17 @@ namespace System.Management.Automation
/// Creates an instance of the PSEventSubscriber
/// class. Additionally supports an Action scriptblock.
/// </summary>
internal PSEventSubscriber(ExecutionContext context, int id, object source,
string eventName, string sourceIdentifier, ScriptBlock action, bool supportEvent, bool forwardEvent, int maxTriggerCount) :
this(context, id, source, eventName, sourceIdentifier, supportEvent, forwardEvent, maxTriggerCount)
internal PSEventSubscriber(
ExecutionContext context,
int id,
object source,
string eventName,
string sourceIdentifier,
ScriptBlock action,
bool supportEvent,
bool forwardEvent,
int maxTriggerCount)
: this(context, id, source, eventName, sourceIdentifier, supportEvent, forwardEvent, maxTriggerCount)
{
// Create the bound scriptblock, and job.
if (action != null)
@ -1924,9 +1932,17 @@ namespace System.Management.Automation
/// Creates an instance of the PSEventSubscriber
/// class. Additionally supports an Action scriptblock.
/// </summary>
internal PSEventSubscriber(ExecutionContext context, int id, object source,
string eventName, string sourceIdentifier, PSEventReceivedEventHandler handlerDelegate, bool supportEvent, bool forwardEvent, int maxTriggerCount) :
this(context, id, source, eventName, sourceIdentifier, supportEvent, forwardEvent, maxTriggerCount)
internal PSEventSubscriber(
ExecutionContext context,
int id,
object source,
string eventName,
string sourceIdentifier,
PSEventReceivedEventHandler handlerDelegate,
bool supportEvent,
bool forwardEvent,
int maxTriggerCount)
: this(context, id, source, eventName, sourceIdentifier, supportEvent, forwardEvent, maxTriggerCount)
{
HandlerDelegate = handlerDelegate;
}
@ -2456,8 +2472,12 @@ namespace System.Management.Automation
/// The name of the job
/// </param>
/// </summary>
public PSEventJob(PSEventManager eventManager, PSEventSubscriber subscriber, ScriptBlock action, string name) :
base(action?.ToString(), name)
public PSEventJob(
PSEventManager eventManager,
PSEventSubscriber subscriber,
ScriptBlock action,
string name)
: base(action?.ToString(), name)
{
if (eventManager == null)
throw new ArgumentNullException(nameof(eventManager));

View File

@ -18,7 +18,8 @@ namespace System.Management.Automation
/// Initializes a new instance of ExtendedTypeSystemException with the message set
/// to typeof(ExtendedTypeSystemException).FullName.
/// </summary>
public ExtendedTypeSystemException() : base(typeof(ExtendedTypeSystemException).FullName)
public ExtendedTypeSystemException()
: base(typeof(ExtendedTypeSystemException).FullName)
{
}
@ -26,7 +27,8 @@ namespace System.Management.Automation
/// Initializes a new instance of ExtendedTypeSystemException setting the message.
/// </summary>
/// <param name="message">The exception's message.</param>
public ExtendedTypeSystemException(string message) : base(message)
public ExtendedTypeSystemException(string message)
: base(message)
{
}
@ -35,7 +37,8 @@ namespace System.Management.Automation
/// </summary>
/// <param name="message">The exception's message.</param>
/// <param name="innerException">The exceptions's inner exception.</param>
public ExtendedTypeSystemException(string message, Exception innerException) : base(message, innerException)
public ExtendedTypeSystemException(string message, Exception innerException)
: base(message, innerException)
{
}
@ -46,9 +49,14 @@ namespace System.Management.Automation
/// <param name="innerException">The inner exception, null for none.</param>
/// <param name="resourceString">Resource string.</param>
/// <param name="arguments">Arguments to the resource string.</param>
internal ExtendedTypeSystemException(string errorId, Exception innerException, string resourceString,
params object[] arguments) :
base(StringUtil.Format(resourceString, arguments), innerException)
internal ExtendedTypeSystemException(
string errorId,
Exception innerException,
string resourceString,
params object[] arguments)
: base(
StringUtil.Format(resourceString, arguments),
innerException)
{
SetErrorId(errorId);
}
@ -86,7 +94,8 @@ namespace System.Management.Automation
/// Initializes a new instance of MethodException with the message set
/// to typeof(MethodException).FullName.
/// </summary>
public MethodException() : base(typeof(MethodException).FullName)
public MethodException()
: base(typeof(MethodException).FullName)
{
}
@ -94,7 +103,8 @@ namespace System.Management.Automation
/// Initializes a new instance of MethodException setting the message.
/// </summary>
/// <param name="message">The exception's message.</param>
public MethodException(string message) : base(message)
public MethodException(string message)
: base(message)
{
}
@ -103,7 +113,8 @@ namespace System.Management.Automation
/// </summary>
/// <param name="message">The exception's message.</param>
/// <param name="innerException">The exceptions's inner exception.</param>
public MethodException(string message, Exception innerException) : base(message, innerException)
public MethodException(string message, Exception innerException)
: base(message, innerException)
{
}
@ -114,9 +125,12 @@ namespace System.Management.Automation
/// <param name="innerException">The inner exception.</param>
/// <param name="resourceString">Resource string.</param>
/// <param name="arguments">Arguments to the resource string.</param>
internal MethodException(string errorId, Exception innerException,
string resourceString, params object[] arguments) :
base(errorId, innerException, resourceString, arguments)
internal MethodException(
string errorId,
Exception innerException,
string resourceString,
params object[] arguments)
: base(errorId, innerException, resourceString, arguments)
{
}
@ -151,7 +165,8 @@ namespace System.Management.Automation
/// Initializes a new instance of MethodInvocationException with the message set
/// to typeof(MethodInvocationException).FullName.
/// </summary>
public MethodInvocationException() : base(typeof(MethodInvocationException).FullName)
public MethodInvocationException()
: base(typeof(MethodInvocationException).FullName)
{
}
@ -159,7 +174,8 @@ namespace System.Management.Automation
/// Initializes a new instance of MethodInvocationException setting the message.
/// </summary>
/// <param name="message">The exception's message.</param>
public MethodInvocationException(string message) : base(message)
public MethodInvocationException(string message)
: base(message)
{
}
@ -168,7 +184,8 @@ namespace System.Management.Automation
/// </summary>
/// <param name="message">The exception's message.</param>
/// <param name="innerException">The exceptions's inner exception.</param>
public MethodInvocationException(string message, Exception innerException) : base(message, innerException)
public MethodInvocationException(string message, Exception innerException)
: base(message, innerException)
{
}
@ -179,9 +196,12 @@ namespace System.Management.Automation
/// <param name="innerException">The inner exception.</param>
/// <param name="resourceString">Resource string.</param>
/// <param name="arguments">Arguments to the resource string.</param>
internal MethodInvocationException(string errorId, Exception innerException,
string resourceString, params object[] arguments) :
base(errorId, innerException, resourceString, arguments)
internal MethodInvocationException(
string errorId,
Exception innerException,
string resourceString,
params object[] arguments)
: base(errorId, innerException, resourceString, arguments)
{
}
@ -192,7 +212,7 @@ namespace System.Management.Automation
/// <param name="info">Serialization information.</param>
/// <param name="context">Streaming context.</param>
protected MethodInvocationException(SerializationInfo info, StreamingContext context)
: base(info, context)
: base(info, context)
{
}
#endregion Serialization
@ -214,7 +234,8 @@ namespace System.Management.Automation
/// Initializes a new instance of GetValueException with the message set
/// to typeof(GetValueException).FullName.
/// </summary>
public GetValueException() : base(typeof(GetValueException).FullName)
public GetValueException()
: base(typeof(GetValueException).FullName)
{
}
@ -222,7 +243,8 @@ namespace System.Management.Automation
/// Initializes a new instance of GetValueException setting the message.
/// </summary>
/// <param name="message">The exception's message.</param>
public GetValueException(string message) : base(message)
public GetValueException(string message)
: base(message)
{
}
@ -231,7 +253,8 @@ namespace System.Management.Automation
/// </summary>
/// <param name="message">The exception's message.</param>
/// <param name="innerException">The exceptions's inner exception.</param>
public GetValueException(string message, Exception innerException) : base(message, innerException)
public GetValueException(string message, Exception innerException)
: base(message, innerException)
{
}
@ -242,9 +265,12 @@ namespace System.Management.Automation
/// <param name="innerException">The inner exception.</param>
/// <param name="resourceString">Resource string.</param>
/// <param name="arguments">Arguments to the resource string.</param>
internal GetValueException(string errorId, Exception innerException,
string resourceString, params object[] arguments) :
base(errorId, innerException, resourceString, arguments)
internal GetValueException(
string errorId,
Exception innerException,
string resourceString,
params object[] arguments)
: base(errorId, innerException, resourceString, arguments)
{
}
@ -255,7 +281,7 @@ namespace System.Management.Automation
/// <param name="info">Serialization information.</param>
/// <param name="context">Streaming context.</param>
protected GetValueException(SerializationInfo info, StreamingContext context)
: base(info, context)
: base(info, context)
{
}
#endregion Serialization
@ -306,9 +332,12 @@ namespace System.Management.Automation
/// <param name="innerException">The inner exception.</param>
/// <param name="resourceString">Resource string.</param>
/// <param name="arguments">Arguments to the resource string.</param>
internal PropertyNotFoundException(string errorId, Exception innerException,
string resourceString, params object[] arguments) :
base(errorId, innerException, resourceString, arguments)
internal PropertyNotFoundException(
string errorId,
Exception innerException,
string resourceString,
params object[] arguments)
: base(errorId, innerException, resourceString, arguments)
{
}
@ -341,7 +370,8 @@ namespace System.Management.Automation
/// Initializes a new instance of GetValueInvocationException with the message set
/// to typeof(GetValueInvocationException).FullName.
/// </summary>
public GetValueInvocationException() : base(typeof(GetValueInvocationException).FullName)
public GetValueInvocationException()
: base(typeof(GetValueInvocationException).FullName)
{
}
@ -349,7 +379,8 @@ namespace System.Management.Automation
/// Initializes a new instance of GetValueInvocationException setting the message.
/// </summary>
/// <param name="message">The exception's message.</param>
public GetValueInvocationException(string message) : base(message)
public GetValueInvocationException(string message)
: base(message)
{
}
@ -358,7 +389,8 @@ namespace System.Management.Automation
/// </summary>
/// <param name="message">The exception's message.</param>
/// <param name="innerException">The exceptions's inner exception.</param>
public GetValueInvocationException(string message, Exception innerException) : base(message, innerException)
public GetValueInvocationException(string message, Exception innerException)
: base(message, innerException)
{
}
@ -369,9 +401,12 @@ namespace System.Management.Automation
/// <param name="innerException">The inner exception.</param>
/// <param name="resourceString">Resource string.</param>
/// <param name="arguments">Arguments to the resource string.</param>
internal GetValueInvocationException(string errorId, Exception innerException,
string resourceString, params object[] arguments) :
base(errorId, innerException, resourceString, arguments)
internal GetValueInvocationException(
string errorId,
Exception innerException,
string resourceString,
params object[] arguments)
: base(errorId, innerException, resourceString, arguments)
{
}
@ -382,7 +417,7 @@ namespace System.Management.Automation
/// <param name="info">Serialization information.</param>
/// <param name="context">Streaming context.</param>
protected GetValueInvocationException(SerializationInfo info, StreamingContext context)
: base(info, context)
: base(info, context)
{
}
#endregion Serialization
@ -402,7 +437,8 @@ namespace System.Management.Automation
/// Initializes a new instance of SetValueException with the message set
/// to typeof(SetValueException).FullName.
/// </summary>
public SetValueException() : base(typeof(SetValueException).FullName)
public SetValueException()
: base(typeof(SetValueException).FullName)
{
}
@ -410,7 +446,8 @@ namespace System.Management.Automation
/// Initializes a new instance of SetValueException setting the message.
/// </summary>
/// <param name="message">The exception's message.</param>
public SetValueException(string message) : base(message)
public SetValueException(string message)
: base(message)
{
}
@ -419,7 +456,8 @@ namespace System.Management.Automation
/// </summary>
/// <param name="message">The exception's message.</param>
/// <param name="innerException">The exceptions's inner exception.</param>
public SetValueException(string message, Exception innerException) : base(message, innerException)
public SetValueException(string message, Exception innerException)
: base(message, innerException)
{
}
@ -430,9 +468,12 @@ namespace System.Management.Automation
/// <param name="innerException">The inner exception.</param>
/// <param name="resourceString">Resource string.</param>
/// <param name="arguments">Arguments to the resource string.</param>
internal SetValueException(string errorId, Exception innerException,
string resourceString, params object[] arguments) :
base(errorId, innerException, resourceString, arguments)
internal SetValueException(
string errorId,
Exception innerException,
string resourceString,
params object[] arguments)
: base(errorId, innerException, resourceString, arguments)
{
}
@ -443,7 +484,7 @@ namespace System.Management.Automation
/// <param name="info">Serialization information.</param>
/// <param name="context">Streaming context.</param>
protected SetValueException(SerializationInfo info, StreamingContext context)
: base(info, context)
: base(info, context)
{
}
#endregion Serialization
@ -463,7 +504,8 @@ namespace System.Management.Automation
/// Initializes a new instance of SetValueInvocationException with the message set
/// to typeof(SetValueInvocationException).FullName.
/// </summary>
public SetValueInvocationException() : base(typeof(SetValueInvocationException).FullName)
public SetValueInvocationException()
: base(typeof(SetValueInvocationException).FullName)
{
}
@ -471,7 +513,8 @@ namespace System.Management.Automation
/// Initializes a new instance of SetValueInvocationException setting the message.
/// </summary>
/// <param name="message">The exception's message.</param>
public SetValueInvocationException(string message) : base(message)
public SetValueInvocationException(string message)
: base(message)
{
}
@ -480,7 +523,8 @@ namespace System.Management.Automation
/// </summary>
/// <param name="message">The exception's message.</param>
/// <param name="innerException">The exceptions's inner exception.</param>
public SetValueInvocationException(string message, Exception innerException) : base(message, innerException)
public SetValueInvocationException(string message, Exception innerException)
: base(message, innerException)
{
}
@ -491,9 +535,12 @@ namespace System.Management.Automation
/// <param name="innerException">The inner exception.</param>
/// <param name="resourceString">Resource string.</param>
/// <param name="arguments">Arguments to the resource string.</param>
internal SetValueInvocationException(string errorId, Exception innerException,
string resourceString, params object[] arguments) :
base(errorId, innerException, resourceString, arguments)
internal SetValueInvocationException(
string errorId,
Exception innerException,
string resourceString,
params object[] arguments)
: base(errorId, innerException, resourceString, arguments)
{
}
@ -504,7 +551,7 @@ namespace System.Management.Automation
/// <param name="info">Serialization information.</param>
/// <param name="context">Streaming context.</param>
protected SetValueInvocationException(SerializationInfo info, StreamingContext context)
: base(info, context)
: base(info, context)
{
}
#endregion Serialization
@ -542,7 +589,8 @@ namespace System.Management.Automation
/// </summary>
/// <param name="info">Serialization information.</param>
/// <param name="context">Streaming context.</param>
protected PSInvalidCastException(SerializationInfo info, StreamingContext context) : base(info, context)
protected PSInvalidCastException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
_errorId = info.GetString("ErrorId");
}
@ -553,14 +601,16 @@ namespace System.Management.Automation
/// Initializes a new instance of PSInvalidCastException with the message set
/// to typeof(PSInvalidCastException).FullName.
/// </summary>
public PSInvalidCastException() : base(typeof(PSInvalidCastException).FullName)
public PSInvalidCastException()
: base(typeof(PSInvalidCastException).FullName)
{
}
/// <summary>
/// Initializes a new instance of PSInvalidCastException setting the message.
/// </summary>
/// <param name="message">The exception's message.</param>
public PSInvalidCastException(string message) : base(message)
public PSInvalidCastException(string message)
: base(message)
{
}
/// <summary>
@ -568,7 +618,8 @@ namespace System.Management.Automation
/// </summary>
/// <param name="message">The exception's message.</param>
/// <param name="innerException">The exceptions's inner exception.</param>
public PSInvalidCastException(string message, Exception innerException) : base(message, innerException)
public PSInvalidCastException(string message, Exception innerException)
: base(message, innerException)
{
}
@ -578,8 +629,14 @@ namespace System.Management.Automation
_errorId = errorId;
}
internal PSInvalidCastException(string errorId, Exception innerException, string resourceString, params object[] arguments)
: this(errorId, StringUtil.Format(resourceString, arguments), innerException)
internal PSInvalidCastException(
string errorId,
Exception innerException,
string resourceString,
params object[] arguments)
: this(
errorId, StringUtil.Format(resourceString, arguments),
innerException)
{
}

View File

@ -662,8 +662,7 @@ namespace Microsoft.PowerShell.Commands
continue;
}
ModuleSpecification moduleSpecification = (ModuleSpecification)
LanguagePrimitives.ConvertTo(
ModuleSpecification moduleSpecification = (ModuleSpecification)LanguagePrimitives.ConvertTo(
spec,
typeof(ModuleSpecification),
CultureInfo.InvariantCulture);

View File

@ -1204,8 +1204,7 @@ namespace System.Management.Automation
else
{
PSInvalidOperationException e =
(PSInvalidOperationException)
PSTraceSource.NewInvalidOperationException(
(PSInvalidOperationException)PSTraceSource.NewInvalidOperationException(
SessionStateStrings.DriveRemovalPreventedByProvider,
drive.Name,
drive.Provider);

View File

@ -1086,9 +1086,9 @@ namespace System.Management.Automation.Interpreter
return new DynamicInstructionN(delegateType, CallSite.Create(delegateType, binder));
}
factory =
(Func<CallSiteBinder, Instruction>)
instructionType.GetMethod("Factory").CreateDelegate(typeof(Func<CallSiteBinder, Instruction>));
factory = (Func<CallSiteBinder, Instruction>)instructionType
.GetMethod("Factory")
.CreateDelegate(typeof(Func<CallSiteBinder, Instruction>));
s_factories[delegateType] = factory;
}

View File

@ -646,8 +646,8 @@ namespace System.Management.Automation.Language
int scriptLineNumber,
int offsetInLine,
string line,
string fullScript) :
this(scriptName, scriptLineNumber, offsetInLine, line)
string fullScript)
: this(scriptName, scriptLineNumber, offsetInLine, line)
{
_fullScript = fullScript;
}

View File

@ -1742,8 +1742,7 @@ namespace System.Management.Automation
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal PSRemotingJob(string[] computerNames,
List<IThrottleOperation> computerNameHelpers, string remoteCommand, string name)
:
this(computerNames, computerNameHelpers, remoteCommand, 0, name)
: this(computerNames, computerNameHelpers, remoteCommand, 0, name)
{ }
/// <summary>
@ -1760,8 +1759,7 @@ namespace System.Management.Automation
/// </param>
internal PSRemotingJob(PSSession[] remoteRunspaceInfos,
List<IThrottleOperation> runspaceHelpers, string remoteCommand, string name)
:
this(remoteRunspaceInfos, runspaceHelpers, remoteCommand, 0, name)
: this(remoteRunspaceInfos, runspaceHelpers, remoteCommand, 0, name)
{ }
/// <summary>

View File

@ -32,7 +32,8 @@ namespace System.Management.Automation.Runspaces
/// </summary>
/// <param name="errorRecord">The error record that is wrapped.</param>
/// <param name="originInfo">Origin information.</param>
public RemotingErrorRecord(ErrorRecord errorRecord, OriginInfo originInfo) : this(errorRecord, originInfo, null) { }
public RemotingErrorRecord(ErrorRecord errorRecord, OriginInfo originInfo)
: this(errorRecord, originInfo, null) { }
/// <summary>
/// Constructor that is used to wrap an error record.
@ -40,8 +41,11 @@ namespace System.Management.Automation.Runspaces
/// <param name="errorRecord"></param>
/// <param name="originInfo"></param>
/// <param name="replaceParentContainsErrorRecordException"></param>
private RemotingErrorRecord(ErrorRecord errorRecord, OriginInfo originInfo, Exception replaceParentContainsErrorRecordException) :
base(errorRecord, replaceParentContainsErrorRecordException)
private RemotingErrorRecord(
ErrorRecord errorRecord,
OriginInfo originInfo,
Exception replaceParentContainsErrorRecordException)
: base(errorRecord, replaceParentContainsErrorRecordException)
{
if (errorRecord != null)
{
@ -123,8 +127,11 @@ namespace System.Management.Automation.Runspaces
/// </summary>
/// <param name="progressRecord">The progress record that is wrapped.</param>
/// <param name="originInfo">Origin information.</param>
public RemotingProgressRecord(ProgressRecord progressRecord, OriginInfo originInfo) :
base(Validate(progressRecord).ActivityId, Validate(progressRecord).Activity, Validate(progressRecord).StatusDescription)
public RemotingProgressRecord(ProgressRecord progressRecord, OriginInfo originInfo)
: base(
Validate(progressRecord).ActivityId,
Validate(progressRecord).Activity,
Validate(progressRecord).StatusDescription)
{
_originInfo = originInfo;
if (progressRecord != null)
@ -169,7 +176,8 @@ namespace System.Management.Automation.Runspaces
/// </summary>
/// <param name="message">The warning message that is wrapped.</param>
/// <param name="originInfo">The origin information.</param>
public RemotingWarningRecord(string message, OriginInfo originInfo) : base(message)
public RemotingWarningRecord(string message, OriginInfo originInfo)
: base(message)
{
_originInfo = originInfo;
}
@ -210,7 +218,8 @@ namespace System.Management.Automation.Runspaces
/// </summary>
/// <param name="message">The debug message that is wrapped.</param>
/// <param name="originInfo">The origin information.</param>
public RemotingDebugRecord(string message, OriginInfo originInfo) : base(message)
public RemotingDebugRecord(string message, OriginInfo originInfo)
: base(message)
{
_originInfo = originInfo;
}
@ -238,7 +247,8 @@ namespace System.Management.Automation.Runspaces
/// </summary>
/// <param name="message">The verbose message that is wrapped.</param>
/// <param name="originInfo">The origin information.</param>
public RemotingVerboseRecord(string message, OriginInfo originInfo) : base(message)
public RemotingVerboseRecord(string message, OriginInfo originInfo)
: base(message)
{
_originInfo = originInfo;
}

View File

@ -161,8 +161,12 @@ namespace System.Management.Automation
/// <param name="pipeline">Pipeline to clone from.</param>
/// <remarks>This constructor is private because this will
/// only be called from the copy method</remarks>
private RemotePipeline(RemotePipeline pipeline) :
this((RemoteRunspace)pipeline.Runspace, null, false, pipeline.IsNested)
private RemotePipeline(RemotePipeline pipeline)
: this(
(RemoteRunspace)pipeline.Runspace,
command: null,
addToHistory: false,
pipeline.IsNested)
{
_isSteppable = pipeline._isSteppable;

View File

@ -1141,9 +1141,8 @@ namespace System.Management.Automation.Remoting
/// </summary>
/// <param name="process">Target process object for pipe.</param>
/// <param name="appDomainName">AppDomain name or null for default AppDomain.</param>
public RemoteSessionNamedPipeClient(
System.Diagnostics.Process process, string appDomainName) :
this(NamedPipeUtils.CreateProcessPipeName(process, appDomainName))
public RemoteSessionNamedPipeClient(System.Diagnostics.Process process, string appDomainName)
: this(NamedPipeUtils.CreateProcessPipeName(process, appDomainName))
{ }
/// <summary>
@ -1151,9 +1150,8 @@ namespace System.Management.Automation.Remoting
/// </summary>
/// <param name="procId">Target process Id for pipe.</param>
/// <param name="appDomainName">AppDomain name or null for default AppDomain.</param>
public RemoteSessionNamedPipeClient(
int procId, string appDomainName) :
this(NamedPipeUtils.CreateProcessPipeName(procId, appDomainName))
public RemoteSessionNamedPipeClient(int procId, string appDomainName)
: this(NamedPipeUtils.CreateProcessPipeName(procId, appDomainName))
{ }
/// <summary>

View File

@ -829,8 +829,21 @@ namespace System.Management.Automation.Runspaces
/// <remarks>max server life timeout and open timeout are
/// default in this case</remarks>
[SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings", Scope = "member", Target = "System.Management.Automation.Runspaces.WSManConnectionInfo.#.ctor(System.String,System.String,System.Int32,System.String,System.String,System.Management.Automation.PSCredential)", MessageId = "4#")]
public WSManConnectionInfo(string scheme, string computerName, int port, string appName, string shellUri, PSCredential credential) :
this(scheme, computerName, port, appName, shellUri, credential, DefaultOpenTimeout)
public WSManConnectionInfo(
string scheme,
string computerName,
int port,
string appName,
string shellUri,
PSCredential credential)
: this(
scheme,
computerName,
port,
appName,
shellUri,
credential,
DefaultOpenTimeout)
{
}
@ -844,9 +857,20 @@ namespace System.Management.Automation.Runspaces
/// <param name="shellUri"></param>
/// <param name="credential"></param>
[SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings", MessageId = "4#")]
public WSManConnectionInfo(bool useSsl, string computerName, int port, string appName, string shellUri,
PSCredential credential) :
this(useSsl ? DefaultSslScheme : DefaultScheme, computerName, port, appName, shellUri, credential)
public WSManConnectionInfo(
bool useSsl,
string computerName,
int port,
string appName,
string shellUri,
PSCredential credential)
: this(
useSsl ? DefaultSslScheme : DefaultScheme,
computerName,
port,
appName,
shellUri,
credential)
{
}
@ -860,8 +884,22 @@ namespace System.Management.Automation.Runspaces
/// <param name="credential"></param>
/// <param name="openTimeout"></param>
[SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings", MessageId = "4#")]
public WSManConnectionInfo(bool useSsl, string computerName, int port, string appName, string shellUri, PSCredential credential, int openTimeout) :
this(useSsl ? DefaultSslScheme : DefaultScheme, computerName, port, appName, shellUri, credential, openTimeout)
public WSManConnectionInfo(
bool useSsl,
string computerName,
int port,
string appName,
string shellUri,
PSCredential credential,
int openTimeout)
: this(
useSsl ? DefaultSslScheme : DefaultScheme,
computerName,
port,
appName,
shellUri,
credential,
openTimeout)
{
}
@ -1700,9 +1738,8 @@ namespace System.Management.Automation.Runspaces
/// Initializes a new instance of the <see cref="NamedPipeConnectionInfo"/> class.
/// </summary>
/// <param name="processId">Process Id to connect to.</param>
public NamedPipeConnectionInfo(
int processId) :
this(processId, string.Empty, _defaultOpenTimeout)
public NamedPipeConnectionInfo(int processId)
: this(processId, string.Empty, _defaultOpenTimeout)
{ }
/// <summary>
@ -1710,10 +1747,8 @@ namespace System.Management.Automation.Runspaces
/// </summary>
/// <param name="processId">Process Id to connect to.</param>
/// <param name="appDomainName">Application domain name to connect to, or default AppDomain if blank.</param>
public NamedPipeConnectionInfo(
int processId,
string appDomainName) :
this(processId, appDomainName, _defaultOpenTimeout)
public NamedPipeConnectionInfo(int processId, string appDomainName)
: this(processId, appDomainName, _defaultOpenTimeout)
{ }
/// <summary>
@ -1736,9 +1771,8 @@ namespace System.Management.Automation.Runspaces
/// Initializes a new instance of the <see cref="NamedPipeConnectionInfo"/> class.
/// </summary>
/// <param name="customPipeName">Pipe name to connect to.</param>
public NamedPipeConnectionInfo(
string customPipeName) :
this(customPipeName, _defaultOpenTimeout)
public NamedPipeConnectionInfo(string customPipeName)
: this(customPipeName, _defaultOpenTimeout)
{ }
/// <summary>
@ -2288,7 +2322,7 @@ namespace System.Management.Automation.Runspaces
var argsToParse = String.Join(" ", psi.ArgumentList).Trim();
var argsLength = argsToParse.Length;
for (int i=0; i<argsLength; )
for (int i = 0; i < argsLength; )
{
var iStart = i;
@ -2311,7 +2345,7 @@ namespace System.Management.Automation.Runspaces
break;
}
argvList.Add(argsToParse.Substring(iStart, (i-iStart)));
argvList.Add(argsToParse.Substring(iStart, (i - iStart)));
while ((++i < argsLength) && argsToParse[i] == ' ') { }
}

View File

@ -91,8 +91,8 @@ namespace System.Management.Automation.Remoting.Internal
/// </summary>
/// <param name="objectType"></param>
/// <param name="value"></param>
public PSStreamObject(PSStreamObjectType objectType, object value) :
this(objectType, value, Guid.Empty)
public PSStreamObject(PSStreamObjectType objectType, object value)
: this(objectType, value, Guid.Empty)
{
}

View File

@ -558,9 +558,12 @@ namespace System.Management.Automation.Remoting.Client
/// <exception cref="PSInvalidOperationException">
/// 1. Create Session failed with a non-zero error code.
/// </exception>
internal WSManClientSessionTransportManager(Guid runspacePoolInstanceId,
internal WSManClientSessionTransportManager(
Guid runspacePoolInstanceId,
WSManConnectionInfo connectionInfo,
PSRemotingCryptoHelper cryptoHelper, string sessionName) : base(runspacePoolInstanceId, cryptoHelper)
PSRemotingCryptoHelper cryptoHelper,
string sessionName)
: base(runspacePoolInstanceId, cryptoHelper)
{
// Initialize WSMan instance
WSManAPIData = new WSManAPIDataCommon();
@ -2912,12 +2915,13 @@ namespace System.Management.Automation.Remoting.Client
/// Session transport manager creating this command transport manager instance.
/// Used by Command TM to apply session specific properties
/// </param>
internal WSManClientCommandTransportManager(WSManConnectionInfo connectionInfo,
internal WSManClientCommandTransportManager(
WSManConnectionInfo connectionInfo,
IntPtr wsManShellOperationHandle,
ClientRemotePowerShell shell,
bool noInput,
WSManClientSessionTransportManager sessnTM) :
base(shell, sessnTM.CryptoHelper, sessnTM)
WSManClientSessionTransportManager sessnTM)
: base(shell, sessnTM.CryptoHelper, sessnTM)
{
Dbg.Assert(wsManShellOperationHandle != IntPtr.Zero, "Shell operation handle cannot be IntPtr.Zero.");
Dbg.Assert(connectionInfo != null, "connectionInfo cannot be null");

View File

@ -535,8 +535,8 @@ namespace System.Management.Automation
{
private readonly CompiledScriptBlockData _scriptBlockData;
internal ScriptBlock(IParameterMetadataProvider ast, bool isFilter) :
this(new CompiledScriptBlockData(ast, isFilter))
internal ScriptBlock(IParameterMetadataProvider ast, bool isFilter)
: this(new CompiledScriptBlockData(ast, isFilter))
{
}

View File

@ -23,7 +23,8 @@ namespace Microsoft.PowerShell.Commands
/// Initializes a new instance of the HelpCategoryInvalidException class.
/// </summary>
/// <param name="helpCategory">The name of help category that is invalid.</param>
public HelpCategoryInvalidException(string helpCategory) : base()
public HelpCategoryInvalidException(string helpCategory)
: base()
{
_helpCategory = helpCategory;
CreateErrorRecord();
@ -32,7 +33,8 @@ namespace Microsoft.PowerShell.Commands
/// <summary>
/// Initializes a new instance of the HelpCategoryInvalidException class.
/// </summary>
public HelpCategoryInvalidException() : base()
public HelpCategoryInvalidException()
: base()
{
CreateErrorRecord();
}
@ -42,8 +44,10 @@ namespace Microsoft.PowerShell.Commands
/// </summary>
/// <param name="helpCategory">The name of help category that is invalid.</param>
/// <param name="innerException">The inner exception of this exception.</param>
public HelpCategoryInvalidException(string helpCategory, Exception innerException) :
base((innerException != null) ? innerException.Message : string.Empty, innerException)
public HelpCategoryInvalidException(string helpCategory, Exception innerException)
: base(
(innerException != null) ? innerException.Message : string.Empty,
innerException)
{
_helpCategory = helpCategory;
CreateErrorRecord();

View File

@ -22,7 +22,8 @@ namespace Microsoft.PowerShell.Commands
/// Initializes a new instance of the HelpNotFoundException class with the give help topic.
/// </summary>
/// <param name="helpTopic">The help topic for which help is not found.</param>
public HelpNotFoundException(string helpTopic) : base()
public HelpNotFoundException(string helpTopic)
: base()
{
_helpTopic = helpTopic;
CreateErrorRecord();
@ -31,7 +32,8 @@ namespace Microsoft.PowerShell.Commands
/// <summary>
/// Initializes a new instance of the HelpNotFoundException class.
/// </summary>
public HelpNotFoundException() : base()
public HelpNotFoundException()
: base()
{
CreateErrorRecord();
}
@ -42,8 +44,10 @@ namespace Microsoft.PowerShell.Commands
/// </summary>
/// <param name="helpTopic">The help topic for which help is not found.</param>
/// <param name="innerException">The inner exception.</param>
public HelpNotFoundException(string helpTopic, Exception innerException) :
base((innerException != null) ? innerException.Message : string.Empty, innerException)
public HelpNotFoundException(string helpTopic, Exception innerException)
: base(
(innerException != null) ? innerException.Message : string.Empty,
innerException)
{
_helpTopic = helpTopic;
CreateErrorRecord();

View File

@ -109,10 +109,26 @@ namespace Microsoft.PowerShell.Commands
/// Indicates raw stream.
/// </param>
public FileSystemContentReaderWriter(
string path, FileMode mode, FileAccess access,
FileShare share, Encoding encoding, bool usingByteEncoding,
bool waitForChanges, CmdletProvider provider, bool isRawStream) :
this(path, null, mode, access, share, encoding, usingByteEncoding, waitForChanges, provider, isRawStream)
string path,
FileMode mode,
FileAccess access,
FileShare share,
Encoding encoding,
bool usingByteEncoding,
bool waitForChanges,
CmdletProvider provider,
bool isRawStream)
: this(
path,
streamName: null,
mode,
access,
share,
encoding,
usingByteEncoding,
waitForChanges,
provider,
isRawStream)
{
}

View File

@ -1036,8 +1036,7 @@ namespace System.Management.Automation.Provider
if (!allowNonExistingPaths)
{
PSArgumentException e =
(PSArgumentException)
PSTraceSource.NewArgumentException(
(PSArgumentException)PSTraceSource.NewArgumentException(
nameof(path),
SessionStateStrings.NormalizeRelativePathOutsideBase,
path,

View File

@ -708,8 +708,7 @@ namespace Microsoft.PowerShell.Commands
if (ItemExists(path) && !Force)
{
PSArgumentException e =
(PSArgumentException)
PSTraceSource.NewArgumentException(
(PSArgumentException)PSTraceSource.NewArgumentException(
nameof(path),
SessionStateStrings.NewItemAlreadyExists,
path);
@ -838,8 +837,7 @@ namespace Microsoft.PowerShell.Commands
else
{
PSArgumentException e =
(PSArgumentException)
PSTraceSource.NewArgumentException(
(PSArgumentException)PSTraceSource.NewArgumentException(
nameof(path),
SessionStateStrings.CopyItemDoesntExist,
path);
@ -897,8 +895,7 @@ namespace Microsoft.PowerShell.Commands
if (ItemExists(newName) && !Force)
{
PSArgumentException e =
(PSArgumentException)
PSTraceSource.NewArgumentException(
(PSArgumentException)PSTraceSource.NewArgumentException(
nameof(newName),
SessionStateStrings.NewItemAlreadyExists,
newName);
@ -984,8 +981,7 @@ namespace Microsoft.PowerShell.Commands
else
{
PSArgumentException e =
(PSArgumentException)
PSTraceSource.NewArgumentException(
(PSArgumentException)PSTraceSource.NewArgumentException(
nameof(name),
SessionStateStrings.RenameItemDoesntExist,
name);

View File

@ -543,7 +543,6 @@ namespace System.Management.Automation
if (pCert != IntPtr.Zero)
{
NativeMethods.CRYPT_PROVIDER_CERT provCert =
(NativeMethods.CRYPT_PROVIDER_CERT)
Marshal.PtrToStructure<NativeMethods.CRYPT_PROVIDER_CERT>(pCert);
signerCert = new X509Certificate2(provCert.pCert);
}
@ -618,7 +617,6 @@ namespace System.Management.Automation
if (pProvSigner != IntPtr.Zero)
{
NativeMethods.CRYPT_PROVIDER_SGNR provSigner =
(NativeMethods.CRYPT_PROVIDER_SGNR)
Marshal.PtrToStructure<NativeMethods.CRYPT_PROVIDER_SGNR>(pProvSigner);
if (provSigner.csCounterSigners == 1)
{

View File

@ -704,7 +704,6 @@ namespace System.Management.Automation.Internal
out structSize))
{
Security.NativeMethods.CERT_ENHKEY_USAGE ekuStruct =
(Security.NativeMethods.CERT_ENHKEY_USAGE)
Marshal.PtrToStructure<Security.NativeMethods.CERT_ENHKEY_USAGE>(ekuBuffer);
IntPtr ep = ekuStruct.rgpszUsageIdentifier;
IntPtr ekuptr;

View File

@ -302,7 +302,8 @@ namespace System.Management.Automation.Internal
/// <summary>
/// Default constructor.
/// </summary>
public PSCryptoException() : this(0, new StringBuilder(string.Empty)) { }
public PSCryptoException()
: this(0, new StringBuilder(string.Empty)) { }
/// <summary>
/// Constructor that will be used from within CryptoUtils.
@ -320,7 +321,8 @@ namespace System.Management.Automation.Internal
/// Constructor with just message but no inner exception.
/// </summary>
/// <param name="message">Error message associated with this failure.</param>
public PSCryptoException(string message) : this(message, null) { }
public PSCryptoException(string message)
: this(message, null) { }
/// <summary>
/// Constructor with inner exception.
@ -329,8 +331,8 @@ namespace System.Management.Automation.Internal
/// <param name="innerException">Inner exception.</param>
/// <remarks>This constructor is currently not called
/// explicitly from crypto utils</remarks>
public PSCryptoException(string message, Exception innerException) :
base(message, innerException)
public PSCryptoException(string message, Exception innerException)
: base(message, innerException)
{
_errorCode = unchecked((uint)-1);
}
@ -343,8 +345,7 @@ namespace System.Management.Automation.Internal
/// <remarks>Currently no custom type-specific serialization logic is
/// implemented</remarks>
protected PSCryptoException(SerializationInfo info, StreamingContext context)
:
base(info, context)
: base(info, context)
{
_errorCode = unchecked(0xFFFFFFF);
Dbg.Assert(false, "type-specific serialization logic not implemented and so this constructor should not be called");

View File

@ -19,8 +19,8 @@ namespace System.Management.Automation.Host
/// Initializes a new instance of the HostException class.
/// </summary>
public
HostException() : base(
StringUtil.Format(HostInterfaceExceptionsStrings.DefaultCtorMessageTemplate, typeof(HostException).FullName))
HostException()
: base(StringUtil.Format(HostInterfaceExceptionsStrings.DefaultCtorMessageTemplate, typeof(HostException).FullName))
{
SetDefaultErrorRecord();
}
@ -32,7 +32,8 @@ namespace System.Management.Automation.Host
/// The error message that explains the reason for the exception.
/// </param>
public
HostException(string message) : base(message)
HostException(string message)
: base(message)
{
SetDefaultErrorRecord();
}
@ -79,8 +80,12 @@ namespace System.Management.Automation.Host
/// Intentionally public, third-party hosts can call this
/// </remarks>
public
HostException(string message, Exception innerException, string errorId, ErrorCategory errorCategory) :
base(message, innerException)
HostException(
string message,
Exception innerException,
string errorId,
ErrorCategory errorCategory)
: base(message, innerException)
{
SetErrorId(errorId);
SetErrorCategory(errorCategory);
@ -125,7 +130,8 @@ namespace System.Management.Automation.Host
/// Initializes a new instance of the PromptingException class.
/// </summary>
public
PromptingException() : base(StringUtil.Format(HostInterfaceExceptionsStrings.DefaultCtorMessageTemplate, typeof(PromptingException).FullName))
PromptingException()
: base(StringUtil.Format(HostInterfaceExceptionsStrings.DefaultCtorMessageTemplate, typeof(PromptingException).FullName))
{
SetDefaultErrorRecord();
}
@ -137,7 +143,8 @@ namespace System.Management.Automation.Host
/// The error message that explains the reason for the exception.
/// </param>
public
PromptingException(string message) : base(message)
PromptingException(string message)
: base(message)
{
SetDefaultErrorRecord();
}
@ -184,8 +191,12 @@ namespace System.Management.Automation.Host
/// Intentionally public, third-party hosts can call this
/// </remarks>
public
PromptingException(string message, Exception innerException, string errorId, ErrorCategory errorCategory) :
base(message, innerException, errorId, errorCategory)
PromptingException(
string message,
Exception innerException,
string errorId,
ErrorCategory errorCategory)
: base(message, innerException, errorId, errorCategory)
{
}

View File

@ -54,8 +54,14 @@ namespace System.Management.Automation
SetErrorCategory(ErrorCategory.MetadataError);
}
internal MetadataException(string errorId, Exception innerException, string resourceStr, params object[] arguments) :
base(StringUtil.Format(resourceStr, arguments), innerException)
internal MetadataException(
string errorId,
Exception innerException,
string resourceStr,
params object[] arguments)
: base(
StringUtil.Format(resourceStr, arguments),
innerException)
{
SetErrorCategory(ErrorCategory.MetadataError);
SetErrorId(errorId);
@ -121,8 +127,12 @@ namespace System.Management.Automation
/// <param name="innerException">The exceptions's inner exception.</param>
public ValidationMetadataException(string message, Exception innerException) : base(message, innerException) { }
internal ValidationMetadataException(string errorId, Exception innerException, string resourceStr, params object[] arguments) :
base(errorId, innerException, resourceStr, arguments)
internal ValidationMetadataException(
string errorId,
Exception innerException,
string resourceStr,
params object[] arguments)
: base(errorId, innerException, resourceStr, arguments)
{
}
@ -167,26 +177,37 @@ namespace System.Management.Automation
/// </summary>
/// <param name="info">Serialization information.</param>
/// <param name="context">Streaming context.</param>
protected ArgumentTransformationMetadataException(SerializationInfo info, StreamingContext context) : base(info, context) { }
protected ArgumentTransformationMetadataException(SerializationInfo info, StreamingContext context)
: base(info, context) { }
/// <summary>
/// Initializes a new instance of ArgumentTransformationMetadataException with the message set
/// to typeof(ArgumentTransformationMetadataException).FullName.
/// </summary>
public ArgumentTransformationMetadataException() : base(typeof(ArgumentTransformationMetadataException).FullName) { }
public ArgumentTransformationMetadataException()
: base(typeof(ArgumentTransformationMetadataException).FullName) { }
/// <summary>
/// Initializes a new instance of ArgumentTransformationMetadataException setting the message.
/// </summary>
/// <param name="message">The exception's message.</param>
public ArgumentTransformationMetadataException(string message) : base(message) { }
public ArgumentTransformationMetadataException(string message)
: base(message) { }
/// <summary>
/// Initializes a new instance of ArgumentTransformationMetadataException setting the message and innerException.
/// </summary>
/// <param name="message">The exception's message.</param>
/// <param name="innerException">The exceptions's inner exception.</param>
public ArgumentTransformationMetadataException(string message, Exception innerException) : base(message, innerException) { }
public ArgumentTransformationMetadataException(string message, Exception innerException)
: base(message, innerException) { }
internal ArgumentTransformationMetadataException(string errorId, Exception innerException, string resourceStr, params object[] arguments) :
base(errorId, innerException, resourceStr, arguments)
internal ArgumentTransformationMetadataException(
string errorId,
Exception innerException,
string resourceStr,
params object[] arguments)
: base(errorId, innerException, resourceStr, arguments)
{
}
}
@ -204,26 +225,37 @@ namespace System.Management.Automation
/// </summary>
/// <param name="info">Serialization information.</param>
/// <param name="context">Streaming context.</param>
protected ParsingMetadataException(SerializationInfo info, StreamingContext context) : base(info, context) { }
protected ParsingMetadataException(SerializationInfo info, StreamingContext context)
: base(info, context) { }
/// <summary>
/// Initializes a new instance of ParsingMetadataException with the message set
/// to typeof(ParsingMetadataException).FullName.
/// </summary>
public ParsingMetadataException() : base(typeof(ParsingMetadataException).FullName) { }
public ParsingMetadataException()
: base(typeof(ParsingMetadataException).FullName) { }
/// <summary>
/// Initializes a new instance of ParsingMetadataException setting the message.
/// </summary>
/// <param name="message">The exception's message.</param>
public ParsingMetadataException(string message) : base(message) { }
public ParsingMetadataException(string message)
: base(message) { }
/// <summary>
/// Initializes a new instance of ParsingMetadataException setting the message and innerException.
/// </summary>
/// <param name="message">The exception's message.</param>
/// <param name="innerException">The exceptions's inner exception.</param>
public ParsingMetadataException(string message, Exception innerException) : base(message, innerException) { }
public ParsingMetadataException(string message, Exception innerException)
: base(message, innerException) { }
internal ParsingMetadataException(string errorId, Exception innerException, string resourceStr, params object[] arguments) :
base(errorId, innerException, resourceStr, arguments)
internal ParsingMetadataException(
string errorId,
Exception innerException,
string resourceStr,
params object[] arguments)
: base(errorId, innerException, resourceStr, arguments)
{
}
}

View File

@ -542,16 +542,14 @@ namespace System.Management.Automation
string methodName = GetCallingMethodNameAndParameters(1);
// Create the method tracer object
return
(IDisposable)
new ScopeTracer(
this,
PSTraceSourceOptions.Method,
methodOutputFormatter,
methodLeavingFormatter,
methodName,
format,
args);
return (IDisposable)new ScopeTracer(
this,
PSTraceSourceOptions.Method,
methodOutputFormatter,
methodLeavingFormatter,
methodName,
format,
args);
}
catch
{
@ -591,15 +589,13 @@ namespace System.Management.Automation
string methodName = GetCallingMethodNameAndParameters(1);
// Create the scope tracer object
return
(IDisposable)
new ScopeTracer(
this,
PSTraceSourceOptions.Events,
eventHandlerOutputFormatter,
eventHandlerLeavingFormatter,
methodName,
string.Empty);
return (IDisposable)new ScopeTracer(
this,
PSTraceSourceOptions.Events,
eventHandlerOutputFormatter,
eventHandlerLeavingFormatter,
methodName,
string.Empty);
}
catch
{
@ -643,16 +639,14 @@ namespace System.Management.Automation
string methodName = GetCallingMethodNameAndParameters(1);
// Create the scope tracer object
return
(IDisposable)
new ScopeTracer(
this,
PSTraceSourceOptions.Events,
eventHandlerOutputFormatter,
eventHandlerLeavingFormatter,
methodName,
format,
args);
return (IDisposable)new ScopeTracer(
this,
PSTraceSourceOptions.Events,
eventHandlerOutputFormatter,
eventHandlerLeavingFormatter,
methodName,
format,
args);
}
catch
{
@ -707,14 +701,12 @@ namespace System.Management.Automation
{
try
{
return
(IDisposable)
new ScopeTracer(
this,
PSTraceSourceOptions.Lock,
lockEnterFormatter,
lockLeavingFormatter,
lockName);
return (IDisposable)new ScopeTracer(
this,
PSTraceSourceOptions.Lock,
lockEnterFormatter,
lockLeavingFormatter,
lockName);
}
catch
{

View File

@ -19,7 +19,7 @@ namespace System.Management.Automation.Tracing
private static readonly SysLogProvider s_provider;
// by default, do not include channel bits
internal const PSKeyword DefaultKeywords = (PSKeyword) (0x00FFFFFFFFFFFFFF);
internal const PSKeyword DefaultKeywords = (PSKeyword)(0x00FFFFFFFFFFFFFF);
// the default enabled channel(s)
internal const PSChannel DefaultChannels = PSChannel.Operational;

View File

@ -103,16 +103,16 @@ namespace System.Management.Automation.Tracing
_nativeSyslogIdent = Marshal.StringToHGlobalAnsi(applicationId);
NativeMethods.OpenLog(_nativeSyslogIdent, _facility);
_keywordFilter = (ulong)keywords;
_levelFilter = (byte) level;
_channelFilter = (byte) channels;
if ((_channelFilter & (ulong) PSChannel.Operational) != 0)
_levelFilter = (byte)level;
_channelFilter = (byte)channels;
if ((_channelFilter & (ulong)PSChannel.Operational) != 0)
{
_keywordFilter |= (ulong) PSKeyword.UseAlwaysOperational;
_keywordFilter |= (ulong)PSKeyword.UseAlwaysOperational;
}
if ((_channelFilter & (ulong) PSChannel.Analytic) != 0)
if ((_channelFilter & (ulong)PSChannel.Analytic) != 0)
{
_keywordFilter |= (ulong) PSKeyword.UseAlwaysAnalytic;
_keywordFilter |= (ulong)PSKeyword.UseAlwaysAnalytic;
}
}
@ -177,8 +177,8 @@ namespace System.Management.Automation.Tracing
/// <returns>True if the specified level and keywords are enabled for logging.</returns>
internal bool IsEnabled(PSLevel level, PSKeyword keywords)
{
return ( ((ulong) keywords & _keywordFilter) != 0 &&
((int) level <= _levelFilter) );
return ((ulong)keywords & _keywordFilter) != 0
&& ((int)level <= _levelFilter);
}
// NOTE: There are a number of places where PowerShell code sends analytic events
@ -188,8 +188,8 @@ namespace System.Management.Automation.Tracing
// filtering is performed to suppress analytic events.
private bool ShouldLog(PSLevel level, PSKeyword keywords, PSChannel channel)
{
return ((_channelFilter & (ulong)channel) != 0 &&
IsEnabled(level, keywords));
return (_channelFilter & (ulong)channel) != 0
&& IsEnabled(level, keywords);
}
#region resource manager
@ -251,7 +251,7 @@ namespace System.Management.Automation.Tracing
private static void GetEventMessage(StringBuilder sb, PSEventId eventId, params object[] args )
{
int parameterCount;
string resourceName = EventResource.GetMessage((int) eventId, out parameterCount);
string resourceName = EventResource.GetMessage((int)eventId, out parameterCount);
if (resourceName == null)
{
@ -347,7 +347,7 @@ namespace System.Management.Automation.Tracing
GetEventMessage(sb, eventId, args);
NativeMethods.SysLogPriority priority;
if ((int) level <= _levels.Length)
if ((int)level <= _levels.Length)
{
priority = _levels[(int)level];
}
@ -443,97 +443,97 @@ namespace System.Management.Automation.Tracing
/// <summary>
/// Kernel messages.
/// </summary>
Kernel = (0<<3),
Kernel = (0 << 3),
/// <summary>
/// Random user-level messages.
/// </summary>
User = (1<<3),
User = (1 << 3),
/// <summary>
/// Mail system.
/// </summary>
Mail = (2<<3),
Mail = (2 << 3),
/// <summary>
/// System daemons.
/// </summary>
Daemon = (3<<3),
Daemon = (3 << 3),
/// <summary>
/// Authorization messages.
/// </summary>
Authorization = (4<<3),
Authorization = (4 << 3),
/// <summary>
/// Messages generated internally by syslogd.
/// </summary>
Syslog = (5<<3),
Syslog = (5 << 3),
/// <summary>
/// Line printer subsystem.
/// </summary>
Lpr = (6<<3),
Lpr = (6 << 3),
/// <summary>
/// Network news subsystem.
/// </summary>
News = (7<<3),
News = (7 << 3),
/// <summary>
/// UUCP subsystem.
/// </summary>
Uucp = (8<<3),
Uucp = (8 << 3),
/// <summary>
/// Clock daemon.
/// </summary>
Cron = (9<<3),
Cron = (9 << 3),
/// <summary>
/// Security/authorization messages (private)
/// </summary>
Authpriv = (10<<3),
Authpriv = (10 << 3),
/// <summary>
/// FTP daemon.
/// </summary>
Ftp = (11<<3),
Ftp = (11 << 3),
// Reserved for system use
/// <summary>
/// Reserved for local use.
/// </summary>
Local0 = (16<<3),
Local0 = (16 << 3),
/// <summary>
/// Reserved for local use.
/// </summary>
Local1 = (17<<3),
Local1 = (17 << 3),
/// <summary>
/// Reserved for local use.
/// </summary>
Local2 = (18<<3),
Local2 = (18 << 3),
/// <summary>
/// Reserved for local use.
/// </summary>
Local3 = (19<<3),
Local3 = (19 << 3),
/// <summary>
/// Reserved for local use.
/// </summary>
Local4 = (20<<3),
Local4 = (20 << 3),
/// <summary>
/// Reserved for local use.
/// </summary>
Local5 = (21<<3),
Local5 = (21 << 3),
/// <summary>
/// Reserved for local use.
/// </summary>
Local6 = (22<<3),
Local6 = (22 << 3),
/// <summary>
/// Reserved for local use.
/// </summary>
Local7 = (23<<3),
Local7 = (23 << 3),
}
}
}

View File

@ -266,8 +266,8 @@ namespace Microsoft.PowerShell
// Check arg chars in order and allow prefixes
for (int i = 1; i < arg.Length; i++)
{
if (arg[i] != paramToCheck[i-1]
&& arg[i] != paramToCheckUpper[i-1])
if (arg[i] != paramToCheck[i - 1]
&& arg[i] != paramToCheckUpper[i - 1])
{
return false;
}

View File

@ -48,7 +48,7 @@ namespace TestExe
{
for (int i = 1; i < args.Length; i++)
{
Console.WriteLine("Arg {0} is <{1}>", i-1, args[i]);
Console.WriteLine("Arg {0} is <{1}>", i - 1, args[i]);
}
}

View File

@ -84,7 +84,7 @@ namespace mvc.Controllers
// Content-Type must be applied right before it is sent to the client or MVC will overwrite.
Response.OnStarting(state =>
{
var httpContext = (HttpContext) state;
var httpContext = (HttpContext)state;
httpContext.Response.ContentType = contentType;
return Task.FromResult(0);
}, HttpContext);

View File

@ -31,7 +31,7 @@ namespace mvc.Controllers
string contentType = Request.Query[key];
Response.OnStarting(state =>
{
var httpContext = (HttpContext) state;
var httpContext = (HttpContext)state;
httpContext.Response.ContentType = contentType;
return Task.FromResult(0);
}, HttpContext);