From dc4715163f907534734adf9b807c55c201451d67 Mon Sep 17 00:00:00 2001 From: Jeremy Barton Date: Wed, 26 Aug 2020 09:27:01 -0700 Subject: [PATCH] Add netcoreapp build of System.Formats.Asn1 This avoids the library causing a cyclic dependency in generating netstandard.dll. The netcoreapp version is not included in the NuGet package, following the pattern of * System.Text.Json * System.Collections.Immutable * System.Reflection.Metadata --- .../src/System.Formats.Asn1.csproj | 27 ++++++++++++++++++---- .../src/System/Formats/Asn1/AsnWriter.cs | 4 +++- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/libraries/System.Formats.Asn1/src/System.Formats.Asn1.csproj b/src/libraries/System.Formats.Asn1/src/System.Formats.Asn1.csproj index f9fdc8c..999a3c5 100644 --- a/src/libraries/System.Formats.Asn1/src/System.Formats.Asn1.csproj +++ b/src/libraries/System.Formats.Asn1/src/System.Formats.Asn1.csproj @@ -2,7 +2,8 @@ true enable - netstandard2.0;net461 + $(NetCoreAppCurrent);netstandard2.0;net461 + true @@ -46,10 +47,26 @@ - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/src/libraries/System.Formats.Asn1/src/System/Formats/Asn1/AsnWriter.cs b/src/libraries/System.Formats.Asn1/src/System/Formats/Asn1/AsnWriter.cs index fbdb8e7..c5e10fd 100644 --- a/src/libraries/System.Formats.Asn1/src/System/Formats/Asn1/AsnWriter.cs +++ b/src/libraries/System.Formats.Asn1/src/System/Formats/Asn1/AsnWriter.cs @@ -730,7 +730,9 @@ namespace System.Formats.Asn1 public void Dispose() { - if (_writer == null || _writer._nestingStack.Count == 0) + Debug.Assert(_writer == null || _writer._nestingStack != null); + + if (_writer == null || _writer._nestingStack!.Count == 0) { return; } -- 2.7.4