Skip to content

Commit 1579d4c

Browse files
authored
Merge branch 'main' into memory_fix
2 parents 1a2f0b3 + 9a5badc commit 1579d4c

File tree

773 files changed

+55772
-65511
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

773 files changed

+55772
-65511
lines changed
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
If the `mode` parameter is set to <xref:System.IO.Compression.ZipArchiveMode.Read>, the stream must support reading. If the `mode` parameter is set to <xref:System.IO.Compression.ZipArchiveMode.Create>, the stream must support writing. If the `mode` parameter is set to <xref:System.IO.Compression.ZipArchiveMode.Update>, the stream must support reading, writing, and seeking.
22

3-
When you open a zip archive file for reading and `entryNameEncoding` is set to `null`, entry names are decoded according to the following rules:
3+
When you open a zip archive file for reading and `entryNameEncoding` is set to `null`, entry names and comments are decoded according to the following rules:
44

5-
- When the language encoding flag (in the general-purpose bit flag of the local file header) is not set, the current system default code page is used to decode the entry name.
5+
- When the language encoding flag (in the general-purpose bit flag of the local file header) is not set, the current system default code page is used to decode the entry name and comment.
66

7-
- When the language encoding flag is set, UTF-8 is used to decode the entry name.
7+
- When the language encoding flag is set, UTF-8 is used to decode the entry name and comment.
88

9-
When you open a zip archive file for reading and `entryNameEncoding` is set to a value other than `null`, entry names are decoded according to the following rules:
9+
When you open a zip archive file for reading and `entryNameEncoding` is set to a value other than `null`, entry names and comments are decoded according to the following rules:
1010

11-
- When the language encoding flag is not set, the specified `entryNameEncoding` is used to decode the entry name.
11+
- When the language encoding flag is not set, the specified `entryNameEncoding` is used to decode the entry name and comment.
1212

13-
- When the language encoding flag is set, UTF-8 is used to decode the entry name.
13+
- When the language encoding flag is set, UTF-8 is used to decode the entry name and comment.
1414

15-
When you write to archive files and `entryNameEncoding` is set to `null`, entry names are encoded according to the following rules:
15+
When you write to archive files and `entryNameEncoding` is set to `null`, entry names and comments are encoded according to the following rules:
1616

17-
- For entry names that contain characters outside the ASCII range, the language encoding flag is set, and entry names are encoded by using UTF-8.
17+
- For entry names and comments that contain characters outside the ASCII range, the language encoding flag is set, and entry names and comments are encoded by using UTF-8.
1818

19-
- For entry names that contain only ASCII characters, the language encoding flag is not set, and entry names are encoded by using the current system default code page.
19+
- For entry names and comments that contain only ASCII characters, the language encoding flag is not set, and entry names and comments are encoded by using the current system default code page.
2020

21-
When you write to archive files and `entryNameEncoding` is set to a value other than `null`, the specified `entryNameEncoding` is used to encode the entry names into bytes. The language encoding flag (in the general-purpose bit flag of the local file header) is set only when the specified encoding is a UTF-8 encoding.
21+
When you write to archive files and `entryNameEncoding` is set to a value other than `null`, the specified `entryNameEncoding` is used to encode the entry names and comments into bytes. The language encoding flag (in the general-purpose bit flag of the local file header) is set only when the specified encoding is a UTF-8 encoding.

includes/remarks/System.IO.Compression/ZipFile/Open.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@ When you set the `mode` parameter to <xref:System.IO.Compression.ZipArchiveMode.
44

55
When you set the `mode` parameter to <xref:System.IO.Compression.ZipArchiveMode.Update>, the archive is opened with <xref:System.IO.FileMode.OpenOrCreate?displayProperty=nameWithType> as the file mode value. If the archive exists, it is opened. The existing entries can be modified and new entries can be created. If the archive does not exist, a new archive is created; however, creating a zip archive in <xref:System.IO.Compression.ZipArchiveMode.Update> mode is not as efficient as creating it in <xref:System.IO.Compression.ZipArchiveMode.Create> mode.
66

7-
When you open a zip archive file for reading and `entryNameEncoding` is set to `null`, entry names are decoded according to the following rules:
7+
When you open a zip archive file for reading and `entryNameEncoding` is set to `null`, entry names and comments are decoded according to the following rules:
88

9-
- When the language encoding flag (in the general-purpose bit flag of the local file header) is not set, the current system default code page is used to decode the entry name.
9+
- When the language encoding flag (in the general-purpose bit flag of the local file header) is not set, the current system default code page is used to decode the entry name and comment.
1010

11-
- When the language encoding flag is set, UTF-8 is used to decode the entry name.
11+
- When the language encoding flag is set, UTF-8 is used to decode the entry name and comment.
1212

13-
When you open a zip archive file for reading and `entryNameEncoding` is set to a value other than `null`, entry names are decoded according to the following rules:
13+
When you open a zip archive file for reading and `entryNameEncoding` is set to a value other than `null`, entry names and comments are decoded according to the following rules:
1414

15-
- When the language encoding flag is not set, the specified `entryNameEncoding` is used to decode the entry name.
15+
- When the language encoding flag is not set, the specified `entryNameEncoding` is used to decode the entry name and comment.
1616

17-
- When the language encoding flag is set, UTF-8 is used to decode the entry name.
17+
- When the language encoding flag is set, UTF-8 is used to decode the entry name and comment.
1818

19-
When you write to archive files and `entryNameEncoding` is set to `null`, entry names are encoded according to the following rules:
19+
When you write to archive files and `entryNameEncoding` is set to `null`, entry names and comments are encoded according to the following rules:
2020

21-
- For entry names that contain characters outside the ASCII range, the language encoding flag is set, and entry names are encoded by using UTF-8.
21+
- For entry names or comments that contain characters outside the ASCII range, the language encoding flag is set, and entry names and comments are encoded by using UTF-8.
2222

23-
- For entry names that contain only ASCII characters, the language encoding flag is not set, and entry names are encoded by using the current system default code page.
23+
- For entry names or comments that contain only ASCII characters, the language encoding flag is not set, and entry names and comments are encoded by using the current system default code page.
2424

25-
When you write to archive files and `entryNameEncoding` is set to a value other than `null`, the specified `entryNameEncoding` is used to encode the entry names into bytes. The language encoding flag (in the general-purpose bit flag of the local file header) is set only when the specified encoding is a UTF-8 encoding.
25+
When you write to archive files and `entryNameEncoding` is set to a value other than `null`, the specified `entryNameEncoding` is used to encode the entry names and comments into bytes. The language encoding flag (in the general-purpose bit flag of the local file header) is set only when the specified encoding is a UTF-8 encoding.
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<OutputType>Library</OutputType>
5-
<TargetFramework>net6.0</TargetFramework>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
67
</PropertyGroup>
78

89
</Project>

snippets/csharp/Microsoft.Win32.SafeHandles/SafeWaitHandle/Overview/sample.cs

Lines changed: 23 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@
55

66
class SafeHandlesExample
77
{
8-
98
static void Main()
109
{
11-
UnmanagedMutex uMutex = new UnmanagedMutex("YourCompanyName_SafeHandlesExample_MUTEX");
10+
UnmanagedMutex uMutex = new("YourCompanyName_SafeHandlesExample_MUTEX");
1211

1312
try
1413
{
15-
1614
uMutex.Create();
1715
Console.WriteLine("Mutex created. Press Enter to release it.");
1816
Console.ReadLine();
@@ -24,52 +22,43 @@ static void Main()
2422
finally
2523
{
2624
uMutex.Release();
27-
Console.WriteLine("Mutex Released.");
25+
Console.WriteLine("Mutex released.");
2826
}
29-
30-
Console.ReadLine();
3127
}
3228
}
3329

34-
class UnmanagedMutex
30+
partial class UnmanagedMutex(string Name)
3531
{
36-
3732
// Use interop to call the CreateMutex function.
38-
// For more information about CreateMutex,
39-
// see the unmanaged MSDN reference library.
40-
[DllImport("kernel32.dll", CharSet=CharSet.Unicode)]
41-
static extern SafeWaitHandle CreateMutex(IntPtr lpMutexAttributes, bool bInitialOwner,
42-
string lpName);
33+
[LibraryImport("kernel32.dll", EntryPoint = "CreateMutexW", StringMarshalling = StringMarshalling.Utf16)]
34+
private static partial SafeWaitHandle CreateMutex(
35+
IntPtr lpMutexAttributes,
36+
[MarshalAs(UnmanagedType.Bool)] bool bInitialOwner,
37+
string lpName
38+
);
4339

4440
// Use interop to call the ReleaseMutex function.
4541
// For more information about ReleaseMutex,
4642
// see the unmanaged MSDN reference library.
47-
[DllImport("kernel32.dll")]
48-
public static extern bool ReleaseMutex(SafeWaitHandle hMutex);
49-
50-
private SafeWaitHandle handleValue = null;
51-
private IntPtr mutexAttrValue = IntPtr.Zero;
52-
private string nameValue = null;
43+
[LibraryImport("kernel32.dll")]
44+
[return: MarshalAs(UnmanagedType.Bool)]
45+
public static partial bool ReleaseMutex(SafeWaitHandle hMutex);
5346

54-
public UnmanagedMutex(string Name)
55-
{
56-
nameValue = Name;
57-
}
47+
private SafeWaitHandle _handleValue = null;
48+
private readonly IntPtr _mutexAttrValue = IntPtr.Zero;
49+
private string nameValue = Name;
5850

5951
public void Create()
6052
{
61-
if (nameValue == null && nameValue.Length == 0)
62-
{
63-
throw new ArgumentNullException("nameValue");
64-
}
53+
ArgumentException.ThrowIfNullOrEmpty(nameValue);
6554

66-
handleValue = CreateMutex(mutexAttrValue,
55+
_handleValue = CreateMutex(_mutexAttrValue,
6756
true, nameValue);
6857

6958
// If the handle is invalid,
7059
// get the last Win32 error
7160
// and throw a Win32Exception.
72-
if (handleValue.IsInvalid)
61+
if (_handleValue.IsInvalid)
7362
{
7463
Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
7564
}
@@ -79,11 +68,9 @@ public SafeWaitHandle Handle
7968
{
8069
get
8170
{
82-
// If the handle is valid,
83-
// return it.
84-
if (!handleValue.IsInvalid)
71+
if (!_handleValue.IsInvalid)
8572
{
86-
return handleValue;
73+
return _handleValue;
8774
}
8875
else
8976
{
@@ -92,17 +79,11 @@ public SafeWaitHandle Handle
9279
}
9380
}
9481

95-
public string Name
96-
{
97-
get
98-
{
99-
return nameValue;
100-
}
101-
}
82+
public string Name => nameValue;
10283

10384
public void Release()
10485
{
105-
ReleaseMutex(handleValue);
86+
ReleaseMutex(_handleValue);
10687
}
10788
}
108-
//</Snippet1>
89+
//</Snippet1>

snippets/csharp/System.Collections.Generic/LinkedListT/Overview/source.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public static void Main()
102102

103103
// Add the node after the node referred to by mark2.
104104
sentence.AddAfter(mark2, current);
105-
IndicateNode(current, "Test 13: Add node removed in test 11 after a referenced node (brown):");
105+
IndicateNode(current, "Test 13: Add node removed in test 12 after a referenced node (brown):");
106106

107107
// The Remove method finds and removes the
108108
// first node that that has the specified value.
@@ -231,7 +231,7 @@ private static void IndicateNode(LinkedListNode<string> node, string test)
231231
//Test 12: Remove current node (dog) and attempt to indicate it:
232232
//Node 'dog' is not in the list.
233233

234-
//Test 13: Add node removed in test 11 after a referenced node (brown):
234+
//Test 13: Add node removed in test 12 after a referenced node (brown):
235235
//the quick brown (dog) jumps over the lazy old fox
236236

237237
//Test 14: Remove node that has the value 'old':

snippets/csharp/System.Diagnostics/ProcessStartInfo/Verb/source.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// <Snippet1>
2-
// <Snippet3>
32
using System;
43
using System.ComponentModel;
54
using System.IO;
@@ -49,14 +48,13 @@ static void Main()
4948
startInfo.Verb = verbToUse;
5049
if (verbToUse.ToLower().IndexOf("printto") >= 0)
5150
{
52-
// printto implies a specific printer. Ask for the network address.
51+
// printto implies a specific printer. Ask for the network address.
5352
// The address must be in the form \\server\printer.
5453
// The printer address is passed as the Arguments property.
5554
Console.Write("Enter the network address of the target printer: ");
5655
var arguments = Console.ReadLine();
5756
startInfo.Arguments = arguments;
5857
}
59-
// </Snippet4>
6058

6159
try
6260
{
@@ -81,6 +79,7 @@ static void Main()
8179
Console.WriteLine($"Unable to start '{fileName}' with verb {verbToUse}");
8280
}
8381
}
82+
// </Snippet4>
8483
}
8584
else
8685
{
@@ -90,5 +89,4 @@ static void Main()
9089
}
9190
}
9291
}
93-
// </Snippet3>
9492
// </Snippet1>

snippets/csharp/System/Object/GetType/GetTypeEx2.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public static void Main()
2626

2727
// The example displays the following output:
2828
// 12 is a 32-bit integer.
29-
// 10653 is a 32-bit integer.
29+
// 10653 is a 64-bit integer.
3030
// 12 is an unsigned byte.
3131
// -5 is a signed byte.
3232
// 16.3 is a double-precision floating point.

xml/FrameworksIndex/net-6.0.xml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12921,12 +12921,6 @@
1292112921
</Namespace>
1292212922
<Namespace Name="System.Collections.Generic">
1292312923
<Type Name="System.Collections.Generic.CollectionExtensions" Id="T:System.Collections.Generic.CollectionExtensions">
12924-
<Member Id="M:System.Collections.Generic.CollectionExtensions.GetDefaultAssets(System.Collections.Generic.IEnumerable{Microsoft.Extensions.DependencyModel.RuntimeAssetGroup})" />
12925-
<Member Id="M:System.Collections.Generic.CollectionExtensions.GetDefaultGroup(System.Collections.Generic.IEnumerable{Microsoft.Extensions.DependencyModel.RuntimeAssetGroup})" />
12926-
<Member Id="M:System.Collections.Generic.CollectionExtensions.GetDefaultRuntimeFileAssets(System.Collections.Generic.IEnumerable{Microsoft.Extensions.DependencyModel.RuntimeAssetGroup})" />
12927-
<Member Id="M:System.Collections.Generic.CollectionExtensions.GetRuntimeAssets(System.Collections.Generic.IEnumerable{Microsoft.Extensions.DependencyModel.RuntimeAssetGroup},System.String)" />
12928-
<Member Id="M:System.Collections.Generic.CollectionExtensions.GetRuntimeFileAssets(System.Collections.Generic.IEnumerable{Microsoft.Extensions.DependencyModel.RuntimeAssetGroup},System.String)" />
12929-
<Member Id="M:System.Collections.Generic.CollectionExtensions.GetRuntimeGroup(System.Collections.Generic.IEnumerable{Microsoft.Extensions.DependencyModel.RuntimeAssetGroup},System.String)" />
1293012924
<Member Id="M:System.Collections.Generic.CollectionExtensions.GetValueOrDefault``2(System.Collections.Generic.IReadOnlyDictionary{``0,``1},``0)" />
1293112925
<Member Id="M:System.Collections.Generic.CollectionExtensions.GetValueOrDefault``2(System.Collections.Generic.IReadOnlyDictionary{``0,``1},``0,``1)" />
1293212926
<Member Id="M:System.Collections.Generic.CollectionExtensions.Remove``2(System.Collections.Generic.IDictionary{``0,``1},``0,``1@)" />
@@ -22251,7 +22245,6 @@
2225122245
<Member Id="P:System.Data.Odbc.OdbcParameter.Direction" />
2225222246
<Member Id="P:System.Data.Odbc.OdbcParameter.IsNullable" />
2225322247
<Member Id="P:System.Data.Odbc.OdbcParameter.OdbcType" />
22254-
<Member Id="P:System.Data.Odbc.OdbcParameter.Offset" />
2225522248
<Member Id="P:System.Data.Odbc.OdbcParameter.ParameterName" />
2225622249
<Member Id="P:System.Data.Odbc.OdbcParameter.Precision" />
2225722250
<Member Id="P:System.Data.Odbc.OdbcParameter.Scale" />
@@ -26665,7 +26658,6 @@
2666526658
<Member Id="M:System.DirectoryServices.ActiveDirectory.ActiveDirectoryObjectNotFoundException.#ctor(System.String,System.Exception)" />
2666626659
<Member Id="M:System.DirectoryServices.ActiveDirectory.ActiveDirectoryObjectNotFoundException.#ctor(System.String,System.Type,System.String)" />
2666726660
<Member Id="M:System.DirectoryServices.ActiveDirectory.ActiveDirectoryObjectNotFoundException.GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)" />
26668-
<Member Id="P:System.DirectoryServices.ActiveDirectory.ActiveDirectoryObjectNotFoundException.Message" />
2666926661
<Member Id="P:System.DirectoryServices.ActiveDirectory.ActiveDirectoryObjectNotFoundException.Name" />
2667026662
<Member Id="P:System.DirectoryServices.ActiveDirectory.ActiveDirectoryObjectNotFoundException.Type" />
2667126663
</Type>
@@ -28345,6 +28337,7 @@
2834528337
<Member Id="M:System.DirectoryServices.Protocols.DirectoryOperationException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)" />
2834628338
<Member Id="M:System.DirectoryServices.Protocols.DirectoryOperationException.#ctor(System.String)" />
2834728339
<Member Id="M:System.DirectoryServices.Protocols.DirectoryOperationException.#ctor(System.String,System.Exception)" />
28340+
<Member Id="M:System.DirectoryServices.Protocols.DirectoryOperationException.GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)" />
2834828341
<Member Id="P:System.DirectoryServices.Protocols.DirectoryOperationException.Response" />
2834928342
</Type>
2835028343
<Type Name="System.DirectoryServices.Protocols.DirectoryRequest" Id="T:System.DirectoryServices.Protocols.DirectoryRequest">
@@ -28457,6 +28450,7 @@
2845728450
<Member Id="M:System.DirectoryServices.Protocols.LdapException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)" />
2845828451
<Member Id="M:System.DirectoryServices.Protocols.LdapException.#ctor(System.String)" />
2845928452
<Member Id="M:System.DirectoryServices.Protocols.LdapException.#ctor(System.String,System.Exception)" />
28453+
<Member Id="M:System.DirectoryServices.Protocols.LdapException.GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)" />
2846028454
<Member Id="P:System.DirectoryServices.Protocols.LdapException.ErrorCode" />
2846128455
<Member Id="P:System.DirectoryServices.Protocols.LdapException.PartialResults" />
2846228456
<Member Id="P:System.DirectoryServices.Protocols.LdapException.ServerErrorMessage" />
@@ -28641,8 +28635,13 @@
2864128635
<Member Id="P:System.DirectoryServices.Protocols.SearchRequest.TypesOnly" />
2864228636
</Type>
2864328637
<Type Name="System.DirectoryServices.Protocols.SearchResponse" Id="T:System.DirectoryServices.Protocols.SearchResponse">
28638+
<Member Id="P:System.DirectoryServices.Protocols.SearchResponse.Controls" />
2864428639
<Member Id="P:System.DirectoryServices.Protocols.SearchResponse.Entries" />
28640+
<Member Id="P:System.DirectoryServices.Protocols.SearchResponse.ErrorMessage" />
28641+
<Member Id="P:System.DirectoryServices.Protocols.SearchResponse.MatchedDN" />
2864528642
<Member Id="P:System.DirectoryServices.Protocols.SearchResponse.References" />
28643+
<Member Id="P:System.DirectoryServices.Protocols.SearchResponse.Referral" />
28644+
<Member Id="P:System.DirectoryServices.Protocols.SearchResponse.ResultCode" />
2864628645
</Type>
2864728646
<Type Name="System.DirectoryServices.Protocols.SearchResultAttributeCollection" Id="T:System.DirectoryServices.Protocols.SearchResultAttributeCollection">
2864828647
<Member Id="M:System.DirectoryServices.Protocols.SearchResultAttributeCollection.Contains(System.String)" />

0 commit comments

Comments
 (0)