Skip to content

Commit 248c462

Browse files
Merge pull request #10340 from dotnet/main
Merge main into live
2 parents e7ee3cf + 1667ba9 commit 248c462

File tree

110 files changed

+8727
-8708
lines changed

Some content is hidden

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

110 files changed

+8727
-8708
lines changed
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: 21 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class SafeHandlesExample
77
{
88
static void Main()
99
{
10-
UnmanagedMutex uMutex = new UnmanagedMutex("YourCompanyName_SafeHandlesExample_MUTEX");
10+
UnmanagedMutex uMutex = new("YourCompanyName_SafeHandlesExample_MUTEX");
1111

1212
try
1313
{
@@ -22,49 +22,43 @@ static void Main()
2222
finally
2323
{
2424
uMutex.Release();
25-
Console.WriteLine("Mutex Released.");
25+
Console.WriteLine("Mutex released.");
2626
}
27-
28-
Console.ReadLine();
2927
}
3028
}
3129

32-
class UnmanagedMutex
30+
partial class UnmanagedMutex(string Name)
3331
{
34-
3532
// Use interop to call the CreateMutex function.
36-
// For more information about CreateMutex,
37-
// see the unmanaged MSDN reference library.
38-
[DllImport("kernel32.dll", CharSet=CharSet.Unicode)]
39-
static extern SafeWaitHandle CreateMutex(IntPtr lpMutexAttributes, bool bInitialOwner,
40-
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+
);
4139

4240
// Use interop to call the ReleaseMutex function.
4341
// For more information about ReleaseMutex,
4442
// see the unmanaged MSDN reference library.
45-
[DllImport("kernel32.dll")]
46-
public static extern bool ReleaseMutex(SafeWaitHandle hMutex);
43+
[LibraryImport("kernel32.dll")]
44+
[return: MarshalAs(UnmanagedType.Bool)]
45+
public static partial bool ReleaseMutex(SafeWaitHandle hMutex);
4746

48-
private SafeWaitHandle handleValue = null;
49-
private IntPtr mutexAttrValue = IntPtr.Zero;
50-
private string nameValue = null;
51-
52-
public UnmanagedMutex(string Name)
53-
{
54-
nameValue = Name;
55-
}
47+
private SafeWaitHandle _handleValue = null;
48+
private readonly IntPtr _mutexAttrValue = IntPtr.Zero;
49+
private string nameValue = Name;
5650

5751
public void Create()
5852
{
5953
ArgumentException.ThrowIfNullOrEmpty(nameValue);
6054

61-
handleValue = CreateMutex(mutexAttrValue,
55+
_handleValue = CreateMutex(_mutexAttrValue,
6256
true, nameValue);
6357

6458
// If the handle is invalid,
6559
// get the last Win32 error
6660
// and throw a Win32Exception.
67-
if (handleValue.IsInvalid)
61+
if (_handleValue.IsInvalid)
6862
{
6963
Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
7064
}
@@ -74,11 +68,9 @@ public SafeWaitHandle Handle
7468
{
7569
get
7670
{
77-
// If the handle is valid,
78-
// return it.
79-
if (!handleValue.IsInvalid)
71+
if (!_handleValue.IsInvalid)
8072
{
81-
return handleValue;
73+
return _handleValue;
8274
}
8375
else
8476
{
@@ -87,17 +79,11 @@ public SafeWaitHandle Handle
8779
}
8880
}
8981

90-
public string Name
91-
{
92-
get
93-
{
94-
return nameValue;
95-
}
96-
}
82+
public string Name => nameValue;
9783

9884
public void Release()
9985
{
100-
ReleaseMutex(handleValue);
86+
ReleaseMutex(_handleValue);
10187
}
10288
}
10389
//</Snippet1>

xml/Microsoft.Build.Tasks.Windows/GenerateTemporaryTargetAssembly.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</Base>
1616
<Interfaces />
1717
<Docs>
18-
<summary>Implements the <c>GenerateTemporaryTargetAssembly</c> task. Use the <c>GenerateTemporaryTargetAssembly</c> element in your project file to create and execute this task. For usage and parameter information, see [GenerateTemporaryTargetAssembly](/visualstudio/msbuild/generatetemporarytargetassembly-task).</summary>
18+
<summary>Implements the <c>GenerateTemporaryTargetAssembly</c> task. Use the <c>GenerateTemporaryTargetAssembly</c> element in your project file to create and execute this task. For usage and parameter information, see <see href="/visualstudio/msbuild/generatetemporarytargetassembly-task">GenerateTemporaryTargetAssembly</see>.</summary>
1919
<remarks>To be added.</remarks>
2020
<forInternalUseOnly />
2121
</Docs>
@@ -265,13 +265,13 @@
265265
<value>
266266
<see langword="true" /> if debugging information is enabled for the <see cref="T:Microsoft.Build.Tasks.Windows.GenerateTemporaryTargetAssembly" /> Task; otherwise, <see langword="false" />.</value>
267267
<remarks>
268-
<format type="text/markdown"><![CDATA[
269-
270-
## Remarks
271-
The <xref:Microsoft.Build.Tasks.Windows.GenerateTemporaryTargetAssembly.GenerateTemporaryTargetAssemblyDebuggingInformation%2A> property is an optional task parameter. It's a diagnostic parameter, and it defaults to `false`.
272-
273-
The only debugging information that is generated consists of the temporary project that is created to generate the temporary target assembly. The temporary project is normally deleted at the end of the MSBuild task. When <xref:Microsoft.Build.Tasks.Windows.GenerateTemporaryTargetAssembly.GenerateTemporaryTargetAssemblyDebuggingInformation%2A> is enabled, the temporary project is retained for inspection by the developer.
274-
268+
<format type="text/markdown"><![CDATA[
269+
270+
## Remarks
271+
The <xref:Microsoft.Build.Tasks.Windows.GenerateTemporaryTargetAssembly.GenerateTemporaryTargetAssemblyDebuggingInformation%2A> property is an optional task parameter. It's a diagnostic parameter, and it defaults to `false`.
272+
273+
The only debugging information that is generated consists of the temporary project that is created to generate the temporary target assembly. The temporary project is normally deleted at the end of the MSBuild task. When <xref:Microsoft.Build.Tasks.Windows.GenerateTemporaryTargetAssembly.GenerateTemporaryTargetAssemblyDebuggingInformation%2A> is enabled, the temporary project is retained for inspection by the developer.
274+
275275
]]></format>
276276
</remarks>
277277
</Docs>

xml/Microsoft.JScript/ErrorType.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
</ReturnValue>
4343
<MemberValue>1</MemberValue>
4444
<Docs>
45-
<summary>An [eval Method (Visual Studio - JScript)](/previous-versions/visualstudio/visual-studio-2010/b51a45x6(v=vs.100)) error. Corresponds to the <see cref="T:Microsoft.JScript.EvalErrorObject" /> object.</summary>
45+
<summary>An <see href="/previous-versions/visualstudio/visual-studio-2010/b51a45x6(v=vs.100)">eval Method (Visual Studio - JScript)</see> error. Corresponds to the <see cref="T:Microsoft.JScript.EvalErrorObject" /> object.</summary>
4646
<forInternalUseOnly />
4747
</Docs>
4848
</Member>

xml/Microsoft.JScript/EvalErrorObject.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</Base>
1717
<Interfaces />
1818
<Docs>
19-
<summary>Represents an error that occurs when the <see langword="eval" /> method is used. For more information, see [eval Method (Visual Studio - JScript)](/previous-versions/visualstudio/visual-studio-2010/b51a45x6(v=vs.100)).</summary>
19+
<summary>Represents an error that occurs when the <see langword="eval" /> method is used. For more information, see <see href="/previous-versions/visualstudio/visual-studio-2010/b51a45x6(v=vs.100)">eval Method (Visual Studio - JScript)</see>.</summary>
2020
<remarks>To be added.</remarks>
2121
<forInternalUseOnly />
2222
<altmember cref="T:Microsoft.JScript.ErrorType" />

0 commit comments

Comments
 (0)