Skip to content

[NativeAot] Microsoft.Extensions.Logging.EventSource.Tests failure #73438

Closed

Description

@MichalStrehovsky

I think these tests are just untrimmable, but I can't make sense of this.

I think it's about the serializer-like pattern in EventSource but someone who actually understands what's going on might want to go over this.

C:\git\runtime\artifacts\bin\Microsoft.Extensions.Logging.EventSource.Tests\Release\net7.0\publish>Microsoft.Extensions.Logging.EventSource.Tests.exe -notrait category=failing
Running assembly:Microsoft.Extensions.Logging.EventSource.Tests, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
[FAIL] Microsoft.Extensions.Logging.Test.EventSourceLoggerTest.Logs_OnlyMessage_IfKeywordSet
Assert.Collection() Failure
Collection: ["{\"__EVENT_NAME\":\"Message\",\"Level\":1,\"Factor"..., "{\"__EVENT_NAME\":\"Message\",\"Level\":2,\"Factor"..., "{\"__EVENT_NAME\":\"ActivityStart\",\"ID\":1,\"Fac"..., "{\"__EVENT_NAME\":\"Message\",\"Level\":4,\"Factor"..., "{\"__EVENT_NAME\":\"Message\",\"Level\":5,\"Factor"..., ...]
Error during comparison of item at index 4
Inner exception: Event data '{"__EVENT_NAME":"Message","Level":5,"FactoryID":3,"LoggerName":"Logger2","EventId":5,"EventName":"","Exception":null,"Arguments":[{"Key":"stringParam","Value":"bar"},{"Key":"int1Param","Value":"23"},{"Key":"int2Param","Value":"45"},{"Key":"{OriginalFormat}","Value":"Logger2 Event5 Critical {stringParam} {int1Param} {int2Param}"}]}' does not contain expected fragment "Exception":{"TypeName":"System.Exception","Message":"oops","HResult":-2146233088,"VerboseMessage":"System.Exception: oops\r\n ---> System.Exception: inner oops
        Expected: True
        Actual:   False
   at Microsoft.Extensions.Logging.Test.EventSourceLoggerTest.VerifySingleEvent(String, String, String, Nullable`1, String, Nullable`1, String[]) + 0xc1b
   at Microsoft.Extensions.Logging.Test.EventSourceLoggerTest.<>c.<.cctor>b__35_14(String) + 0xc6
   at Microsoft.Extensions.Logging.Test.EventSourceLoggerTest.Logs_OnlyMessage_IfKeywordSet() + 0x169
   at Microsoft.Extensions.Logging.EventSource.Tests!<BaseAddress>+0xb3376c
   at System.Reflection.DynamicInvokeInfo.Invoke(Object, IntPtr, Object[], BinderBundle, Boolean) + 0xf1
[FAIL] Microsoft.Extensions.Logging.Test.EventSourceLoggerTest.Logs_AsExpected_WithDefaults
Assert.Collection() Failure
Collection: ["{\"__EVENT_NAME\":\"FormattedMessage\",\"Level\":1"..., "{\"__EVENT_NAME\":\"Message\",\"Level\":1,\"Factor"..., "{\"__EVENT_NAME\":\"MessageJson\",\"Level\":1,\"Fa"..., "{\"__EVENT_NAME\":\"FormattedMessage\",\"Level\":2"..., "{\"__EVENT_NAME\":\"Message\",\"Level\":2,\"Factor"..., ...]
Error during comparison of item at index 11
Inner exception: Event data '{"__EVENT_NAME":"Message","Level":5,"FactoryID":16,"LoggerName":"Logger2","EventId":5,"EventName":"","Exception":null,"Arguments":[{"Key":"stringParam","Value":"bar"},{"Key":"int1Param","Value":"23"},{"Key":"int2Param","Value":"45"},{"Key":"{OriginalFormat}","Value":"Logger2 Event5 Critical {stringParam} {int1Param} {int2Param}"}]}' does not contain expected fragment "Exception":{"TypeName":"System.Exception","Message":"oops","HResult":-2146233088,"VerboseMessage":"System.Exception: oops\r\n ---> System.Exception: inner oops
        Expected: True
        Actual:   False
   at Microsoft.Extensions.Logging.Test.EventSourceLoggerTest.VerifySingleEvent(String, String, String, Nullable`1, String, Nullable`1, String[]) + 0xc1b
   at Microsoft.Extensions.Logging.Test.EventSourceLoggerTest.<>c.<.cctor>b__35_14(String) + 0xc6
   at Microsoft.Extensions.Logging.Test.EventSourceLoggerTest.Logs_AsExpected_WithDefaults() + 0x266
   at Microsoft.Extensions.Logging.EventSource.Tests!<BaseAddress>+0xb3376c
   at System.Reflection.DynamicInvokeInfo.Invoke(Object, IntPtr, Object[], BinderBundle, Boolean) + 0xf1
[FAIL] Microsoft.Extensions.Logging.Test.EventSourceLoggerTest.Logs_AsExpected_WithDefaults_EnabledEarly
Assert.Collection() Failure
Collection: ["{\"__EVENT_NAME\":\"FormattedMessage\",\"Level\":1"..., "{\"__EVENT_NAME\":\"Message\",\"Level\":1,\"Factor"..., "{\"__EVENT_NAME\":\"MessageJson\",\"Level\":1,\"Fa"..., "{\"__EVENT_NAME\":\"FormattedMessage\",\"Level\":2"..., "{\"__EVENT_NAME\":\"Message\",\"Level\":2,\"Factor"..., ...]
Error during comparison of item at index 11
Inner exception: Event data '{"__EVENT_NAME":"Message","Level":5,"FactoryID":17,"LoggerName":"Logger2","EventId":5,"EventName":"","Exception":null,"Arguments":[{"Key":"stringParam","Value":"bar"},{"Key":"int1Param","Value":"23"},{"Key":"int2Param","Value":"45"},{"Key":"{OriginalFormat}","Value":"Logger2 Event5 Critical {stringParam} {int1Param} {int2Param}"}]}' does not contain expected fragment "Exception":{"TypeName":"System.Exception","Message":"oops","HResult":-2146233088,"VerboseMessage":"System.Exception: oops\r\n ---> System.Exception: inner oops
        Expected: True
        Actual:   False
   at Microsoft.Extensions.Logging.Test.EventSourceLoggerTest.VerifySingleEvent(String, String, String, Nullable`1, String, Nullable`1, String[]) + 0xc1b
   at Microsoft.Extensions.Logging.Test.EventSourceLoggerTest.<>c.<.cctor>b__35_14(String) + 0xc6
   at Microsoft.Extensions.Logging.Test.EventSourceLoggerTest.Logs_AsExpected_WithDefaults_EnabledEarly() + 0x263
   at Microsoft.Extensions.Logging.EventSource.Tests!<BaseAddress>+0xb3376c
   at System.Reflection.DynamicInvokeInfo.Invoke(Object, IntPtr, Object[], BinderBundle, Boolean) + 0xf1
Finished Microsoft.Extensions.Logging.EventSource.Tests, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60

Activity

  1. added this to the 8.0.0 milestone on Aug 5, 2022
  2. modified the milestones: 8.0.0, 9.0.0 on Aug 10, 2023
  3. modified the milestones: 9.0.0, Future on May 21, 2024
  4. added
    in-pr
    on May 19, 2026
  5. added a commit that references this issue on May 20, 2026
    7a81724
  6. locked and limited conversation to collaborators on Jun 20, 2026
  7. added a commit that references this issue on Jul 15, 2026
    297b3c2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-NativeAOT-coreclrin-pr

    Type

    No type

    Projects

    • Status
      No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions