Skip to content

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

@MichalStrehovsky

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-NativeAOT-coreclrin-prThere is an active PR which will close this issue when it is merged

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions