diff --git a/snippets/csharp/System.Diagnostics/Process/StandardOutput/stdoutput-async.cs b/snippets/csharp/System.Diagnostics/Process/StandardOutput/stdoutput-async.cs index d9c92840973..d67c699b88d 100644 --- a/snippets/csharp/System.Diagnostics/Process/StandardOutput/stdoutput-async.cs +++ b/snippets/csharp/System.Diagnostics/Process/StandardOutput/stdoutput-async.cs @@ -3,31 +3,31 @@ public class Example { - public static void Main() - { - var p = new Process(); - p.StartInfo.UseShellExecute = false; - p.StartInfo.RedirectStandardOutput = true; - string eOut = null; - p.StartInfo.RedirectStandardError = true; - p.ErrorDataReceived += new DataReceivedEventHandler((sender, e) => - { eOut += e.Data; }); - p.StartInfo.FileName = "Write500Lines.exe"; - p.Start(); + public static void Main() + { + var p = new Process(); + p.StartInfo.UseShellExecute = false; + p.StartInfo.RedirectStandardOutput = true; + string eOut = null; + p.StartInfo.RedirectStandardError = true; + p.ErrorDataReceived += new DataReceivedEventHandler((sender, e) => + { eOut += e.Data; }); + p.StartInfo.FileName = "Write500Lines.exe"; + p.Start(); - // To avoid deadlocks, use an asynchronous read operation on at least one of the streams. - p.BeginErrorReadLine(); - string output = p.StandardOutput.ReadToEnd(); - p.WaitForExit(); + // To avoid deadlocks, use an asynchronous read operation on at least one of the streams. + p.BeginErrorReadLine(); + string output = p.StandardOutput.ReadToEnd(); + p.WaitForExit(); - Console.WriteLine($"The last 50 characters in the output stream are:\n'{output.Substring(output.Length - 50)}'"); - Console.WriteLine($"\nError stream: {eOut}"); - } + Console.WriteLine($"The last 50 characters in the output stream are:\n'{output.Substring(output.Length - 50)}'"); + Console.WriteLine($"\nError stream: {eOut}"); + } } // The example displays the following output: // The last 50 characters in the output stream are: -// ' 49,800.20% -// Line 500 of 500 written: 49,900.20% +// 'ritten: 99,80% +// Line 500 of 500 written: 100,00% // ' // // Error stream: Successfully wrote 500 lines. diff --git a/snippets/csharp/System.Diagnostics/Process/StandardOutput/stdoutput-sync.cs b/snippets/csharp/System.Diagnostics/Process/StandardOutput/stdoutput-sync.cs index d27f2c10ada..69d041ee319 100644 --- a/snippets/csharp/System.Diagnostics/Process/StandardOutput/stdoutput-sync.cs +++ b/snippets/csharp/System.Diagnostics/Process/StandardOutput/stdoutput-sync.cs @@ -3,25 +3,25 @@ public class Example2 { - public static void Main() - { - var p = new Process(); - p.StartInfo.UseShellExecute = false; - p.StartInfo.RedirectStandardOutput = true; - p.StartInfo.FileName = "Write500Lines.exe"; - p.Start(); + public static void Main() + { + var p = new Process(); + p.StartInfo.UseShellExecute = false; + p.StartInfo.RedirectStandardOutput = true; + p.StartInfo.FileName = "Write500Lines.exe"; + p.Start(); - // To avoid deadlocks, always read the output stream first and then wait. - string output = p.StandardOutput.ReadToEnd(); - p.WaitForExit(); + // To avoid deadlocks, always read the output stream first and then wait. + string output = p.StandardOutput.ReadToEnd(); + p.WaitForExit(); - Console.WriteLine($"The last 50 characters in the output stream are:\n'{output.Substring(output.Length - 50)}'"); - } + Console.WriteLine($"The last 50 characters in the output stream are:\n'{output.Substring(output.Length - 50)}'"); + } } // The example displays the following output: // Successfully wrote 500 lines. // // The last 50 characters in the output stream are: -// ' 49,800.20% -// Line 500 of 500 written: 49,900.20% +// 'ritten: 99,80% +// Line 500 of 500 written: 100,00% // ' diff --git a/snippets/csharp/System.Diagnostics/Process/StandardOutput/write500lines.cs b/snippets/csharp/System.Diagnostics/Process/StandardOutput/write500lines.cs index 99c9dc09cf8..eb4aaff9d01 100644 --- a/snippets/csharp/System.Diagnostics/Process/StandardOutput/write500lines.cs +++ b/snippets/csharp/System.Diagnostics/Process/StandardOutput/write500lines.cs @@ -1,20 +1,22 @@ using System; -using System.IO; public class Example3 { - public static void Main() - { - for (int ctr = 0; ctr < 500; ctr++) - Console.WriteLine($"Line {ctr + 1} of 500 written: {ctr + 1/500.0:P2}"); + public static void Main() + { + for (int ctr = 0; ctr < 500; ctr++) + Console.WriteLine($"Line {ctr + 1} of 500 written: {(ctr + 1) / 500.0:P2}"); - Console.Error.WriteLine("\nSuccessfully wrote 500 lines.\n"); - } + Console.Error.WriteLine("\nSuccessfully wrote 500 lines.\n"); + } } // The example displays the following output: -// The last 50 characters in the output stream are: -// ' 49,800.20% -// Line 500 of 500 written: 49,900.20% -//' +// Line 1 of 500 written: 0,20% +// Line 2 of 500 written: 0,40% +// Line 3 of 500 written: 0,60% +// ... +// Line 498 of 500 written: 99,60% +// Line 499 of 500 written: 99,80% +// Line 500 of 500 written: 100,00% // -// Error stream: Successfully wrote 500 lines. +// Successfully wrote 500 lines. diff --git a/snippets/csharp/System.IO/StreamReader/Read/strmreader read2.cs b/snippets/csharp/System.IO/StreamReader/Read/strmreader read2.cs index 8294a2c88a1..5487c1777a3 100644 --- a/snippets/csharp/System.IO/StreamReader/Read/strmreader read2.cs +++ b/snippets/csharp/System.IO/StreamReader/Read/strmreader read2.cs @@ -32,7 +32,7 @@ public static void Main() while (sr.Peek() >= 0) { c = new char[5]; - sr.Read(c, 0, c.Length); + sr.ReadBlock(c, 0, c.Length); //The output will look odd, because //only five characters are read at a time. Console.WriteLine(c); diff --git a/snippets/fsharp/System.Diagnostics/Process/StandardOutput/stdoutput-async.fs b/snippets/fsharp/System.Diagnostics/Process/StandardOutput/stdoutput-async.fs index 3c7a78fd6c9..e67477d110a 100644 --- a/snippets/fsharp/System.Diagnostics/Process/StandardOutput/stdoutput-async.fs +++ b/snippets/fsharp/System.Diagnostics/Process/StandardOutput/stdoutput-async.fs @@ -21,8 +21,8 @@ printfn $"The last 50 characters in the output stream are:\n'{output.Substring(o printfn $"\nError stream: {eOut}" // The example displays the following output: // The last 50 characters in the output stream are: -// ' 49,800.20% -// Line 500 of 500 written: 49,900.20% +// 'ritten: 99,80% +// Line 500 of 500 written: 100,00% // ' // // Error stream: Successfully wrote 500 lines. diff --git a/snippets/fsharp/System.Diagnostics/Process/StandardOutput/stdoutput-sync.fs b/snippets/fsharp/System.Diagnostics/Process/StandardOutput/stdoutput-sync.fs index e01ab27ddcb..d2bfa3ce495 100644 --- a/snippets/fsharp/System.Diagnostics/Process/StandardOutput/stdoutput-sync.fs +++ b/snippets/fsharp/System.Diagnostics/Process/StandardOutput/stdoutput-sync.fs @@ -15,8 +15,7 @@ p.WaitForExit() printfn $"The last 50 characters in the output stream are:\n'{output.Substring(output.Length - 50)}'" // The example displays the following output: // Successfully wrote 500 lines. -// // The last 50 characters in the output stream are: -// ' 49,800.20% -// Line 500 of 500 written: 49,900.20% +// 'ritten: 99,80% +// Line 500 of 500 written: 100,00% // ' diff --git a/snippets/fsharp/System.Diagnostics/Process/StandardOutput/write500lines.fs b/snippets/fsharp/System.Diagnostics/Process/StandardOutput/write500lines.fs index 5053af9903a..f4861ff1dd1 100644 --- a/snippets/fsharp/System.Diagnostics/Process/StandardOutput/write500lines.fs +++ b/snippets/fsharp/System.Diagnostics/Process/StandardOutput/write500lines.fs @@ -5,9 +5,11 @@ for i in 1. .. 500. do eprintfn "Successfully wrote 500 lines."; // The example displays the following output: -// The last 50 characters in the output stream are: -// ' 49,800.20% -// Line 500 of 500 written: 49,900.20% -//' -// -// Error stream: Successfully wrote 500 lines. +// Line 1 of 500 written: 0,20% +// Line 2 of 500 written: 0,40% +// Line 3 of 500 written: 0,60% +// ... +// Line 498 of 500 written: 99,60% +// Line 499 of 500 written: 99,80% +// Line 500 of 500 written: 100,00% +// Successfully wrote 500 lines. diff --git a/snippets/visualbasic/api/system.diagnostics/process/standardoutput/Write500Lines.vb b/snippets/visualbasic/api/system.diagnostics/process/standardoutput/Write500Lines.vb index 732372ec04b..8276e0db08c 100644 --- a/snippets/visualbasic/api/system.diagnostics/process/standardoutput/Write500Lines.vb +++ b/snippets/visualbasic/api/system.diagnostics/process/standardoutput/Write500Lines.vb @@ -3,16 +3,19 @@ Public Module Example Public Sub Main() For ctr As Integer = 0 To 499 - Console.WriteLine($"Line {ctr + 1} of 500 written: {ctr + 1/500.0:P2}") + Console.WriteLine($"Line {ctr + 1} of 500 written: {(ctr + 1) / 500.0:P2}") Next Console.Error.WriteLine($"{vbCrLf}Successfully wrote 500 lines.{vbCrLf}") End Sub End Module ' The example displays the following output: -' The last 50 characters in the output stream are: -' ' 49,800.20% -' Line 500 of 500 written: 49,900.20% +' Line 1 of 500 written 0,20% +' Line 2 of 500 written: 0,40% +' Line 3 of 500 written: 0,60% +' ... +' Line 498 of 500 written: 99,60% +' Line 499 of 500 written: 99,80% +' Line 500 of 500 written: 100,00% ' -' -' Error stream: Successfully wrote 500 lines. \ No newline at end of file +' Successfully wrote 500 lines. \ No newline at end of file diff --git a/snippets/visualbasic/api/system.diagnostics/process/standardoutput/stdoutput-async.vb b/snippets/visualbasic/api/system.diagnostics/process/standardoutput/stdoutput-async.vb index 7b97b386dbe..694ae267333 100644 --- a/snippets/visualbasic/api/system.diagnostics/process/standardoutput/stdoutput-async.vb +++ b/snippets/visualbasic/api/system.diagnostics/process/standardoutput/stdoutput-async.vb @@ -22,8 +22,8 @@ Public Module Example End Module ' The example displays the following output: ' The last 50 characters in the output stream are: -' ' 49,800.20% -' Line 500 of 500 written: 49,900.20% +' 'ritten: 99,80% +' Line 500 of 500 written: 100,00% ' ' ' ' Error stream: Successfully wrote 500 lines. \ No newline at end of file diff --git a/snippets/visualbasic/api/system.diagnostics/process/standardoutput/stdoutput-sync.vb b/snippets/visualbasic/api/system.diagnostics/process/standardoutput/stdoutput-sync.vb index caf73c65e69..5e0f9f7932a 100644 --- a/snippets/visualbasic/api/system.diagnostics/process/standardoutput/stdoutput-sync.vb +++ b/snippets/visualbasic/api/system.diagnostics/process/standardoutput/stdoutput-sync.vb @@ -19,6 +19,6 @@ End Module ' Successfully wrote 500 lines. ' ' The last 50 characters in the output stream are: -' ' 49,800.20% -' Line 500 of 500 written: 49,900.20% +' 'ritten: 99,80% +' Line 500 of 500 written: 100,00% ' ' \ No newline at end of file diff --git a/xml/System.Buffers/ReadOnlySequence`1.xml b/xml/System.Buffers/ReadOnlySequence`1.xml index 65d13bb914e..2ad97b98e0e 100644 --- a/xml/System.Buffers/ReadOnlySequence`1.xml +++ b/xml/System.Buffers/ReadOnlySequence`1.xml @@ -463,9 +463,9 @@ The of which to get the offset. - Returns the offset of a within this sequence from the start. - The offset from the start of the sequence. - To be added. + Returns the offset of a within this sequence. + The offset in the sequence. + The returned offset is not a zero-based index from the start. To obtain the zero-based index offset, subtract mySequence.GetOffset(mySequence.Start) from the returned offset. The position is out of range. diff --git a/xml/System.Diagnostics/Process.xml b/xml/System.Diagnostics/Process.xml index 6ba6865bb43..2106d724fcf 100644 --- a/xml/System.Diagnostics/Process.xml +++ b/xml/System.Diagnostics/Process.xml @@ -110,6 +110,12 @@ A system process is uniquely identified on the system by its process identifier. Like many Windows resources, a process is also identified by its handle, which might not be unique on the computer. A handle is the generic term for an identifier of a resource. The operating system persists the process handle, which is accessed through the property of the component, even when the process has exited. Thus, you can get the process's administrative information, such as the (usually either zero for success or a nonzero error code) and the . Handles are an extremely valuable resource, so leaking handles is more virulent than leaking memory. +On macOS, the following properties return 0: + + - + - + - + > [!NOTE] > This class contains a link demand and an inheritance demand at the class level that applies to all members. A is thrown when either the immediate caller or the derived class does not have full-trust permission. For details about security demands, see [Link Demands](/dotnet/framework/misc/link-demands). diff --git a/xml/System.IO/Path.xml b/xml/System.IO/Path.xml index 81666951ded..417cfc0e104 100644 --- a/xml/System.IO/Path.xml +++ b/xml/System.IO/Path.xml @@ -2175,12 +2175,19 @@ If the current Windows version exposes the [`GetTempPath2`](https://learn.micros On Windows versions that don't expose GetTempPath2, this method instead invokes the [`GetTempPath`](https://learn.microsoft.com/windows/win32/api/fileapi/nf-fileapi-gettemppathw) Win32 API and returns the resolved path. For more information on how this resolution is performed, including how to control the return value through the use of environment variables, see [the _Remarks_ section](https://learn.microsoft.com/windows/win32/api/fileapi/nf-fileapi-gettemppathw#remarks) of the GetTempPath documentation. +# [MacOS](#tab/macos) + +If the `TMPDIR` environment variable has been set, this method returns the value specified by that environment variable. MacOS sets `TMPDIR` on login to a per-user temporary directory. + +Otherwise, this method returns `/tmp/`. + # [Linux](#tab/linux) If the `TMPDIR` environment variable has been set, this method returns the value specified by that environment variable. Otherwise, this method returns `/tmp/`. - +The `/tmp/` directory on Linux is commonly shared among all users (`1777` permissions); ensure this meets your application's security needs. + --- ## Examples diff --git a/xml/System.IO/StreamReader.xml b/xml/System.IO/StreamReader.xml index 6a26aca4752..4897e1dbe24 100644 --- a/xml/System.IO/StreamReader.xml +++ b/xml/System.IO/StreamReader.xml @@ -974,13 +974,13 @@ The stream to be read. The character encoding to use. Indicates whether to look for byte order marks at the beginning of the file. - The minimum buffer size. + The minimum buffer size, in bytes. Initializes a new instance of the class for the specified stream, with the specified character encoding, byte order mark detection option, and buffer size. object. The `detectEncodingFromByteOrderMarks` parameter detects the encoding by looking at the first four bytes of the stream. It automatically recognizes UTF-8, little-endian UTF-16, big-endian UTF-16, little-endian UTF-32, and big-endian UTF-32 text if the file starts with the appropriate byte order marks. Otherwise, the user-provided encoding is used. See the method for more information. @@ -1008,7 +1008,7 @@ or is . - is less than or equal to zero. + is less than or equal to zero, except for -1, which is allowed to indicate the default buffer size. File and Stream I/O How to: Read Text from a File @@ -1077,7 +1077,7 @@ The complete file path to be read. The character encoding to use. Indicates whether to look for byte order marks at the beginning of the file. - The minimum buffer size, in number of 16-bit characters. + The minimum buffer size, in bytes. Initializes a new instance of the class for the specified file name, with the specified character encoding, byte order mark detection option, and buffer size. object. The `detectEncodingFromByteOrderMarks` parameter detects the encoding by looking at the first four bytes of the stream. It automatically recognizes UTF-8, little-endian UTF-16, big-endian UTF-16, little-endian UTF-32, and big-endian UTF-32 text if the file starts with the appropriate byte order marks. Otherwise, the user-provided encoding is used. See the method for more information. - The buffer size, in number of 16-bit characters, is set by the `bufferSize` parameter. If `bufferSize` is less than the minimum allowable size (128 characters), the minimum allowable size is used. + The buffer size, in bytes, is set by the `bufferSize` parameter. If `bufferSize` is less than the minimum allowable size (128 bytes), the minimum allowable size is used. The `path` parameter can be a file name, including a file on a Universal Naming Convention (UNC) share. @@ -1115,7 +1115,7 @@ includes an incorrect or invalid syntax for file name, directory name, or volume label. - is less than or equal to zero. + is less than or equal to zero, except for -1, which is allowed to indicate the default buffer size. File and Stream I/O How to: Read Text from a File @@ -1249,7 +1249,7 @@ The character encoding to use. to look for byte order marks at the beginning of the file; otherwise, . - The minimum buffer size. + The minimum buffer size, in bytes. to leave the stream open after the object is disposed; otherwise, . Initializes a new instance of the class for the specified stream based on the specified character encoding, byte order mark detection option, and buffer size, and optionally leaves the stream open. @@ -1259,7 +1259,7 @@ ## Remarks Unless you set the `leaveOpen` parameter to `true`, the object calls on the provided object when is called. - The buffer size, in number of 16-bit characters, is set by the `bufferSize` parameter. If `bufferSize` is less than the minimum allowable size (128 characters), the minimum allowable size is used. + The buffer size, in bytes, is set by the `bufferSize` parameter. If `bufferSize` is less than the minimum allowable size (128 bytes), the minimum allowable size is used. This constructor enables you to change the encoding the first time you read from the object. If the `detectEncodingFromByteOrderMarks` parameter is `true`, the constructor detects the encoding by looking at the first four bytes of the stream. It automatically recognizes UTF-8, little-endian UTF-16, big-endian UTF-16, little-endian UTF-32, and big-endian UTF-32 text if the file starts with the appropriate byte order marks. Otherwise, the user-provided encoding is used. See the method for more information. diff --git a/xml/System.IO/StreamWriter.xml b/xml/System.IO/StreamWriter.xml index abd03066a0d..b375570521b 100644 --- a/xml/System.IO/StreamWriter.xml +++ b/xml/System.IO/StreamWriter.xml @@ -612,7 +612,7 @@ The stream to write to. The character encoding to use. - The buffer size, in bytes. + The buffer size, in characters. Initializes a new instance of the class for the specified stream by using the specified encoding and buffer size. or is . - is negative. + is less than or equal to zero, except for -1, which is allowed to indicate the default buffer size. is not writable. @@ -871,7 +871,7 @@ The stream to write to. The character encoding to use. - The buffer size, in bytes. + The buffer size, in characters. to leave the stream open after the object is disposed; otherwise, . Initializes a new instance of the class for the specified stream by using the specified encoding and buffer size, and optionally leaves the stream open. @@ -899,7 +899,7 @@ or is . - is negative. + is less than or equal to zero, except for -1, which is allowed to indicate the default buffer size. is not writable. @@ -967,7 +967,7 @@ to append data to the file; to overwrite the file. If the specified file does not exist, this parameter has no effect, and the constructor creates a new file. The character encoding to use. - The buffer size, in bytes. + The buffer size, in characters. Initializes a new instance of the class for the specified file on the specified path, using the specified encoding and buffer size. If the file exists, it can be either overwritten or appended to. If the file does not exist, this constructor creates a new file. or is . - is negative. + is less than or equal to zero, except for -1, which is allowed to indicate the default buffer size. includes an incorrect or invalid syntax for file name, directory name, or volume label syntax. The caller does not have the required permission. diff --git a/xml/System.Net.Http/SocketsHttpHandler.xml b/xml/System.Net.Http/SocketsHttpHandler.xml index 4a5296d7cfc..e9d65d5748f 100644 --- a/xml/System.Net.Http/SocketsHttpHandler.xml +++ b/xml/System.Net.Http/SocketsHttpHandler.xml @@ -993,7 +993,7 @@ For example, if the value is 64, then 65,536 bytes are allowed for the maximum r ]]> - The value specified is less than and is not . + The value specified is less than (except ). An operation has already been started on the current instance. The current instance has been disposed. diff --git a/xml/System.Reflection/MemberInfo.xml b/xml/System.Reflection/MemberInfo.xml index 6f088b8232a..09a69efc440 100644 --- a/xml/System.Reflection/MemberInfo.xml +++ b/xml/System.Reflection/MemberInfo.xml @@ -721,9 +721,9 @@ System.Boolean - Gets a value that indicates whether this object is part of an assembly held in a collectible . + Gets a value that indicates whether this object references one or more assemblies held in a collectible . - if the is part of an assembly held in a collectible assembly load context; otherwise, . + if the references one or more assemblies held in a collectible assembly load context; otherwise, . System.Boolean - Gets the value for this object's , which indicates whether this object, which is a implementation, is part of an assembly held in a collectible . + Gets the value for this object's , which indicates whether this object, which is a implementation, references one or more assemblies held in a collectible . - if this object, which is a implementation, is part of an assembly held in a collectible assembly load context; otherwise, . + if this object, which is a implementation, references one or more assemblies held in a collectible assembly load context; otherwise, . To be added. diff --git a/xml/System.Security.Cryptography/HKDF.xml b/xml/System.Security.Cryptography/HKDF.xml index 549401936d6..6789ade4ed8 100644 --- a/xml/System.Security.Cryptography/HKDF.xml +++ b/xml/System.Security.Cryptography/HKDF.xml @@ -144,7 +144,7 @@ In situations where the input key material is already a uniformly random bit str Performs the key derivation HKDF Expand and Extract functions. To be added. - is empty, or is larger than the maximum allowed length. + is empty, or is larger than the maximum allowed length. diff --git a/xml/System.ServiceModel.Syndication/SyndicationFeed.xml b/xml/System.ServiceModel.Syndication/SyndicationFeed.xml index 539256dbc2d..c7be706ea7e 100644 --- a/xml/System.ServiceModel.Syndication/SyndicationFeed.xml +++ b/xml/System.ServiceModel.Syndication/SyndicationFeed.xml @@ -1465,7 +1465,7 @@ ## Remarks When serialized to Atom 1.0, the collection is written to `` elements. - When serialized to Atom 1.0, the collection is written to `` elements. + When serialized to RSS 2.0, the collection is written to `` elements. diff --git a/xml/System.Threading/CancellationTokenSource.xml b/xml/System.Threading/CancellationTokenSource.xml index a470c54577f..7f35190b0c5 100644 --- a/xml/System.Threading/CancellationTokenSource.xml +++ b/xml/System.Threading/CancellationTokenSource.xml @@ -378,26 +378,30 @@ Communicates a request for cancellation. - will be notified of the cancellation and will transition to a state where returns true. + will be executed. +The associated is notified of the cancellation and transitions to a state where returns true. + +Any callbacks or cancelable operations registered with the are executed, if they haven't already been executed by a previous call to . Subsequent calls to won't execute the same callback again unless reregistered. (Avoid multiple calls to , because the intent of such code is often unclear.) - We recommend that cancelable operations and callbacks registered with not throw exceptions. +Callbacks are executed synchronously in LIFO order. - This overload of Cancel will aggregate any exceptions thrown into an , such that one callback throwing an exception will not prevent other registered callbacks from being executed. +We recommend that cancelable operations and callbacks registered with not throw exceptions. + +This overload of Cancel aggregates any exceptions thrown into an , such that one callback throwing an exception will not prevent other registered callbacks from being executed. - Calling this method has the same effect as calling [`Cancel(false)`](xref:System.Threading.CancellationTokenSource.Cancel(System.Boolean)). +Calling this method has the same effect as calling [`Cancel(false)`](xref:System.Threading.CancellationTokenSource.Cancel(System.Boolean)). ## Examples - The following example uses a random number generator to emulate a data collection application that reads 10 integral values from eleven different instruments. A value of zero indicates that the measurement has failed for one instrument, in which case the operation should be cancelled and no overall mean should be computed. - To handle the possible cancellation of the operation, the example instantiates a object that generates a cancellation token which is passed to a object. The object in turn passes the cancellation token to each of the tasks responsible for collecting readings for a particular instrument. The method is called to ensure that the mean is computed only after all readings have been gathered successfully. If a task has not because it has been cancelled, the call to the method throws an exception. +The following example uses a random number generator to emulate a data collection application that reads 10 integral values from eleven different instruments. A value of zero indicates that the measurement has failed for one instrument, in which case the operation should be cancelled and no overall mean should be computed. - :::code language="csharp" source="~/snippets/csharp/System.Threading/CancellationToken/Overview/cancel1.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System.Threading/CancellationToken/Overview/cancel1.vb" id="Snippet1"::: +To handle the possible cancellation of the operation, the example instantiates a object that generates a cancellation token which is passed to a object. The object in turn passes the cancellation token to each of the tasks responsible for collecting readings for a particular instrument. The method is called to ensure that the mean is computed only after all readings have been gathered successfully. If a task has not because it has been cancelled, the call to the method throws an exception. + +:::code language="csharp" source="~/snippets/csharp/System.Threading/CancellationToken/Overview/cancel1.cs" id="Snippet1"::: +:::code language="vb" source="~/snippets/visualbasic/System.Threading/CancellationToken/Overview/cancel1.vb" id="Snippet1"::: ]]> @@ -453,18 +457,21 @@ if exceptions should immediately propagate; otherwise, . Communicates a request for cancellation, and specifies whether remaining callbacks and cancelable operations should be processed if an exception occurs. - will be notified of the cancellation and will transition to a state where returns `true`. - - Any callbacks or cancelable operations registered with the will be executed. Callbacks will be executed synchronously in LIFO order. + not throw exceptions. +The associated is notified of the cancellation and transitions to a state where returns `true`. + +Any callbacks or cancelable operations registered with the are executed, if they haven't already been executed by a previous call to . Subsequent calls to won't execute the same callback again unless reregistered. (Avoid multiple calls to , because the intent of such code is often unclear.) - If `throwOnFirstException` is `true`, an exception will immediately propagate out of the call to , preventing the remaining callbacks and cancelable operations from being processed. +Callbacks are executed synchronously in LIFO order. + +We recommend that cancelable operations and callbacks registered with not throw exceptions. + +If `throwOnFirstException` is `true`, an exception will immediately propagate out of the call to , preventing the remaining callbacks and cancelable operations from being processed. - If `throwOnFirstException` is `false`, this overload will aggregate any exceptions thrown into an , such that one callback throwing an exception will not prevent other registered callbacks from being executed. +If `throwOnFirstException` is `false`, this overload aggregates any exceptions thrown into an , such that one callback throwing an exception will not prevent other registered callbacks from being executed. ]]> @@ -632,8 +639,8 @@ Communicates a request for cancellation asynchronously. A task that will complete after cancelable operations and callbacks registered with the associated have completed. - The associated will be notified of the cancellation and will synchronously transition to a state where returns . - Any callbacks or cancelable operations registered with the will be executed asynchronously, with the returned representing their eventual completion. + The associated is notified of the cancellation and synchronously transitions to a state where returns . + Any callbacks or cancelable operations registered with the will be executed asynchronously, with the returned representing their eventual completion. Callbacks registered with the token should not throw exceptions. However, any such exceptions that are thrown will be aggregated into an , such that one callback throwing an exception will not prevent other registered callbacks from being executed. diff --git a/xml/System.Threading/ThreadLocal`1.xml b/xml/System.Threading/ThreadLocal`1.xml index acdba4cda1e..3ded2a2b0df 100644 --- a/xml/System.Threading/ThreadLocal`1.xml +++ b/xml/System.Threading/ThreadLocal`1.xml @@ -625,15 +625,17 @@ Returns an instance of the object that this ThreadLocal is responsible for initializing. will attempt to initialize it. If an initialization function was supplied during the construction, that initialization will happen by invoking the function to retrieve the initial value for . Otherwise, the default value of `T` will be used. - + If this instance was not previously initialized for the current thread, accessing will initialize it. + If a value factory was supplied during the construction, initialization will happen by invoking the function to retrieve the initial value for . + Otherwise, the default value of `T` will be used. + Regardless of the initialization method, will be set to `true`. + ]]> The instance has been disposed. The initialization function attempted to reference recursively. - No parameterless constructor is provided and no value factory is supplied. Lazy Initialization How to: Perform Lazy Initialization of Objects diff --git a/xml/System.Web/HttpUtility.xml b/xml/System.Web/HttpUtility.xml index 695d4891029..4b073611681 100644 --- a/xml/System.Web/HttpUtility.xml +++ b/xml/System.Web/HttpUtility.xml @@ -653,7 +653,7 @@ diff --git a/xml/System.Windows.Controls/DataGrid.xml b/xml/System.Windows.Controls/DataGrid.xml index 03aa3bf1c41..d191a68c061 100644 --- a/xml/System.Windows.Controls/DataGrid.xml +++ b/xml/System.Windows.Controls/DataGrid.xml @@ -3267,7 +3267,7 @@ property to `true` to make all the cells in the read-only. To make individual columns or cells read-only, set the or properties. If a conflict exists between the settings at the , column, or cell levels, a value of `true` takes precedence over a value of `false`. + Set the property to `true` to make all the cells in the read-only. To make individual columns read-only, set the property. If a conflict exists between the settings at the , column, or cell levels, a value of `true` takes precedence over a value of `false`. If this property is set to `true` while the control is in editing mode, all pending edits are discarded. diff --git a/xml/System.Windows.Controls/DataGridCell.xml b/xml/System.Windows.Controls/DataGridCell.xml index 8ea588884df..6fb33a61d6e 100644 --- a/xml/System.Windows.Controls/DataGridCell.xml +++ b/xml/System.Windows.Controls/DataGridCell.xml @@ -222,7 +222,7 @@ property to `true` to make an individual cell read-only. Set the property to `true` to make all cells in an individual column read-only. Set the property to `true` to make all cells in the read-only If there is a conflict between the settings at the , column, and cell levels, a value of `true` takes precedence over a value of `false`. + Set the property to `true` to make all cells in an individual column read-only. Set the property to `true` to make all cells in the read-only If there is a conflict between the settings at the , column, and cell levels, a value of `true` takes precedence over a value of `false`. ]]> diff --git a/xml/System.Windows.Media/MediaPlayer.xml b/xml/System.Windows.Media/MediaPlayer.xml index c5717a57f0b..9e41e5ac107 100644 --- a/xml/System.Windows.Media/MediaPlayer.xml +++ b/xml/System.Windows.Media/MediaPlayer.xml @@ -244,10 +244,9 @@ to be clock driven and will utilize the timing engine, placing the player in Clock mode. Any media that is playing is stopped and the associated with the new clock is opened. +Setting this property tells the to be clock driven and will utilize the timing engine, placing the player in Clock mode. Any media that is playing is stopped and the associated with the new clock is opened. - When the player is in clock mode, seeking using or calling the , , or methods will throw an . These operations are only available when the player is null. +When the player is in clock mode, seeking using , changing speed using , or calling the , , or methods will throw an . These operations are only available when the player is null. ]]> diff --git a/xml/System.Windows/SystemParameters.xml b/xml/System.Windows/SystemParameters.xml index c1aa976a5a0..099f45d95c5 100644 --- a/xml/System.Windows/SystemParameters.xml +++ b/xml/System.Windows/SystemParameters.xml @@ -5411,7 +5411,7 @@ Gets a value indicating whether pop-up menus are left-aligned or right-aligned, relative to the corresponding menu item. - if left-aligned; otherwise, . + if right-aligned; otherwise, . Gets the day component of the date represented by this instance. - A number representing the day component of the date represented by this instance. + The day component, expressed as a value between 1 and 31. To be added. @@ -641,7 +641,7 @@ Gets the month component of the date represented by this instance. - A number that represents the month component of the date. + The month component, expressed as a value between 1 and 12. To be added. @@ -2436,7 +2436,7 @@ The property of the resulting Gets the year component of the date represented by this instance. - A number that represents the year component of the date. + The year component, expressed as a value between 1 and 9999. To be added.