Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MethodsAreImplementedConsistentlyWithTheirAttributes does not test applicaiton name correctly and fails on .netcoreapp2.0 #1128

Closed
lmolkova opened this issue May 2, 2019 · 1 comment

Comments

@lmolkova
Copy link
Member

lmolkova commented May 2, 2019

https://dev.azure.com/mseng/AppInsights/_build/results?buildId=9392652&view=logs&j=fd490c07-0b22-5182-fac9-6d67fe1e939b

Starting test execution, please wait...
Failed   MethodsAreImplementedConsistentlyWithTheirAttributes
Error Message:
 Test method Microsoft.ApplicationInsights.Extensibility.Implementation.Tracing.CoreEventSourceTest.MethodsAreImplementedConsistentlyWithTheirAttributes threw exception: 
System.Exception: OperationIsNullWarning is implemented incorrectly: Application Name. expected: '', actual: 'testhost' ---> System.Exception: Application Name. expected: '', actual: 'testhost'
Stack Trace:
    at Microsoft.ApplicationInsights.TestFramework.EventSourceTest.AssertEqual[T](T expected, T actual, String message) in E:\A\_work\538\s\Test\TestFramework\Shared\EventSourceTest.cs:line 115
   at Microsoft.ApplicationInsights.TestFramework.EventSourceTest.VerifyMethodImplementation(EventSource eventSource, MethodInfo eventMethod) in E:\A\_work\538\s\Test\TestFramework\Shared\EventSourceTest.cs:line 37
--- End of inner exception stack trace ---
    at Microsoft.ApplicationInsights.TestFramework.EventSourceTest.VerifyMethodImplementation(EventSource eventSource, MethodInfo eventMethod) in E:\A\_work\538\s\Test\TestFramework\Shared\EventSourceTest.cs:line 41
   at Microsoft.ApplicationInsights.TestFramework.EventSourceTest.MethodsAreImplementedConsistentlyWithTheirAttributes(EventSource eventSource) in E:\A\_work\538\s\Test\TestFramework\Shared\EventSourceTest.cs:line 16

This happens because tests set expectedApplicationName to empty string for all .net core.

#if !NETCOREAPP
            string expectedApplicationName = AppDomain.CurrentDomain.FriendlyName;
#else
            string expectedApplicationName = "";
#endif
            string actualApplicationName = actualEvent.Payload.Last().ToString();
            AssertEqual(expectedApplicationName, actualApplicationName, "Application Name");

the obvious fix to use AppDomain.CurrentDomain.FriendlyName on netcoreapp2.0., but it leads to another failure


Failed   MethodsAreImplementedConsistentlyWithTheirAttributes
Error Message:
 Test method Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.Implementation.WebEventSourceTest.MethodsAreImplementedConsistentlyWithTheirAttributes threw exception: 
System.Exception: BackoffDisabled is implemented incorrectly: Application Name. expected: 'testhost', actual: '' ---> System.Exception: Application Name. expected: 'testhost', actual: ''
Stack Trace:
    at Microsoft.ApplicationInsights.TestFramework.EventSourceTest.AssertEqual[T](T expected, T actual, String message) in E:\A\_work\228\s\Test\TestFramework\Shared\EventSourceTest.cs:line 115
   at Microsoft.ApplicationInsights.TestFramework.EventSourceTest.VerifyMethodImplementation(EventSource eventSource, MethodInfo eventMethod) in E:\A\_work\228\s\Test\TestFramework\Shared\EventSourceTest.cs:line 37
--- End of inner exception stack trace ---
    at Microsoft.ApplicationInsights.TestFramework.EventSourceTest.VerifyMethodImplementation(EventSource eventSource, MethodInfo eventMethod) in E:\A\_work\228\s\Test\TestFramework\Shared\EventSourceTest.cs:line 41
   at Microsoft.ApplicationInsights.TestFramework.EventSourceTest.MethodsAreImplementedConsistentlyWithTheirAttributes(EventSource eventSource) in E:\A\_work\228\s\Test\TestFramework\Shared\EventSourceTest.cs:line 16

which seems to be caused by some race-condition, or some other unexpected behavior that is fixed with something like 0a2c4e0#diff-38c3bb17d4df474170d2d57acf211a18R13 but the root cause is unknown.

This issue does not reproduce locally - only on the build machine

@lmolkova lmolkova changed the title MethodsAreImplementedConsistentlyWithTheirAttributes failing on .netcoreapp2.0 MethodsAreImplementedConsistentlyWithTheirAttributes does not test applicaiton name correctly and fails on .netcoreapp2.0 May 2, 2019
@lmolkova
Copy link
Member Author

lmolkova commented May 6, 2019

does not repro anymore after #1125

@lmolkova lmolkova closed this as completed May 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant