Uh oh!
There was an error while loading. Please reload this page.
Specify a security descriptor when using global Mutex - #110416
Conversation
There was a problem hiding this comment.
Copilot reviewed 2 out of 5 changed files in this pull request and generated 2 comments.
Files not reviewed (3)
- src/libraries/System.Diagnostics.EventLog/src/System.Diagnostics.EventLog.csproj: Language not supported
- src/libraries/System.Diagnostics.PerformanceCounter/src/System.Diagnostics.PerformanceCounter.csproj: Language not supported
- src/libraries/System.Diagnostics.PerformanceCounter/tests/System.Diagnostics.PerformanceCounter.Tests.csproj: Language not supported
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
| // We can't test with the same global mutex used by performance counters, since the mutex was likely already | ||
| // initialized elsewhere and perhaps with with different ACLs, so we use a Guid to create a new mutex and | ||
| // then simulate the behavior by calling into EnterMutex() like the performance monitor code does. | ||
| #pragma warning disable CS0436 // Type conflicts with imported type | ||
| NetFrameworkUtils.EnterMutex(mutexName, ref mutex); |
There was a problem hiding this comment.
So this is just testing the utility code without invoking the product at all? Could we instead do something to ensure the product code creates the Mutex, then open the Mutex created by the product and examine the ACL? I think the test should be able to access it since it's running as the same user.
ericstj
commented
May 14, 2025
/azp run runtime |
|
Azure Pipelines successfully started running 1 pipeline(s). |
* [VMR] Codeflow e26a16c-e26a16c [[ commit created by automation ]] * Update dependencies from https://github.com/dotnet/dotnet build 268973 No dependency updates to commit * Align M.CA package versions * Update dependencies from https://github.com/dotnet/dotnet build 269082 Updated Dependencies: dotnet-ef, Microsoft.EntityFrameworkCore.InMemory, Microsoft.EntityFrameworkCore.Relational, Microsoft.EntityFrameworkCore.Sqlite, Microsoft.EntityFrameworkCore.SqlServer, Microsoft.EntityFrameworkCore.Tools, Microsoft.EntityFrameworkCore, Microsoft.EntityFrameworkCore.Design (Version 10.0.0-preview.4.25269.109 -> 10.0.0-preview.4.25265.101) Microsoft.Extensions.Caching.Abstractions, Microsoft.Extensions.Caching.Memory, Microsoft.Extensions.Configuration.Abstractions, Microsoft.Extensions.Configuration.Binder, Microsoft.Extensions.Configuration.CommandLine, Microsoft.Extensions.Configuration.EnvironmentVariables, Microsoft.Extensions.Configuration.FileExtensions, Microsoft.Extensions.Configuration.Ini, Microsoft.Extensions.Configuration.Json, Microsoft.Extensions.Configuration.UserSecrets, Microsoft.Extensions.Configuration.Xml, Microsoft.Extensions.Configuration, Microsoft.Extensions.DependencyInjection.Abstractions, Microsoft.Extensions.DependencyInjection, Microsoft.Extensions.Diagnostics, Microsoft.Extensions.Diagnostics.Abstractions, Microsoft.Extensions.FileProviders.Abstractions, Microsoft.Extensions.FileProviders.Composite, Microsoft.Extensions.FileProviders.Physical, Microsoft.Extensions.FileSystemGlobbing, Microsoft.Extensions.HostFactoryResolver.Sources, Microsoft.Extensions.Hosting.Abstractions, Microsoft.Extensions.Hosting, Microsoft.Extensions.Http, Microsoft.Extensions.Logging.Abstractions, Microsoft.Extensions.Logging.Configuration, Microsoft.Extensions.Logging.Console, Microsoft.Extensions.Logging.Debug, Microsoft.Extensions.Logging.EventSource, Microsoft.Extensions.Logging.EventLog, Microsoft.Extensions.Logging.TraceSource, Microsoft.Extensions.Logging, Microsoft.Extensions.Options.ConfigurationExtensions, Microsoft.Extensions.Options.DataAnnotations, Microsoft.Extensions.Options, Microsoft.Extensions.Primitives, Microsoft.Internal.Runtime.AspNetCore.Transport, System.Configuration.ConfigurationManager, System.Diagnostics.DiagnosticSource, System.Diagnostics.EventLog, System.DirectoryServices.Protocols, System.Formats.Asn1, System.IO.Pipelines, System.Net.Http.Json, System.Net.Http.WinHttpHandler, System.Net.ServerSentEvents, System.Reflection.Metadata, System.Resources.Extensions, System.Security.Cryptography.Pkcs, System.Security.Cryptography.Xml, System.Security.Permissions, System.ServiceProcess.ServiceController, System.Text.Encodings.Web, System.Text.Json, System.Threading.AccessControl, System.Threading.Channels, System.Threading.RateLimiting, Microsoft.Extensions.DependencyModel, Microsoft.NETCore.App.Ref, Microsoft.NET.Runtime.MonoAOTCompiler.Task, Microsoft.NET.Runtime.WebAssembly.Sdk, Microsoft.Bcl.AsyncInterfaces, Microsoft.Bcl.TimeProvider, System.Collections.Immutable, System.Diagnostics.PerformanceCounter, System.IO.Hashing, System.Memory.Data, System.Numerics.Tensors, System.Runtime.Caching, Microsoft.NETCore.App.Runtime.win-x64, Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.browser-wasm, Microsoft.NETCore.BrowserDebugHost.Transport, System.Composition, Microsoft.NETCore.Platforms (Version 10.0.0-preview.5.25269.109 -> 10.0.0-preview.5.25265.101) Microsoft.Web.Xdt (Version 10.0.0-preview.25269.109 -> 10.0.0-preview.25265.101) Microsoft.DotNet.HotReload.Agent, Microsoft.DotNet.HotReload.Agent.Data (Version 10.0.100-preview.5.25269.109 -> 10.0.100-preview.5.25265.101) Microsoft.DotNet.Arcade.Sdk, Microsoft.DotNet.Build.Tasks.Archives, Microsoft.DotNet.Build.Tasks.Installers, Microsoft.DotNet.Build.Tasks.Templating, Microsoft.DotNet.Helix.Sdk, Microsoft.DotNet.RemoteExecutor, Microsoft.DotNet.SharedFramework.Sdk (Version 10.0.0-beta.25269.109 -> 10.0.0-beta.25265.101) * Add System.Threading.AccessControl to expected assemblies It was added in dotnet/runtime#110416 * Adjust expected exit code in ShutdownTests.cs This is a behavior change introduced by dotnet/runtime#115494 * Fix method name, kill by default sends TERM not INT * Revert "Adjust expected exit code in ShutdownTests.cs" This reverts commit 3c695d2. * React to dotnet/runtime#115494 --------- Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: Matt Thalman <mthalman@microsoft.com> Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com> Co-authored-by: Jan Kotas <jkotas@microsoft.com>
It was added in dotnet/runtime#110416 (cherry picked from commit 1d3d3de)
[release/10.0-preview5] Source code updates from dotnet/dotnet - Align M.CA package versions (cherry picked from commit ce921d3) - Add System.Threading.AccessControl to expected assemblies It was added in dotnet/runtime#110416 (cherry picked from commit 1d3d3de) - React to dotnet/runtime#115494 (cherry picked from commit 97ebf48)
Fixes#110399
Adds the same security descriptor as .NET Framework.
This also affects EventLog; the test added here was only added to PerformanceCounter since EventLog shares the same code.
Note the S.D.PerformanceCounter and S.D.EventLog packages get a new package dependency to
System.Security.AccessControlsince that is where the extension methods are defined that are used to set the security descriptor.