Uh oh!
There was an error while loading. Please reload this page.
[release/5.0-rc2] Fixes to nullable reference type annotations - #41845
Conversation
ghost
commented
Sep 5, 2020
Tagging subscribers to this area: @safern, @ViktorHofer |
buyaa-n
commented
Sep 8, 2020
2 more APIs missing from
|
|
jeffhandley
commented
Sep 8, 2020
I've added them to the list. I think we need to backport the latest commits from #41731 for those to show up in the diff here; I'll go trigger that now. Thanks. |
fe20d32 to
6a8f8a7Comparebuyaa-n
commented
Sep 8, 2020
For diffs in |
6a8f8a7 to
5a31aa8Compare5a31aa8 to
7a45036Comparebuyaa-n
commented
Sep 10, 2020
Failure unrelated, merging |
Backport of #41731 to release/5.0-rc2. This addresses #41696 and corrects discrepancies in nullable reference type annotations.
During .NET 5.0, we increased our nullable annotations from 31% of
netcoreappto 94%. After completing the last batch of annotations (#41348 included in RC1), we noticed some differences between the implementation and reference assemblies, and we also found a couple places where we had failed to set the project-wide<Nullable>enable</Nullable>for projects that gained annotations during 5.0.Customer Impact
Per our documentation for nullable annotations:
With these fixes going into 5.0 RC2, we are introducing the possibility of new warnings for consumers of these APIs who have nullable warnings enabled themselves. If this PR is approved, we will document the changes in annotations as a breaking change in RC2.
Affected Reference Assembly APIs
System.ComponentModel.Annotations(Annotated in 5.0 RC1)CompareAttribute.IsValidDisplayAttribute.GetDescriptionFilterUIHintAttribute(constructor)FilterUIHintAttribute.ControlParametersValidationAttribute.IsValidValidationContext(constructor)System.Data.OleDb(Annotated in 5.0 Preview 7)OleDbCommand.CommandTextSystem.Data.Common(Annotated in 5.0 Preview 7)DataSet.WriteXmlSchemaDataTable.GetSchemaDataTableCollection.IndexOfDataTableReader.GetSchemaTableDataView.SortDataView.TableUniqueConstraint(constructor)DataColumnMapping.GetDataColumnBySchemaActionSqlAlreadyFilledException(constructor)System.Diagnostics.DiagnosticSource(Annotated in 5.0 Preview 1)Activity.TagObjectsActivity.AddTagActivity.SetTagActivityTagsCollection(constructor)ActivityTagsCollection.ValuesActivityTagsCollection.AddActivityTagsCollection.ContainsActivityTagsCollection.CopyToActivityTagsCollection.RemoveActivityTagsCollection.TryGetValueActivityTagsCollection.EnumeratorActivityEvent.TagsActivityLink.TagsActivityCreationOptions.TagsActivityCreationOptions.LinksSystem.IO.Packaging(Annotated in 5.0 Preview 7)<Nullable>enable</Nullable>to the reference assembly projectPackUriHelper.ComparePackUriPackUriHelper.CreatePackUriHelper.GetPartUriSystem.IO.Pipelines(Annotated in 5.0 Preview 1)PipeReader.OnWriterCompletedPipeWriter.OnReaderCompletedSystem.Net.Mail(Annotated in 5.0 Preview 3)Attachment.CreateAttachmentFromStringMailAddress.TryCreateSystem.Net.Ping(Annotated in 5.0 Preview 1)PingCompletedEventArgs.ReplySystem.Net.Primitives(Annotated in 5.0 Preview 2)IPEndPoint.TryParseSystem.Net.Sockets(Annotated in 5.0 Preview 2)UdpClient.EndReceiveSystem.Net.WebSockets(Annotated in 5.0 Preview 1)WebSocket.CreteClientWebSocketSystem.Reflection.TypeExtensions(Annotated in 5.0 Preview 1)MemberInfoExtensions.GetBaseDefinitionSystem.Resources.Extensions(Annotated in 5.0 Preview 7)<Nullable>enable</Nullable>to the reference assembly projectSystem.Runtime.InteropServices(Annotated in .NET Core 3.0)Marshal.GetTypeFromCLSIDComInterfaceDispatch.CreateObjectSystem.RuntimeHalf.Parse(introduced in 5.0 Preview 7)Half.TryParse(introduced in 5.0 Preview 7)System.Security.Claims(Annotated in 5.0 Preview 1)Claim.PropertiesSystem.Security.Cryptography.Csp(Annotated in 5.0 Preview 1)RNGCryptoServiceProvider(constructor)System.Security.Cryptography.Pkcs(Annotated in 5.0 Preview 2)CmsRecipient.RSAEncryptionPaddingCmsSigner(constructor)CmsSigner.PrivateKeyEnvelopedCms.DecryptPkcs12Builder.AddSafeContentsEncryptedPkcs12Builder.SealWithMacPkcs12Info.VerifyMacPkcs12SafeContents.AddShroudedKeyPkcs12SafeContents.DecryptPkcs12SafeContentsBag.SafeContentsRfc3161TimestampRequest.RequestedPolicyIdRfc3161TimestampRequest.CreateFromDataRfc3161TimestampRequest.CreateFromHashRfc3161TimestampRequest.CreateFromSignerInfoRfc3161TimestampRequest.TryDecodeRfc3161TimestampToken.TryDecodeRfc3161TimestampToken.VerifySignatureForDataRfc3161TimestampToken.VerifySignatureForHashRfc3161TimestampToken.VerifySignatureForSignerInfoRfc3161TimestampTokenInfo(constructor)Rfc3161TimestampTokenInfo.TryDecodeSystem.Text,Json(Annotated in 5.0 Preview 1)JsonException(constructor)JsonConverterFactory.CreateConverterSystem.Text.RegularExpressions(Annotated in 5.0 Preview 1)Regex.CompileToAssemblyNote that there were 2 APIs corrected that were annotated in .NET Core 3.0, which means these would be breaking changes introduced in .NET 5.0.
System.Runtime.InteropServicesMarshal.GetTypeFromCLSIDComInterfaceDispatch.CreateObjectTesting
@terrajobst implemented a utility to compare the nullable annotations between the implementation and reference assemblies; we've run that utility and reviewed all of the mismatches that were found. We expanded the list of reviewers to make sure several folks were reviewing the changes to be made; there was a team effort around making and verifying these fixes.
From this effort, the summary of the discrepancies is:
System.IO.Packaging(Annotated in 5.0 Preview 7)<Nullable>enable</Nullable>on the reference assembly in 518df4fSystem.Resources.Extensions(Annotated in 5.0 Preview 7)<Nullable>enable</Nullable>on reference assembly and implementation assembly had<Nullable>annotations</Nullable>in in Annotate System.Resources.Extensions for nullable reference types #37597System.Security.Cryptography.Pkcs(Annotated in 5.0 Preview 2).netcoreapp.csspecific file in the reference assembly, which was not noticed during core reviewDuring this process of identifying, addressing, and verifying these discrepancies, the crew agreed that a Roslyn-based APICompat implementation could help reduce these types of issues in the future.
Risk
Medium. The changed annotations are technically breaking changes in RC2. While we are not annotating any new areas, we are correcting existing annotations and marking System.IO.Packaging and System.Resources.Extensions with
<Nullable>enable</Nullable>, which was previously missed. We will document the changes in an RC2 breaking change document after this is merged.If any internal teams are affected by this, they should contact @jeffhandley for support. We will assist teams as needed.