Skip to content

Extensions commit mop-up #34208

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

Merged
merged 7 commits into from
Mar 31, 2020
Merged

Extensions commit mop-up #34208

merged 7 commits into from
Mar 31, 2020

Conversation

maryamariyan
Copy link
Contributor

@maryamariyan maryamariyan commented Mar 27, 2020

@ericstj @JunTaoLuo

  • I applied a git filter-branch on extensions repo considering the proper file/folder paths expected in runtime repo.
  • merged commits locally into my local runtime repo.
  • Then cherry picked the new commits on this runtime repo branch.

UPDATE:

  • This PR also does test projects' cleanups and sets up Logging.EventSource tests: 8f9d98e

dougbu and others added 6 commits March 27, 2020 12:37
- add debug information for `Assert` failures in `MaximumOSVersionTest`
- update src/TestingUtils/Microsoft.AspNetCore.Testing/test/MaximumOSVersionTest.cs
  - co-Authored-By: @Tratcher 
- try with VS2019 queues
- skip `MaximumOSVersion` tests on .NET due to xunit issue
  - co-authored-by: @Tratcher 


Commit migrated from dotnet/extensions@26ff835
* Remove Serilog dependency in extensions

* Add xunit logging for shutdown tests

* Need to remove dependency on AspNetCore.Testing and remove DumpCollector

Commit migrated from dotnet/extensions@540b4e8
…x-logging-event-source

Fix LoggingEventSource to handle null strings


Commit migrated from dotnet/extensions@8d0fa05
…dotnet/extensions#2940)

* Add environment var to allow disabling live reload in default builder

* Switch to using hostingContext, rename flag to fit nomenclature.

* Change flag to memory data source. Change content root default instead of runtime default.

* Update config key to be hierarchical. Change await on positive case to be longer and cancel using the reload token.

* Uncomment a development test case.

* Apply suggestions from code review

Co-authored-by: Chris Ross <Tratcher@Outlook.com>


Commit migrated from dotnet/extensions@64140f9
@maryamariyan
Copy link
Contributor Author

maryamariyan commented Mar 27, 2020

Filed an issue for the net472 failure here: #34216

##[error]src\libraries\Common\tests\Extensions\TestingUtils\Microsoft.AspNetCore.Testing\src\xunit\FrameworkSkipConditionAttribute.cs(53,8): error CS1029: #error: 'Target frameworks need to be updated.'
 

https://dev.azure.com/dnceng/public/_build/results?buildId=576706

PR: #34218

@ericstj
Copy link
Member

ericstj commented Mar 30, 2020

Failure is due to number formatting issue in test:

-273.15 37
-273,15 37

@JunTaoLuo
Copy link
Contributor

Yea somehow it's using the European format for the decimal. Hmm

@JunTaoLuo
Copy link
Contributor

So the issue here is that the machines are setup with a non-US local so the format here: https://github.com/dotnet/runtime/blob/master/src/libraries/Microsoft.Extensions.Logging.EventSource/tests/EventSourceLoggerTest.cs#L723 uses a comma instead of a decimal point. I would check what format EventSource uses for doubles and use the same format in the test code. My assumption would be that they are using CultureInfo.InvariantCulture but I'm not sure.

@maryamariyan
Copy link
Contributor Author

maryamariyan commented Mar 30, 2020

yes, the spanish locale is setup on the machines.

I get a repro on the test failures locally by changing the locale like below:

Assert.True(CultureInfo.CurrentCulture.Name.Equals("en-US", StringComparison.OrdinalIgnoreCase));
CultureInfo.CurrentCulture = new CultureInfo("es-ES");
Assert.True(CultureInfo.CurrentCulture.Name.Equals("es-ES", StringComparison.OrdinalIgnoreCase));
...

@ericstj
Copy link
Member

ericstj commented Mar 31, 2020

InvariantCulture seems to be the right choice. I believe this is the code that is doing the formatting:

return string.Format(CultureInfo.InvariantCulture, _format, values ?? EmptyArray);
}
internal string Format()
{
return _format;
}
internal string Format(object arg0)
{
return string.Format(CultureInfo.InvariantCulture, _format, FormatArgument(arg0));
}
internal string Format(object arg0, object arg1)
{
return string.Format(CultureInfo.InvariantCulture, _format, FormatArgument(arg0), FormatArgument(arg1));
}
internal string Format(object arg0, object arg1, object arg2)
{
return string.Format(CultureInfo.InvariantCulture, _format, FormatArgument(arg0), FormatArgument(arg1), FormatArgument(arg2));

@@ -720,7 +810,7 @@ private static class EventTypes
{ "E6MSG", (e) => VerifySingleEvent(e, "Logger2", EventTypes.Message, 6, null, LogLevel.Warning) },

{ "E7FM", (e) => VerifySingleEvent(e, "Logger3", EventTypes.FormattedMessage, 7, null, LogLevel.Information,
@"""FormattedMessage"":""Logger3 Event7 Information inner scope closed " + DoubleParam2.ToString() + " 37") },
@"""FormattedMessage"":""Logger3 Event7 Information inner scope closed " + DoubleParam2.ToString("G", CultureInfo.InvariantCulture) + " 37") },
{ "E7JS", (e) => VerifySingleEvent(e, "Logger3", EventTypes.MessageJson, 7, null, LogLevel.Information,
@"""ArgumentsJson"":{""stringParam"":""inner scope closed"",""doubleParam"":""" + DoubleParam2.ToString() + @""",""intParam"":""37""") },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I see another double ToString() here. Should that be fixed here as well? If it's not causing failures it might be because it's not used, in which case why is it present?

Copy link
Contributor Author

@maryamariyan maryamariyan Mar 31, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed them as well. but seems only this change should be sufficient

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’d fix them all for correctness. It’s not like we have a reason for using current culture

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do that in a future PR.

@@ -245,6 +244,9 @@
<!-- Always pass portable to override arcade sdk which uses embedded for local builds -->
<DebugType>portable</DebugType>

<!-- Microsoft.Extensions projects have a separate StrongNameKeyId -->
<StrongNameKeyId Condition="$(MSBuildProjectName.StartsWith('Microsoft.Extensions.'))">MicrosoftAspNetCore</StrongNameKeyId>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why here and not at line 154?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, so line 154 does nothing. 🤦‍♂ We should file a bug on that. I wonder if that caused other projects to get a different public key.

Copy link
Contributor Author

@maryamariyan maryamariyan Mar 31, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think other projects have a problem, because other projects have each their own Directory.Build.props next to their solution files which specifies the StrongNameKeyId. e.g.:

Copy link
Member

@ericstj ericstj Mar 31, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the intent of that line was to make the default for corefx (at the time) to be the Open key. If it’s not having any effect that means we may have some projects which relied on it but no longer get it. IOW they didn’t set Open key in their d.b.p. As it stands it does nothing and should be deleted.

- Updates InternalsVisibleTo files as well

- Setup Logging.EventSource.Tests
- Fix three failing EventSourceLoggerTest tests
- Delete file: IntegrationTesting csproj not needed.
- Rename folder test -> tests (Logging/tests/DI.Common/tests)
- Cleanup other csproj

    fix compile issue
@maryamariyan
Copy link
Contributor Author

squashed last three commits into one and keeping rest as they were mop up commits

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants