Failed test: System.Diagnostics.Tests.EventLogWriteEntryTests.WriteWithoutExistingSource

Open
#119,153 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
csharp

Research direction

Start with System.Diagnostics.EventLog/tests/EventLogTests/EventLogWriteEntryTests.cs, especially WriteWithoutExistingSource around line 392 and WriteEventMessageValues_OutOfRange around line 378. Trace the failure through Common/src/System/Diagnostics/NetFrameworkUtils.cs and System.Diagnostics.EventLog/src/System/Diagnostics/EventLog.cs, then run the affected Windows tests; done means both tests pass without UnauthorizedAccessException.

Written by the indexing model from the issue text.

Description

area-System.Diagnostics.EventLog blocking-clean-ci-optional

Failed in: runtime-coreclr libraries-pgo/20250824.1

Failed tests:

net10.0-windows-Release-x86-jitosr_stress-Windows.10.Amd64.Open
- System.Diagnostics.Tests.EventLogWriteEntryTests.WriteWithoutExistingSource
- System.Diagnostics.Tests.EventLogWriteEntryTests.WriteEventMessageValues_OutOfRange

Error message:

Starting:    System.Diagnostics.EventLog.Tests (parallel test collections = on [4 threads], stop on fail = off)
    System.Diagnostics.Tests.EventLogWriteEntryTests.WriteWithoutExistingSource [FAIL]
      System.UnauthorizedAccessException : Attempted to perform an unauthorized operation.
      Stack Trace:
        /_/src/libraries/System.Security.AccessControl/src/System/Security/AccessControl/Win32.cs(308,0): at System.Security.AccessControl.Win32.SetSecurityInfo(ResourceType type, String name, SafeHandle handle, SecurityInfos securityInformation, SecurityIdentifier owner, SecurityIdentifier group, GenericAcl sacl, GenericAcl dacl)
        /_/src/libraries/System.Security.AccessControl/src/System/Security/AccessControl/NativeObjectSecurity.cs(263,0): at System.Security.AccessControl.NativeObjectSecurity.Persist(String name, SafeHandle handle, AccessControlSections includeSections, Object exceptionContext)
        /_/src/libraries/Common/src/System/Diagnostics/NetFrameworkUtils.cs(32,0): at System.Diagnostics.NetFrameworkUtils.EnterMutexWithoutGlobal(String mutexName, Mutex& mutex)
        /_/src/libraries/Common/src/System/Diagnostics/NetFrameworkUtils.cs(19,0): at System.Diagnostics.NetFrameworkUtils.EnterMutex(String name, Mutex& mutex)
        /_/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/EventLog.cs(446,0): at System.Diagnostics.EventLog.DeleteEventSource(String source, String machineName)
        /_/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/EventLog.cs(433,0): at System.Diagnostics.EventLog.DeleteEventSource(String source)
        /_/src/libraries/System.Diagnostics.EventLog/tests/EventLogTests/EventLogWriteEntryTests.cs(392,0): at System.Diagnostics.Tests.EventLogWriteEntryTests.WriteWithoutExistingSource()
        /_/src/coreclr/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.CoreCLR.cs(36,0): at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
        /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs(57,0): at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
    System.Diagnostics.Tests.EventLogWriteEntryTests.WriteEventMessageValues_OutOfRange [FAIL]
      System.AggregateException : One or more errors occurred. (Assert.Throws() Failure: Exception type was not an exact match
      Expected: typeof(System.ArgumentException)
      Actual:   typeof(System.UnauthorizedAccessException)) (Assert.Throws() Failure: Exception type was not an exact match
    ...
    Stack Trace:
        /_/src/libraries/Common/tests/TestUtilities/System/RetryHelper.cs(54,0): at System.RetryHelper.Execute(Action test, Int32 maxAttempts, Func`2 backoffFunc, Predicate`1 retryWhen, String testName)
        /_/src/libraries/System.Diagnostics.EventLog/tests/Helpers.cs(40,0): at System.Diagnostics.Tests.Helpers.Retry[T](Func`1 func)
        /_/src/libraries/System.Diagnostics.EventLog/tests/EventLogTests/EventLogWriteEntryTests.cs(378,0): at System.Diagnostics.Tests.EventLogWriteEntryTests.WriteEventMessageValues_OutOfRange()
           at System.RuntimeMethodHandle.InvokeMethod(ObjectHandleOnStack target, Void** arguments, ObjectHandleOnStack sig, BOOL isConstructor, ObjectHandleOnStack result)
           at System.RuntimeMethodHandle.InvokeMethod(ObjectHandleOnStack target, Void** arguments, ObjectHandleOnStack sig, BOOL isConstructor, ObjectHandleOnStack result)
        /_/src/coreclr/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.CoreCLR.cs(36,0): at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
        /_/src/libraries/System.Private.CoreLib/src/System/Reflection/RuntimeMethodInfo.cs(126,0): at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
        ----- Inner Stack Trace #1 (Xunit.Sdk.ThrowsException) -----
        /_/src/libraries/System.Diagnostics.EventLog/tests/EventLogTests/EventLogWriteEntryTests.cs(378,0): at System.Diagnostics.Tests.EventLogWriteEntryTests.<>c__DisplayClass19_0.<WriteEventMessageValues_OutOfRange>b__0()
        /_/src/libraries/System.Diagnostics.EventLog/tests/Helpers.cs(42,0): at System.Diagnostics.Tests.Helpers.<>c__DisplayClass10_0`1.<Retry>b__0()
        /_/src/libraries/Common/tests/TestUtilities/System/RetryHelper.cs(45,0): at System.RetryHelper.Execute(Action test, Int32 maxAttempts, Func`2 backoffFunc, Predicate`1 retryWhen, String testName)
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/runtime

All issues in dotnet/runtime

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.