-
Notifications
You must be signed in to change notification settings - Fork 857
Consolidate NullableAttributes across OpenTelemetry and OpenTelemetry.Api #4293
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
Closed
TimothyMothra
wants to merge
13
commits into
open-telemetry:main
from
TimothyMothra:nullableattributes
Closed
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
09b0b44
move attributes to new file
4e54fca
Merge branch 'main' into nullableattributes
c186989
add netst2.1 to Api project. remove Nullable class from OTel project.
2128867
Merge branch 'main' into nullableattributes
cc2182e
move NullableAttributes to OpenTelemetry project
11ab58c
Revert "move NullableAttributes to OpenTelemetry project"
2e6f0c4
Merge branch 'main' into nullableattributes
f750ded
cleanup
e5099dc
cleanup
5e441e8
cleanup
bdbb5f5
Merge branch 'main' into nullableattributes
b19ab99
Merge branch 'main' into nullableattributes
c6534a7
Merge branch 'main' into nullableattributes
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| // <copyright file="NullableAttributes.cs" company="OpenTelemetry Authors"> | ||
| // Copyright The OpenTelemetry Authors | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
| // </copyright> | ||
|
|
||
| // The following code was borrowed from https://github.com/dotnet/runtime/blob/main/src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis/NullableAttributes.cs | ||
| // These classes are available in .NET versions after NetStandard2.0 | ||
| // For more information see: https://learn.microsoft.com/dotnet/csharp/language-reference/attributes/nullable-analysis | ||
|
|
||
| #nullable enable | ||
|
|
||
| #pragma warning disable SA1402 // File may only contain a single type | ||
| #pragma warning disable SA1649 // File name should match first type name | ||
|
|
||
| #if !NETCOREAPP3_0_OR_GREATER && !NETSTANDARD2_1_OR_GREATER | ||
| namespace System.Diagnostics.CodeAnalysis | ||
| { | ||
| /// <summary>Specifies that an output is not <see langword="null"/> even if | ||
| /// the corresponding type allows it. Specifies that an input argument was | ||
| /// not <see langword="null"/> when the call returns.</summary> | ||
| [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] | ||
| internal sealed class NotNullAttribute : Attribute | ||
| { | ||
| } | ||
| } | ||
| #endif | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
Please check https://github.com/open-telemetry/opentelemetry-dotnet/blob/9395b9e944cdae19a9823c0bc3dacb257c9c4863/src/OpenTelemetry/Internal/Shims/NullableAttributes.cs
I think that content from this file should be merged with existing one.
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.
These should absolutely be merged!
I didn't know this file was here! This is probably what was causing conflicts in my nullable branch. Thanks for pointing this out! :)
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've run into an issue merging these two files and I'm still exploring options before I make a recommendation.
Both
OpenTelemetryandOpenTelemetry.Apiprojects need access to nullables.OTel has a build dependency on OTel.Api.
OTel.Api makes internals visible to OTel.
The blocker is that OTel targets☹️ ☹️ ☹️
net6.0;netstandard2.1;netstandard2.0;net462where as OTel.Api targetsnetstandard2.0;net462.OTel (net6 and netstardard2.1) will take a dependency on OTel.Api (netstandard2.0).
And then OTel (net6 and netstardard2.1) has a conflict with runtime.
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 fix is to add netstandard2.1 to the OTel.Api project. I'll bring this up in the SIG meeting tomorrow.
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.
Discussed this in today's SIG and there are no blockers with this approach. :)
It would be preferred if we can move shared files to a separate project, but this only works if we can also remove the internals visible to between OTel and OTel.Api. I'm going to take a day to explore if this would work.