-
Notifications
You must be signed in to change notification settings - Fork 777
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
Enable .net6.0 build and add net6.0 target #2559
Enable .net6.0 build and add net6.0 target #2559
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2559 +/- ##
=======================================
Coverage 80.84% 80.84%
=======================================
Files 254 254
Lines 8552 8552
=======================================
Hits 6914 6914
Misses 1638 1638
|
(no need to make the change in this PR) It seems most of the test projects are using the same target frameworks
|
@@ -26,6 +26,19 @@ jobs: | |||
with: | |||
fetch-depth: 0 # fetching all | |||
|
|||
- uses: actions/setup-dotnet@v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't need to install 3.1.x/5.0.x because they are already installed in windows-latest. I always check this:
- https://github.com/actions/virtual-environments
- https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md
Remember that windows-latest
can change in the future to windows-2022, so, always have that in mind.
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions/setup-dotnet@v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comment as above, no need for 3.1.x or 5.0.x
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions/setup-dotnet@v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here as well :)
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions/setup-dotnet@v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here as well
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions/setup-dotnet@v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here.
you can check this:
https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions/setup-dotnet@v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions/setup-dotnet@v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
using Microsoft.AspNetCore.Mvc; | ||
using OpenTelemetry; | ||
|
||
namespace TestApp.AspNetCore._6._0.Controllers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one day, we have to figure out how to prevent this code over and over.
we already have the "same" code for 3.1, 5.0, 6.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes - I was thinking the same. will look in to creating a separate PR for this. |
@@ -1,6 +1,6 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0</TargetFrameworks> | |||
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0</TargetFrameworks> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, why was this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we are using FrameworkReference, this is needed.
IIRC, if we do not add this, net5.0 targeted instrumentation library will be used for net6.0 app (should still work as we don't have any NET6 framework specific code).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it is needed until we want to use some piece of the .NET 6 API.
If the project is like this...
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0</TargetFrameworks>
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
Users on .NET 6 will still be able to use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed - then do we remove 5.0 as well?. I have not tested but I think having only 3.1 will also work for 3.1+ apps then?.
But if we ever use version specific code, we will have to do add it again.
@cijothomas - thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't use any .NET 6 specific feature today, but Asp.Net core 6.0 has introduced ActivitySource usage. If we want to leverage them, we either need .net6.0 target. or we use reflection to find if user is running Asp.Net Core 6.0 or newer.
(@vishweshbankwar please create a separate issue to discuss this further)
@@ -52,7 +52,7 @@ public class AspNetCoreInstrumentationOptions | |||
/// </remarks> | |||
public bool RecordException { get; set; } | |||
|
|||
#if NETSTANDARD2_1 || NETCOREAPP3_1 || NET5_0 | |||
#if NETSTANDARD2_1 || NETCOREAPP3_1 || NET5_0_OR_GREATER |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be only:
#if NETSTANDARD2_1 || NETCOREAPP3_1_OR_GREATER
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason why we probably used #if NETSTANDARD2_1 || NETCOREAPP3_1 || NET5_0
in the first place
https://docs.microsoft.com/en-us/dotnet/core/compatibility/sdk/5.0/netcoreapp3_1-preprocessor-symbol-not-defined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That affects .net 5 SDK, right? So now on NET6 it should work if I undersand?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it looks like it from the .NET 5 and later bullet here
Fixes #.
2064
Changes
Please provide a brief description of the changes here.
todos
For significant contributions please make sure you have completed the following items:
CHANGELOG.md
updated for non-trivial changes