From fdf6485c800ec580656d7491795e10881d493afb Mon Sep 17 00:00:00 2001 From: Andy Gocke Date: Fri, 21 Jan 2022 22:59:57 -0800 Subject: [PATCH 001/161] Add COMWrappers to crossgen (#63969) --- .../ILCompiler.Diagnostics.csproj | 1 + .../ILCompilerComWrappers.cs | 32 ++++ .../ILCompiler.Diagnostics/ISymNGenWriter.cs | 75 ++++++++- .../aot/ILCompiler.Diagnostics/PdbWriter.cs | 37 ++--- .../SymNgenWriterWrapper.cs | 149 ++++++++++++++++++ 5 files changed, 268 insertions(+), 26 deletions(-) create mode 100644 src/coreclr/tools/aot/ILCompiler.Diagnostics/ILCompilerComWrappers.cs create mode 100644 src/coreclr/tools/aot/ILCompiler.Diagnostics/SymNgenWriterWrapper.cs diff --git a/src/coreclr/tools/aot/ILCompiler.Diagnostics/ILCompiler.Diagnostics.csproj b/src/coreclr/tools/aot/ILCompiler.Diagnostics/ILCompiler.Diagnostics.csproj index 97c97bb7de720d..0d1b23ad73b3c8 100644 --- a/src/coreclr/tools/aot/ILCompiler.Diagnostics/ILCompiler.Diagnostics.csproj +++ b/src/coreclr/tools/aot/ILCompiler.Diagnostics/ILCompiler.Diagnostics.csproj @@ -15,6 +15,7 @@ binaries are up to date and which are stale. --> false Debug;Release;Checked + true diff --git a/src/coreclr/tools/aot/ILCompiler.Diagnostics/ILCompilerComWrappers.cs b/src/coreclr/tools/aot/ILCompiler.Diagnostics/ILCompilerComWrappers.cs new file mode 100644 index 00000000000000..d9972da41f76c6 --- /dev/null +++ b/src/coreclr/tools/aot/ILCompiler.Diagnostics/ILCompilerComWrappers.cs @@ -0,0 +1,32 @@ + +using System; +using System.Collections; +using System.Diagnostics; +using System.Runtime.InteropServices; + +namespace Microsoft.DiaSymReader +{ + internal unsafe sealed class ILCompilerComWrappers : ComWrappers + { + protected override unsafe ComInterfaceEntry* ComputeVtables(object obj, CreateComInterfaceFlags flags, out int count) + { + // passing the managed object to COM is not currently supported + throw new NotImplementedException(); + } + + protected override object CreateObject(IntPtr externalComObject, CreateObjectFlags flags) + { + // Assert use of the UniqueInstance flag since the returned Native Object Wrapper always + // supports IDisposable and its Dispose will always release and suppress finalization. + // If the wrapper doesn't always support IDisposable the assert can be relaxed. + Debug.Assert(flags.HasFlag(CreateObjectFlags.UniqueInstance)); + + // Throw an exception if the type is not supported by the implementation. + // Null can be returned as well, but an ArgumentNullException will be thrown for + // the consumer of this ComWrappers instance. + return SymNgenWriterWrapper.CreateIfSupported(externalComObject) ?? throw new NotSupportedException(); + } + + protected override void ReleaseObjects(IEnumerable objects) => throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/src/coreclr/tools/aot/ILCompiler.Diagnostics/ISymNGenWriter.cs b/src/coreclr/tools/aot/ILCompiler.Diagnostics/ISymNGenWriter.cs index 4c4b6b97d60a91..40702fd187a75a 100644 --- a/src/coreclr/tools/aot/ILCompiler.Diagnostics/ISymNGenWriter.cs +++ b/src/coreclr/tools/aot/ILCompiler.Diagnostics/ISymNGenWriter.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#pragma warning disable 436 // SuppressUnmanagedCodeSecurityAttribute defined in source and mscorlib +#pragma warning disable 436 // SuppressUnmanagedCodeSecurityAttribute defined in source and mscorlib using System; using System.Collections.Generic; @@ -11,9 +11,39 @@ namespace Microsoft.DiaSymReader { - [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("D682FD12-43dE-411C-811B-BE8404CEA126"), SuppressUnmanagedCodeSecurity] + /// + /// IUnknown COM type for writing NGen PDBs + /// + /// + /// + /// [ + /// object, + /// uuid(d682fd12-43de-411c-811b-be8404cea126), + /// pointer_default(unique) + /// ] + /// interface ISymNGenWriter : IUnknown + /// { + /// /* + /// * Add a new public symbol to the NGEN PDB. + /// */ + /// HRESULT AddSymbol([in] BSTR pSymbol, + /// [in] USHORT iSection, + /// [in] ULONGLONG rva); + /// + /// /* + /// * Adds a new section to the NGEN PDB. + /// */ + /// HRESULT AddSection([in] USHORT iSection, + /// [in] USHORT flags, + /// [in] long offset, + /// [in] long cb); + /// }; + /// + /// internal interface ISymNGenWriter { + public static readonly Guid IID = new Guid("D682FD12-43dE-411C-811B-BE8404CEA126"); + // Add a new public symbol to the NGEN PDB. void AddSymbol([MarshalAs(UnmanagedType.BStr)] string pSymbol, ushort iSection, @@ -46,9 +76,46 @@ internal enum OMF : ushort } - [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("B029E51B-4C55-4fe2-B993-9F7BC1F10DB4"), SuppressUnmanagedCodeSecurity] + /// + /// IUnknown COM type for writing NGen PDBs + /// + /// + /// + /// [ + /// object, + /// local, + /// uuid(B029E51B-4C55-4fe2-B993-9F7BC1F10DB4), + /// pointer_default(unique) + /// ] + /// interface ISymNGenWriter2 : ISymNGenWriter + /// { + /// HRESULT OpenModW([in] const wchar_t* wszModule, + /// [in] const wchar_t* wszObjFile, + /// [out] BYTE** ppmod); + /// + /// HRESULT CloseMod([in] BYTE* pmod); + /// + /// HRESULT ModAddSymbols([in] BYTE* pmod, [in] BYTE* pbSym, [in] long cb); + /// + /// HRESULT ModAddSecContribEx( + /// [in] BYTE* pmod, + /// [in] USHORT isect, + /// [in] long off, + /// [in] long cb, + /// [in] ULONG dwCharacteristics, + /// [in] DWORD dwDataCrc, + /// [in] DWORD dwRelocCrc); + /// + /// HRESULT QueryPDBNameExW( + /// [out, size_is(cchMax)] wchar_t wszPDB[], + /// [in] SIZE_T cchMax); + /// }; + /// + /// internal interface ISymNGenWriter2 : ISymNGenWriter { + public readonly static new Guid IID = new Guid("B029E51B-4C55-4fe2-B993-9F7BC1F10DB4"); + // Add a new public symbol to the NGEN PDB. new void AddSymbol([MarshalAs(UnmanagedType.BStr)] string pSymbol, ushort iSection, @@ -78,7 +145,7 @@ void ModAddSecContribEx( uint dwRelocCrc); void QueryPDBNameExW( - [MarshalAs(UnmanagedType.LPWStr)] StringBuilder pdb, + [MarshalAs(UnmanagedType.LPWStr)] char[] pdb, IntPtr cchMax); } } diff --git a/src/coreclr/tools/aot/ILCompiler.Diagnostics/PdbWriter.cs b/src/coreclr/tools/aot/ILCompiler.Diagnostics/PdbWriter.cs index a16d5bf19a8e67..be0d8af909f727 100644 --- a/src/coreclr/tools/aot/ILCompiler.Diagnostics/PdbWriter.cs +++ b/src/coreclr/tools/aot/ILCompiler.Diagnostics/PdbWriter.cs @@ -89,7 +89,7 @@ public class PdbWriter Dictionary _documentToChecksumOffsetMapping; UIntPtr _pdbMod; - ISymNGenWriter2 _ngenWriter; + SymNgenWriterWrapper _ngenWriter; static PdbWriter() { @@ -116,7 +116,7 @@ private static IntPtr DllImportResolver(string libraryName, Assembly assembly, D private extern static void CreateNGenPdbWriter( [MarshalAs(UnmanagedType.LPWStr)] string ngenImagePath, [MarshalAs(UnmanagedType.LPWStr)] string pdbPath, - [MarshalAs(UnmanagedType.Interface)] out ISymNGenWriter2 ngenPdbWriter); + out IntPtr ngenPdbWriterPtr); public PdbWriter(string pdbPath, PDBExtraData pdbExtraData, TargetDetails target) { @@ -138,23 +138,14 @@ public void WritePDBData(string dllPath, IEnumerable methods) { try { - try - { - WritePDBDataHelper(dllPath, methods); - } - finally - { - if ((_ngenWriter != null) && (_pdbMod != UIntPtr.Zero)) - { - _ngenWriter.CloseMod(_pdbMod); - } - } + WritePDBDataHelper(dllPath, methods); } finally { - if (_ngenWriter != null) + if ((_ngenWriter != null) && (_pdbMod != UIntPtr.Zero)) { - Marshal.FinalReleaseComObject(_ngenWriter); + _ngenWriter.CloseMod(_pdbMod); + _ngenWriter?.Dispose(); } } @@ -217,14 +208,16 @@ private void WritePDBDataHelper(string dllPath, IEnumerable methods) // Delete any preexisting PDB file upfront, otherwise CreateNGenPdbWriter silently opens it File.Delete(_pdbFilePath); - CreateNGenPdbWriter(dllPath, _pdbFilePath, out _ngenWriter); + var comWrapper = new ILCompilerComWrappers(); + CreateNGenPdbWriter(dllPath, _pdbFilePath, out var pdbWriterInst); + _ngenWriter = (SymNgenWriterWrapper)comWrapper.GetOrCreateObjectForComInstance(pdbWriterInst, CreateObjectFlags.UniqueInstance); { // PDB file is now created. Get its path and update _pdbFilePath so the PDB file // can be deleted if we don't make it successfully to the end. - StringBuilder pdbFilePathBuilder = new StringBuilder(); - pdbFilePathBuilder.Capacity = 1024; - _ngenWriter.QueryPDBNameExW(pdbFilePathBuilder, new IntPtr(pdbFilePathBuilder.Capacity)); + const int capacity = 1024; + var pdbFilePathBuilder = new char[capacity]; + _ngenWriter.QueryPDBNameExW(pdbFilePathBuilder, new IntPtr(capacity - 1) /* remove 1 byte for null */); _pdbFilePath = pdbFilePathBuilder.ToString(); } @@ -428,9 +421,9 @@ private void WriteCompilerVersion() byte iLanguage = (byte)CV_CFL_LANG.CV_CFL_MSIL; writer.Write(iLanguage); // Write rest of flags - writer.Write((byte)0); - writer.Write((byte)0); - writer.Write((byte)0); + writer.Write((byte)0); + writer.Write((byte)0); + writer.Write((byte)0); switch (_target.Architecture) { diff --git a/src/coreclr/tools/aot/ILCompiler.Diagnostics/SymNgenWriterWrapper.cs b/src/coreclr/tools/aot/ILCompiler.Diagnostics/SymNgenWriterWrapper.cs new file mode 100644 index 00000000000000..8a1166f43a39bf --- /dev/null +++ b/src/coreclr/tools/aot/ILCompiler.Diagnostics/SymNgenWriterWrapper.cs @@ -0,0 +1,149 @@ + +using System; +using System.Runtime.InteropServices; +using System.Text; + +#nullable enable + +namespace Microsoft.DiaSymReader +{ + internal class SymNgenWriterWrapper : ISymNGenWriter2, IDisposable + { + private bool _isDisposed = false; + public IntPtr ISymNGenWriter2Inst { get; } + + private SymNgenWriterWrapper(IntPtr writer2Inst) + { + ISymNGenWriter2Inst = writer2Inst; + } + + public static SymNgenWriterWrapper? CreateIfSupported(IntPtr ptr) + { + var iid = ISymNGenWriter2.IID; + int hr = Marshal.QueryInterface(ptr, ref iid, out IntPtr ngenWriterInst); + if (hr != 0) + { + return null; + } + + return new SymNgenWriterWrapper(ngenWriterInst); + } + + ~SymNgenWriterWrapper() + { + DisposeInternal(); + } + + public void Dispose() + { + DisposeInternal(); + GC.SuppressFinalize(this); + } + + private void DisposeInternal() + { + if (_isDisposed) + { + return; + } + Marshal.Release(ISymNGenWriter2Inst); + _isDisposed = true; + } + + public unsafe void AddSymbol(string pSymbol, ushort iSection, ulong rva) + { + IntPtr strLocal = Marshal.StringToBSTR(pSymbol); + var inst = ISymNGenWriter2Inst; + var func = (delegate* unmanaged)(*(*(void***)inst + 3 /* ISymNGenWriter2.AddSymbol slot */)); + int hr = func(inst, strLocal, iSection, rva); + Marshal.FreeBSTR(strLocal); + if (hr != 0) + { + Marshal.ThrowExceptionForHR(hr); + } + } + + public unsafe void AddSection(ushort iSection, OMF flags, int offset, int cb) + { + var inst = ISymNGenWriter2Inst; + var func = (delegate* unmanaged)(*(*(void***)inst + 4)); + int hr = func(inst, iSection, flags, offset, cb); + if (hr != 0) + { + Marshal.ThrowExceptionForHR(hr); + } + } + + public unsafe void OpenModW(string wszModule, string wszObjFile, out UIntPtr ppmod) + { + var inst = ISymNGenWriter2Inst; + fixed (char* wszModulePtr = wszModule) + fixed (char* wszObjFilePtr = wszObjFile) + { + UIntPtr ppmodPtr; + var func = (delegate* unmanaged)(*(*(void***)inst + 5)); + int hr = func(inst, wszModulePtr, wszObjFilePtr, &ppmodPtr); + ppmod = ppmodPtr; + if (hr != 0) + { + Marshal.ThrowExceptionForHR(hr); + } + } + } + + public unsafe void CloseMod(UIntPtr pmod) + { + var inst = ISymNGenWriter2Inst; + var func = (delegate* unmanaged)(*(*(void***)inst + 6)); + int hr = func(inst, pmod); + if (hr != 0) + { + Marshal.ThrowExceptionForHR(hr); + } + } + + public unsafe void ModAddSymbols(UIntPtr pmod, byte[] pbSym, int cb) + { + fixed (byte* pbSymPtr = pbSym) + { + var pbSymLocal = (IntPtr)pbSymPtr; + var inst = ISymNGenWriter2Inst; + var func = (delegate* unmanaged)(*(*(void***)inst + 7)); + int hr = func(inst, pmod, pbSymLocal, cb); + if (hr != 0) + { + Marshal.ThrowExceptionForHR(hr); + } + } + } + + public unsafe void ModAddSecContribEx(UIntPtr pmod, ushort isect, int off, int cb, uint dwCharacteristics, uint dwDataCrc, uint dwRelocCrc) + { + var inst = ISymNGenWriter2Inst; + var func = (delegate* unmanaged)(*(*(void***)inst + 8)); + int hr = func(inst, pmod, isect, off, cb, dwCharacteristics, dwDataCrc, dwRelocCrc); + if (hr != 0) + { + Marshal.ThrowExceptionForHR(hr); + } + } + + public unsafe void QueryPDBNameExW(char[] pdb, IntPtr cchMax) + { + fixed (char* pdbPtr = pdb) + { + var pdbLocal = (IntPtr)pdbPtr; + var inst = ISymNGenWriter2Inst; + var func = (delegate* unmanaged)(*(*(void***)inst + 9)); + int hr = func(inst, pdbPtr, cchMax); + if (hr != 0) + { + Marshal.ThrowExceptionForHR(hr); + } + } + } + + void ISymNGenWriter.AddSymbol(string pSymbol, ushort iSection, ulong rva) => AddSymbol(pSymbol, iSection, rva); + void ISymNGenWriter.AddSection(ushort iSection, OMF flags, int offset, int cb) => AddSection(iSection, flags, offset, cb); + } +} From 068295b281070c1efaa4b11522d7d8ce96244b42 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Sat, 22 Jan 2022 02:10:06 -0500 Subject: [PATCH 002/161] pipelines: Add wasm jobs (#64109) --- eng/pipelines/runtime-extra-platforms.yml | 45 +----- eng/pipelines/runtime-staging.yml | 174 ++++++++++++++++++++++ eng/pipelines/runtime.yml | 45 +++++- src/tests/issues.targets | 3 + 4 files changed, 222 insertions(+), 45 deletions(-) diff --git a/eng/pipelines/runtime-extra-platforms.yml b/eng/pipelines/runtime-extra-platforms.yml index d9121f4b8027a0..a0642f4ab521c7 100644 --- a/eng/pipelines/runtime-extra-platforms.yml +++ b/eng/pipelines/runtime-extra-platforms.yml @@ -177,7 +177,7 @@ jobs: value: $[ dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'] ] jobParameters: testGroup: innerloop - nameSuffix: ConsoleBrowserTests + nameSuffix: LibraryTests buildArgs: -subset mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:BrowserHost=windows timeoutInMinutes: 180 condition: >- @@ -221,7 +221,7 @@ jobs: jobParameters: isExtraPlatforms: ${{ variables.isExtraPlatformsBuild }} testGroup: innerloop - nameSuffix: AllSubsets_Mono_EAT + nameSuffix: LibraryTests_EAT buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true $(_runSmokeTestsOnlyArg) /p:EnableAggressiveTrimming=true /p:BuildAOTTestsOnHelix=true /p:RunAOTCompilation=false timeoutInMinutes: 180 condition: >- @@ -265,7 +265,7 @@ jobs: jobParameters: isExtraPlatforms: ${{ variables.isExtraPlatformsBuild }} testGroup: innerloop - nameSuffix: AllSubsets_Mono_AOT + nameSuffix: LibraryTests_AOT buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true $(_runSmokeTestsOnlyArg) /p:EnableAggressiveTrimming=true /p:BuildAOTTestsOnHelix=true /p:RunAOTCompilation=true /p:BrowserHost=$(_hostedOs) timeoutInMinutes: 180 condition: >- @@ -288,43 +288,6 @@ jobs: eq(variables['monoContainsChange'], true), eq(variables['isRollingBuild'], true)) -# -# Build the whole product using Mono and run runtime tests -# -- template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/global-build-job.yml - helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml - buildConfig: Release - runtimeFlavor: mono - platforms: - - Browser_wasm - variables: - - ${{ if and(eq(variables['System.TeamProject'], 'public'), eq(variables['Build.Reason'], 'PullRequest')) }}: - - name: _HelixSource - value: pr/dotnet/runtime/$(Build.SourceBranch) - - ${{ if and(eq(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}: - - name: _HelixSource - value: ci/dotnet/runtime/$(Build.SourceBranch) - - name: timeoutPerTestInMinutes - value: 10 - - name: timeoutPerTestCollectionInMinutes - value: 200 - jobParameters: - testGroup: innerloop - nameSuffix: AllSubsets_Mono_RuntimeTests - buildArgs: -s mono+libs -c $(_BuildConfig) - timeoutInMinutes: 180 - condition: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true), - eq(variables['isRollingBuild'], true)) - extraStepsTemplate: /eng/pipelines/common/templates/runtimes/wasm-runtime-and-send-to-helix.yml - extraStepsParameters: - creator: dotnet-bot - testRunNamePrefixSuffix: Mono_$(_BuildConfig) - # # Build the whole product using Mono and run libraries tests # @@ -562,7 +525,7 @@ jobs: value: $[ dependencies.evaluate_paths.outputs['SetPathVars_wasmdebuggertests.containsChange'] ] jobParameters: testGroup: innerloop - nameSuffix: Windows_wasm_DebuggerTests + nameSuffix: Mono_DebuggerTests buildArgs: -s mono+libs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:TestWasmDebuggerTests=true /p:TestAssemblies=false /p:BrowserHost=windows timeoutInMinutes: 180 condition: >- diff --git a/eng/pipelines/runtime-staging.yml b/eng/pipelines/runtime-staging.yml index 42803677d00371..d49ceeed3ef533 100644 --- a/eng/pipelines/runtime-staging.yml +++ b/eng/pipelines/runtime-staging.yml @@ -273,6 +273,180 @@ jobs: creator: dotnet-bot testRunNamePrefixSuffix: Mono_$(_BuildConfig) +# +# Build the whole product using Mono and run libraries tests, for Wasm.Build.Tests +# +- template: /eng/pipelines/common/platform-matrix.yml + parameters: + jobTemplate: /eng/pipelines/common/global-build-job.yml + helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml + buildConfig: Release + runtimeFlavor: mono + platforms: + - Browser_wasm_win + variables: + # map dependencies variables to local variables + - name: wasmbuildtestsContainsChange + value: $[ dependencies.evaluate_paths.outputs['SetPathVars_wasmbuildtests.containsChange'] ] + jobParameters: + isExtraPlatforms: ${{ variables.isExtraPlatformsBuild }} + testGroup: innerloop + nameSuffix: WasmBuildTests + buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:TestWasmBuildTests=true /p:TestAssemblies=false /p:BrowserHost=$(_hostedOs) + timeoutInMinutes: 180 + condition: >- + eq(dependencies.evaluate_paths.outputs['SetPathVars_wasmbuildtests.containsChange'], true) + # extra steps, run tests + extraStepsTemplate: /eng/pipelines/libraries/helix.yml + extraStepsParameters: + creator: dotnet-bot + testRunNamePrefixSuffix: Mono_$(_BuildConfig)_$(_hostedOs) + extraHelixArguments: /p:BrowserHost=$(_hostedOs) + scenarios: + - buildwasmapps + condition: >- + eq(variables['wasmbuildtestsContainsChange'], true) + +# +# Build Browser_wasm, on windows, run console and browser tests +# +- template: /eng/pipelines/common/platform-matrix.yml + parameters: + jobTemplate: /eng/pipelines/common/global-build-job.yml + helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml + buildConfig: release + runtimeFlavor: mono + platforms: + - Browser_wasm_win + variables: + # map dependencies variables to local variables + - name: librariesContainsChange + value: $[ dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'] ] + - name: monoContainsChange + value: $[ dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'] ] + jobParameters: + testGroup: innerloop + nameSuffix: LibraryTests + buildArgs: -subset mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:BrowserHost=windows + timeoutInMinutes: 180 + condition: >- + or( + eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), + eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true), + eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true)) + # extra steps, run tests + extraStepsTemplate: /eng/pipelines/libraries/helix.yml + extraStepsParameters: + creator: dotnet-bot + testRunNamePrefixSuffix: Windows_wasm_$(_BuildConfig) + extraHelixArguments: /p:BrowserHost=windows + scenarios: + - normal + - wasmtestonbrowser + condition: >- + or( + eq(variables['librariesContainsChange'], true), + eq(variables['monoContainsChange'], true), + eq(variables['isRollingBuild'], true)) + +# +# Build for Browser/wasm with RunAOTCompilation=true +# +- template: /eng/pipelines/common/platform-matrix.yml + parameters: + jobTemplate: /eng/pipelines/common/global-build-job.yml + helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml + buildConfig: Release + runtimeFlavor: mono + platforms: + - Browser_wasm_win + variables: + # map dependencies variables to local variables + - name: librariesContainsChange + value: $[ dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'] ] + - name: monoContainsChange + value: $[ dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'] ] + jobParameters: + isExtraPlatforms: ${{ variables.isExtraPlatformsBuild }} + testGroup: innerloop + nameSuffix: LibraryTests_AOT + buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true $(_runSmokeTestsOnlyArg) /p:EnableAggressiveTrimming=true /p:BuildAOTTestsOnHelix=true /p:RunAOTCompilation=true /p:BrowserHost=$(_hostedOs) + timeoutInMinutes: 180 + condition: >- + or( + eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), + eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true), + eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true)) + # extra steps, run tests + extraStepsTemplate: /eng/pipelines/libraries/helix.yml + extraStepsParameters: + creator: dotnet-bot + testRunNamePrefixSuffix: Mono_AOT_$(_BuildConfig)_$(_hostedOs) + extraHelixArguments: /p:NeedsToBuildWasmAppsOnHelix=true $(_runSmokeTestsOnlyArg) /p:BrowserHost=$(_hostedOs) + scenarios: + - normal + condition: >- + or( + eq(variables['librariesContainsChange'], true), + eq(variables['monoContainsChange'], true)) + +# Wasm debugger tests - windows +- template: /eng/pipelines/common/platform-matrix.yml + parameters: + jobTemplate: /eng/pipelines/common/global-build-job.yml + helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml + buildConfig: Release + runtimeFlavor: mono + platforms: + - Browser_wasm_win + variables: + # map dependencies variables to local variables + - name: wasmdebuggertestsContainsChange + value: $[ dependencies.evaluate_paths.outputs['SetPathVars_wasmdebuggertests.containsChange'] ] + jobParameters: + testGroup: innerloop + nameSuffix: Mono_DebuggerTests + buildArgs: -s mono+libs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:TestWasmDebuggerTests=true /p:TestAssemblies=false /p:BrowserHost=windows + timeoutInMinutes: 180 + condition: >- + eq(dependencies.evaluate_paths.outputs['SetPathVars_wasmdebuggertests.containsChange'], true) + # extra steps, run tests + extraStepsTemplate: /eng/pipelines/libraries/helix.yml + extraStepsParameters: + creator: dotnet-bot + testRunNamePrefixSuffix: Mono_$(_BuildConfig) + extraHelixArguments: /p:BrowserHost=windows + scenarios: + - wasmdebuggertests + +# Wasm debugger tests +- template: /eng/pipelines/common/platform-matrix.yml + parameters: + jobTemplate: /eng/pipelines/common/global-build-job.yml + helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml + buildConfig: Release + runtimeFlavor: mono + platforms: + - Browser_wasm + variables: + # map dependencies variables to local variables + - name: wasmdebuggertestsContainsChange + value: $[ dependencies.evaluate_paths.outputs['SetPathVars_wasmdebuggertests.containsChange'] ] + jobParameters: + testGroup: innerloop + nameSuffix: Mono_DebuggerTests + buildArgs: -s mono+libs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:TestWasmDebuggerTests=true /p:TestAssemblies=false + timeoutInMinutes: 180 + condition: >- + eq(dependencies.evaluate_paths.outputs['SetPathVars_wasmdebuggertests.containsChange'], true) + # extra steps, run tests + extraStepsTemplate: /eng/pipelines/libraries/helix.yml + extraStepsParameters: + creator: dotnet-bot + testRunNamePrefixSuffix: Mono_$(_BuildConfig) + scenarios: + - wasmdebuggertests + # # Build the whole product using Mono for Android and run runtime tests with Android devices # diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml index cfc899e8d808de..7fb2493bac4790 100644 --- a/eng/pipelines/runtime.yml +++ b/eng/pipelines/runtime.yml @@ -364,7 +364,7 @@ jobs: value: $[ dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'] ] jobParameters: testGroup: innerloop - nameSuffix: AllSubsets_Mono + nameSuffix: LibraryTests buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true timeoutInMinutes: 180 condition: >- @@ -404,7 +404,7 @@ jobs: value: $[ dependencies.evaluate_paths.outputs['SetPathVars_wasmbuildtests.containsChange'] ] jobParameters: testGroup: innerloop - nameSuffix: AllSubsets_Mono_WasmBuildTests + nameSuffix: WasmBuildTests buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:TestWasmBuildTests=true /p:TestAssemblies=false timeoutInMinutes: 180 condition: >- @@ -442,7 +442,7 @@ jobs: value: $[ dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'] ] jobParameters: testGroup: innerloop - nameSuffix: AllSubsets_Mono_EAT + nameSuffix: LibraryTests_EAT buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true $(_runSmokeTestsOnlyArg) /p:EnableAggressiveTrimming=true /p:BuildAOTTestsOnHelix=true /p:RunAOTCompilation=false timeoutInMinutes: 180 condition: >- @@ -484,7 +484,7 @@ jobs: value: $[ dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'] ] jobParameters: testGroup: innerloop - nameSuffix: AllSubsets_Mono_AOT + nameSuffix: LibraryTests_AOT buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true $(_runSmokeTestsOnlyArg) /p:EnableAggressiveTrimming=true /p:BuildAOTTestsOnHelix=true /p:RunAOTCompilation=true timeoutInMinutes: 180 condition: >- @@ -507,6 +507,43 @@ jobs: eq(variables['monoContainsChange'], true), eq(variables['isRollingBuild'], true)) +# +# Build the whole product using Mono and run runtime tests +# +- template: /eng/pipelines/common/platform-matrix.yml + parameters: + jobTemplate: /eng/pipelines/common/global-build-job.yml + helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml + buildConfig: Release + runtimeFlavor: mono + platforms: + - Browser_wasm + variables: + - ${{ if and(eq(variables['System.TeamProject'], 'public'), eq(variables['Build.Reason'], 'PullRequest')) }}: + - name: _HelixSource + value: pr/dotnet/runtime/$(Build.SourceBranch) + - ${{ if and(eq(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}: + - name: _HelixSource + value: ci/dotnet/runtime/$(Build.SourceBranch) + - name: timeoutPerTestInMinutes + value: 10 + - name: timeoutPerTestCollectionInMinutes + value: 200 + jobParameters: + testGroup: innerloop + nameSuffix: AllSubsets_Mono_RuntimeTests + buildArgs: -s mono+libs -c $(_BuildConfig) + timeoutInMinutes: 180 + condition: >- + or( + eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true), + eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true), + eq(variables['isRollingBuild'], true)) + extraStepsTemplate: /eng/pipelines/common/templates/runtimes/wasm-runtime-and-send-to-helix.yml + extraStepsParameters: + creator: dotnet-bot + testRunNamePrefixSuffix: Mono_$(_BuildConfig) + # Build and test libraries under single-file publishing - template: /eng/pipelines/common/platform-matrix.yml parameters: diff --git a/src/tests/issues.targets b/src/tests/issues.targets index 3269c33f9bd462..7b718aa15617d3 100644 --- a/src/tests/issues.targets +++ b/src/tests/issues.targets @@ -1985,6 +1985,9 @@ Tests coreclr JIT's debug info generation + + https://github.com/dotnet/runtime/issues/64127 + From 71a6433a44f55d140115cd8da678e2cbb18c55aa Mon Sep 17 00:00:00 2001 From: Floris Westerman Date: Sat, 22 Jan 2022 08:31:21 +0100 Subject: [PATCH 003/161] Fixing update issue with multivalued properties #34267 (#56696) * Add custom attribute test * Adding test demonstrating issue #34267 * Solution for issue #34267 Replacing all values in property with the new collection, instead of just appending new values, leaving old values in place. * Incorporate review feedback Changing the variable name --- .../AD/ADStoreCtx_LoadStore.cs | 11 +- .../tests/AccountManagementTests.cs | 147 ++++++++++++++++++ 2 files changed, 157 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/AD/ADStoreCtx_LoadStore.cs b/src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/AD/ADStoreCtx_LoadStore.cs index 709ccb1601f734..2d8eebfc84ee79 100644 --- a/src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/AD/ADStoreCtx_LoadStore.cs +++ b/src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/AD/ADStoreCtx_LoadStore.cs @@ -1357,6 +1357,12 @@ protected static void ExtensionCacheToLdapConverter(Principal p, string property valueCollection = (ICollection)kvp.Value.Value; } + // We make a local copy of all elements to set, instead of adding them to the real property + // directly. This allows us to override all existing elements without using Clear() and then Add(), + // as that order sends a Clear operation and then a number of Append operations, which will fail. + // Instead, setting the new list all at once will send a Clear operation and then an Update operation. + var propertyValueList = new List(); + foreach (object oVal in valueCollection) { if (null != oVal) @@ -1373,8 +1379,11 @@ protected static void ExtensionCacheToLdapConverter(Principal p, string property if (p.unpersisted && null == oVal) continue; - de.Properties[kvp.Key].Add(oVal); + propertyValueList.Add(oVal); } + + de.Properties[kvp.Key].Value = propertyValueList.ToArray(); + GlobalDebug.WriteLineIf(GlobalDebug.Info, "ADStoreCtx", "ExtensionCacheToLdapConverter - Collection complete"); } else diff --git a/src/libraries/System.DirectoryServices.AccountManagement/tests/AccountManagementTests.cs b/src/libraries/System.DirectoryServices.AccountManagement/tests/AccountManagementTests.cs index 4796aa44515585..10dde4837cc6d3 100644 --- a/src/libraries/System.DirectoryServices.AccountManagement/tests/AccountManagementTests.cs +++ b/src/libraries/System.DirectoryServices.AccountManagement/tests/AccountManagementTests.cs @@ -7,6 +7,7 @@ using System.DirectoryServices.Tests; using System.Linq; using Xunit; +using System.Collections.Generic; namespace System.DirectoryServices.AccountManagement.Tests { @@ -325,6 +326,7 @@ public void TestUpdateUserAndGroupData() using (GroupPrincipal gp = FindGroup(g1.Name, context)) { Assert.Equal(group.DisplayName, gp.DisplayName); } user.DisplayName = "Updated CoreFx Test Child User 4"; + user.Save(); group.DisplayName = "Updated CoreFX Test Group Container 4"; group.Save(); @@ -365,6 +367,91 @@ public void TestCredentials() } } + [ConditionalFact(nameof(IsActiveDirectoryServer))] + public void TestCustomUserAttributes() + { + var userData = CustomUserData.GenerateUserData("CustomCoreFxUser1"); + + DeleteUser(userData.Name); + + try + { + using var context = DomainContext; + using (var principal = CreateCustomUser(context, userData)) + { + Assert.NotNull(principal); + ValidateRecentAddedUser(context, userData); + ValidateUserUsingPrincipal(context, principal); + + using var foundPrincipal = FindCustomUser(userData.Name, context); + Assert.NotNull(foundPrincipal); + + Assert.Equal(userData.PostalCode, foundPrincipal.PostalCode); + Assert.Equal(principal.PostalCode, foundPrincipal.PostalCode); + + Assert.Equal(userData.PostalAddress, foundPrincipal.PostalAddress); + Assert.Equal(principal.PostalAddress, foundPrincipal.PostalAddress); + } + } + finally + { + DeleteUser(userData.Name); + } + } + + [ConditionalFact(nameof(IsActiveDirectoryServer))] + public void TestMultiValueCustomAttributes() + { + var userData = CustomUserData.GenerateUserData("CustomCoreFxUser2"); + userData.PostalAddress.Add("Second address"); + + DeleteUser(userData.Name); + + // Check whether directory-data is equivalent to expected data + void CheckAddressWithDirectory(PrincipalContext context, List address) + { + using var foundPrincipal = FindCustomUser(userData.Name, context); + Assert.NotNull(foundPrincipal); + Assert.Equal(address.ToHashSet(), foundPrincipal.PostalAddress.ToHashSet()); + }; + + // Helper to update list + void UpdateAddressList(CustomUserPrincipal principal, Action> update) + { + var localCopy = principal.PostalAddress; + update(localCopy); + principal.PostalAddress = localCopy; + principal.Save(); + } + + try + { + // Initial setup + using var context = DomainContext; + using var principal = CreateCustomUser(context, userData); + Assert.NotNull(principal); + Assert.Equal(userData.PostalAddress, principal.PostalAddress); + + CheckAddressWithDirectory(context, principal.PostalAddress); + + // Add address + UpdateAddressList(principal, addresses => addresses.Add("Third address")); + CheckAddressWithDirectory(context, principal.PostalAddress); + + // Remove address + UpdateAddressList(principal, addresses => addresses.Remove("Second address")); + CheckAddressWithDirectory(context, principal.PostalAddress); + + // Remove address so we have one remaining + UpdateAddressList(principal, addresses => addresses.Remove("Third address")); + CheckAddressWithDirectory(context, principal.PostalAddress); + } + finally + { + DeleteUser(userData.Name); + } + } + private void ValidateRecentAddedUser(PrincipalContext context, UserData userData) { using (UserPrincipal p = FindUser(userData.Name, context)) @@ -440,6 +527,20 @@ private UserPrincipal CreateUser(PrincipalContext context, UserData userData) return user; } + private CustomUserPrincipal CreateCustomUser(PrincipalContext context, CustomUserData userData) + { + CustomUserPrincipal user = new CustomUserPrincipal(context, userData.Name, userData.Password, true); + + // assign some properties to the custom user principal + user.GivenName = userData.FirstName; + user.Surname = userData.LastName; + user.DisplayName = userData.DisplayName; + user.PostalCode = userData.PostalCode; + user.PostalAddress = userData.PostalAddress; + user.Save(); + return user; + } + private GroupPrincipal CreateGroup(PrincipalContext context, GroupData groupData) { GroupPrincipal group = new GroupPrincipal(context, groupData.Name); @@ -493,6 +594,11 @@ private UserPrincipal FindUser(string userName, PrincipalContext context) return UserPrincipal.FindByIdentity(context, IdentityType.Name, userName); } + private CustomUserPrincipal FindCustomUser(string userName, PrincipalContext context) + { + return CustomUserPrincipal.FindByIdentity(context, IdentityType.SamAccountName, userName); + } + private UserPrincipal FindUserUsingFilter(string userName, PrincipalContext context) { CustomUserPrincipal userPrincipal = new CustomUserPrincipal(context); @@ -528,6 +634,23 @@ internal static UserData GenerateUserData(string name) internal string DisplayName { get; set; } } + internal class CustomUserData : UserData + { + internal static new CustomUserData GenerateUserData(string name) => new CustomUserData + { + Name = name, + Password = Guid.NewGuid().ToString() + "#1aZ", + FirstName = "First " + name, + LastName = "Last " + name, + DisplayName = "Display " + name, + PostalAddress = new List { "Postal Address " + name }, + PostalCode = "Code " + name + }; + + internal string PostalCode { get; set; } + internal List PostalAddress { get; set; } + } + internal class GroupData { internal static GroupData GenerateGroupData(string name) @@ -545,11 +668,14 @@ internal static GroupData GenerateGroupData(string name) } [DirectoryObjectClass("user")] + [DirectoryRdnPrefix("CN")] public class CustomUserPrincipal : UserPrincipal { private CustomFilter _customFilter; public CustomUserPrincipal(PrincipalContext context) : base(context) { } + public CustomUserPrincipal(PrincipalContext context, string samAccountName, string password, bool enabled) + : base(context, samAccountName, password, enabled) { } public void SetUserNameFilter(string name) { @@ -568,6 +694,27 @@ public override AdvancedFilters AdvancedSearchFilter return _customFilter; } } + + // Custom properties + [DirectoryProperty("postalCode")] + public string PostalCode + { + get => ExtensionGet("postalCode").FirstOrDefault() as string; + set => ExtensionSet("postalCode", value); + } + + [DirectoryProperty("postalAddress")] + public List PostalAddress + { + get => ExtensionGet("postalAddress").OfType().ToList(); + set => ExtensionSet("postalAddress", value == null || value?.Count == 0 ? null : value.ToArray()); + } + + // Method overrides + public new static CustomUserPrincipal FindByIdentity(PrincipalContext context, IdentityType identityType, string identityValue) + { + return FindByIdentityWithType(context, typeof(CustomUserPrincipal), identityType, identityValue) as CustomUserPrincipal; + } } public class CustomFilter : AdvancedFilters From 64245ab3966abde394767fbd6531e7edbea2802e Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Fri, 21 Jan 2022 23:56:14 -0800 Subject: [PATCH 004/161] Relax assert in ApplyEditAndContinue (#64132) Fixes #64070 --- src/coreclr/md/enc/metamodelrw.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/coreclr/md/enc/metamodelrw.cpp b/src/coreclr/md/enc/metamodelrw.cpp index 34fe8b84e95c88..3fde673faa5c43 100644 --- a/src/coreclr/md/enc/metamodelrw.cpp +++ b/src/coreclr/md/enc/metamodelrw.cpp @@ -309,16 +309,15 @@ ULONG CMiniMdRW::m_TruncatedEncTables[] = ULONG CMiniMdRW::GetTableForToken( // Table index, or -1. mdToken tkn) // Token to find. { - ULONG ixTbl; // Loop control. ULONG type = TypeFromToken(tkn); // Get the type -- if a string, no associated table. if (type >= mdtString) return (ULONG) -1; // Table number is same as high-byte of token. - ixTbl = type >> 24; + ULONG ixTbl = type >> 24; // Make sure. - _ASSERTE(g_TblIndex[ixTbl].m_Token == type); + _ASSERTE(ixTbl < TBL_COUNT); return ixTbl; } // CMiniMdRW::GetTableForToken From fe622eb8981361d13b4821db66a4326b8daa5138 Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Sat, 22 Jan 2022 09:19:39 -0500 Subject: [PATCH 005/161] Disable NJulianRuleTest test crashing in CI (#64142) --- src/libraries/System.Runtime/tests/System/TimeZoneInfoTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Runtime/tests/System/TimeZoneInfoTests.cs b/src/libraries/System.Runtime/tests/System/TimeZoneInfoTests.cs index b352a529d6b009..fb7b8292b03f9d 100644 --- a/src/libraries/System.Runtime/tests/System/TimeZoneInfoTests.cs +++ b/src/libraries/System.Runtime/tests/System/TimeZoneInfoTests.cs @@ -2489,6 +2489,7 @@ public static void GetSystemTimeZones_AllTimeZonesHaveOffsetInValidRange() // 0x3E, 0x2C, 0x30, 0x2F, 0x30, 0x2C, 0x4A, 0x33, 0x36, 0x35, 0x2F, 0x32, 0x35, 0x0A }; + [ActiveIssue("https://github.com/dotnet/runtime/issues/64134")] [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [PlatformSpecific(TestPlatforms.AnyUnix)] [InlineData("<+00>0<+01>,0/0,J365/25", 1, 1, true)] From 8c1b48040db83aa3c24e654cf3dd9c22fa68d376 Mon Sep 17 00:00:00 2001 From: Floris Westerman Date: Sat, 22 Jan 2022 16:44:23 +0100 Subject: [PATCH 006/161] Updating unit tests for DirectoryServices.AccountManagement (#56670) Removing old, redundant unit tests that were actually never executed Migrating old tests to new test infrastructure with configurable LDAP/AD connections --- .../tests/AccountManagementTests.cs | 73 ++++++++- .../tests/ComputerPrincipalTest.cs | 83 ---------- .../tests/ExtendedUserPrincipal.cs | 36 ----- .../tests/GroupPrincipalTest.cs | 68 --------- .../tests/PrincipalTest.cs | 143 ------------------ ...oryServices.AccountManagement.Tests.csproj | 8 +- .../tests/UserPrincipalTest.cs | 32 ---- 7 files changed, 70 insertions(+), 373 deletions(-) delete mode 100644 src/libraries/System.DirectoryServices.AccountManagement/tests/ComputerPrincipalTest.cs delete mode 100644 src/libraries/System.DirectoryServices.AccountManagement/tests/ExtendedUserPrincipal.cs delete mode 100644 src/libraries/System.DirectoryServices.AccountManagement/tests/GroupPrincipalTest.cs delete mode 100644 src/libraries/System.DirectoryServices.AccountManagement/tests/PrincipalTest.cs delete mode 100644 src/libraries/System.DirectoryServices.AccountManagement/tests/UserPrincipalTest.cs diff --git a/src/libraries/System.DirectoryServices.AccountManagement/tests/AccountManagementTests.cs b/src/libraries/System.DirectoryServices.AccountManagement/tests/AccountManagementTests.cs index 10dde4837cc6d3..33de32cb836c09 100644 --- a/src/libraries/System.DirectoryServices.AccountManagement/tests/AccountManagementTests.cs +++ b/src/libraries/System.DirectoryServices.AccountManagement/tests/AccountManagementTests.cs @@ -17,6 +17,42 @@ public class AccountManagementTests internal static bool IsActiveDirectoryServer => IsLdapConfigurationExist && LdapConfiguration.Configuration.IsActiveDirectoryServer; internal static bool IsDomainJoinedClient => !Environment.MachineName.Equals(Environment.UserDomainName, StringComparison.OrdinalIgnoreCase); + [Fact] + public void TestConstructors() + { + using var context = new PrincipalContext(ContextType.Machine); + + using (var principal = new ComputerPrincipal(context)) + { + Assert.Same(context, principal.Context); + Assert.Empty(principal.ServicePrincipalNames); + Assert.Equal(ContextType.Machine, principal.ContextType); + } + Assert.Throws(() => new ComputerPrincipal(null)); + Assert.Throws(() => new ComputerPrincipal(null, "samAccountName", "password", true)); + Assert.Throws(() => new ComputerPrincipal(context, null, "password", true)); + Assert.Throws(() => new ComputerPrincipal(context, "samAccountName", null, true)); + + using (var principal = new UserPrincipal(context)) + { + Assert.Same(context, principal.Context); + Assert.Equal(ContextType.Machine, principal.ContextType); + } + Assert.Throws(() => new UserPrincipal(null)); + Assert.Throws(() => new UserPrincipal(null, "samAccountName", "password", true)); + Assert.Throws(() => new UserPrincipal(context, null, "password", true)); + Assert.Throws(() => new UserPrincipal(context, "samAccountName", null, true)); + + using (var principal = new GroupPrincipal(context)) + { + Assert.Same(context, principal.Context); + Assert.Equal(ContextType.Machine, principal.ContextType); + } + Assert.Throws(() => new GroupPrincipal(null)); + Assert.Throws(() => new GroupPrincipal(null, "samAccountName")); + Assert.Throws(() => new GroupPrincipal(context, null)); + } + [ConditionalFact(nameof(IsActiveDirectoryServer))] public void TestCurrentUser() { @@ -24,7 +60,7 @@ public void TestCurrentUser() using (UserPrincipal p = FindUser(LdapConfiguration.Configuration.UserNameWithNoDomain, context)) { Assert.NotNull(p); - Assert.Equal(LdapConfiguration.Configuration.UserNameWithNoDomain, p.Name); + Assert.Equal(LdapConfiguration.Configuration.UserNameWithNoDomain, p.SamAccountName); } } @@ -35,6 +71,7 @@ public void TestCurrentUserContext() using (UserPrincipal p = FindUser(LdapConfiguration.Configuration.UserNameWithNoDomain, context)) using (UserPrincipal cu = UserPrincipal.Current) { + Assert.NotNull(cu); Assert.NotEqual(cu.Context.Name, p.Context.Name); } } @@ -46,7 +83,7 @@ public void TestCurrentUserUsingSearchFilter() using (UserPrincipal p = FindUserUsingFilter(LdapConfiguration.Configuration.UserNameWithNoDomain, context)) { Assert.NotNull(p); - Assert.Equal(LdapConfiguration.Configuration.UserNameWithNoDomain, p.Name); + Assert.Equal(LdapConfiguration.Configuration.UserNameWithNoDomain, p.SamAccountName); } } @@ -279,6 +316,27 @@ public void TestNegativeCases() } } + [ConditionalFact(nameof(IsActiveDirectoryServer))] + public void TestInvalidSaves() + { + UserData u1 = UserData.GenerateUserData("CoreFxUser9"); + + DeleteUser(u1.Name); + + try + { + using var context = DomainContext; + using var user = new UserPrincipal(context, u1.Name, u1.Password, true); + + Assert.Throws(() => user.Save(null)); + Assert.Throws(() => user.Save(new PrincipalContext(ContextType.Machine))); + } + finally + { + DeleteUser(u1.Name); + } + } + [ConditionalFact(nameof(IsActiveDirectoryServer))] public void TestComputerContext() { @@ -307,6 +365,13 @@ public void TestComputerContext() } } + [ConditionalFact(nameof(IsActiveDirectoryServer))] + public void TestComputerNegativeCases() + { + using var context = DomainContext; + + } + [ConditionalFact(nameof(IsActiveDirectoryServer))] public void TestUpdateUserAndGroupData() { @@ -591,7 +656,7 @@ private GroupPrincipal FindGroup(string groupName, PrincipalContext context) private UserPrincipal FindUser(string userName, PrincipalContext context) { - return UserPrincipal.FindByIdentity(context, IdentityType.Name, userName); + return UserPrincipal.FindByIdentity(context, IdentityType.SamAccountName, userName); } private CustomUserPrincipal FindCustomUser(string userName, PrincipalContext context) @@ -723,7 +788,7 @@ public CustomFilter(Principal p) : base(p) { } public void SetFilter(string userName) { - this.AdvancedFilterSet("cn", userName, typeof(string), MatchType.Equals); + this.AdvancedFilterSet("samAccountName", userName, typeof(string), MatchType.Equals); } } } diff --git a/src/libraries/System.DirectoryServices.AccountManagement/tests/ComputerPrincipalTest.cs b/src/libraries/System.DirectoryServices.AccountManagement/tests/ComputerPrincipalTest.cs deleted file mode 100644 index ce6b8cf70565b9..00000000000000 --- a/src/libraries/System.DirectoryServices.AccountManagement/tests/ComputerPrincipalTest.cs +++ /dev/null @@ -1,83 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using Xunit; - -namespace System.DirectoryServices.AccountManagement.Tests -{ - public class ComputerPrincipalTest : PrincipalTest - { - [Fact] - public void Ctor_Context() - { - var context = new PrincipalContext(ContextType.Machine); - var principal = new ComputerPrincipal(context); - Assert.Same(context, principal.Context); - Assert.Empty(principal.ServicePrincipalNames); - } - - [Fact] - public void Ctor_NullContext_ThrowsArgumentException() - { - AssertExtensions.Throws(null, () => new ComputerPrincipal(null)); - AssertExtensions.Throws(null, () => new ComputerPrincipal(null, "samAccountName", "password", enabled: true)); - } - - [Fact] - public void Ctor_NullSamAccountName_ThrowsArgumentException() - { - var context = new PrincipalContext(ContextType.Machine); - AssertExtensions.Throws(null, () => new ComputerPrincipal(context, null, "password", enabled: true)); - } - - [Fact] - public void Ctor_EmptySamAccountName_ThrowsArgumentNullException() - { - var context = new PrincipalContext(ContextType.Machine); - AssertExtensions.Throws("value", null, () => new ComputerPrincipal(context, string.Empty, "password", enabled: true)); - } - - [Fact] - public void Ctor_NullPassword_ThrowsArgumentException() - { - var context = new PrincipalContext(ContextType.Machine); - AssertExtensions.Throws(null, () => new ComputerPrincipal(context, "samAccountName", null, enabled: true)); - } - - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoNorServerCore), nameof(PlatformDetection.IsNotWindowsIoTCore))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/34442", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] - public void Ctor_MachineContext_NoException() - { - var context = new PrincipalContext(ContextType.Machine); - var principal = new ComputerPrincipal(context, "samAccountName", "password", enabled: true); - Assert.Equal(ContextType.Machine, principal.ContextType); - } - - [Fact] - public void ComputerPrincipalConstructorTest() - { - if (DomainContext == null) - { - return; - } - - ComputerPrincipal computer = new ComputerPrincipal(DomainContext); - computer.Dispose(); - } - - public override Principal CreatePrincipal(PrincipalContext context, string name) - { - return new ComputerPrincipal(context) { Name = name }; - } - - public override Principal CreateExtendedPrincipal(PrincipalContext context, string name) - { - throw new NotImplementedException(); - } - - public override Principal FindExtendedPrincipal(PrincipalContext context, string name) - { - throw new NotImplementedException(); - } - } -} diff --git a/src/libraries/System.DirectoryServices.AccountManagement/tests/ExtendedUserPrincipal.cs b/src/libraries/System.DirectoryServices.AccountManagement/tests/ExtendedUserPrincipal.cs deleted file mode 100644 index 7f378a13acf430..00000000000000 --- a/src/libraries/System.DirectoryServices.AccountManagement/tests/ExtendedUserPrincipal.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -namespace System.DirectoryServices.AccountManagement.Tests -{ - [DirectoryRdnPrefix("CN")] - [DirectoryObjectClass("User")] - public class ExtendedUserPrincipal : UserPrincipal, IExtendedPrincipalTest - { - public ExtendedUserPrincipal(PrincipalContext context) : base(context) { } - - public static new ExtendedUserPrincipal FindByIdentity(PrincipalContext context,string identityValue) - { - return (ExtendedUserPrincipal)FindByIdentityWithType(context, typeof(ExtendedUserPrincipal), identityValue); - } - - [DirectoryProperty("jpegPhoto")] - public byte[] ByteArrayExtension - { - get => (byte[])ExtensionGet("jpegPhoto")[0]; - set => ExtensionSet("jpegPhoto", value); - } - - public object ObjectExtension - { - get => throw new NotImplementedException(); - set => throw new NotImplementedException(); - } - - public object[] ObjectArrayExtension - { - get => throw new NotImplementedException(); - set => throw new NotImplementedException(); - } - } -} diff --git a/src/libraries/System.DirectoryServices.AccountManagement/tests/GroupPrincipalTest.cs b/src/libraries/System.DirectoryServices.AccountManagement/tests/GroupPrincipalTest.cs deleted file mode 100644 index 8817afbddd186a..00000000000000 --- a/src/libraries/System.DirectoryServices.AccountManagement/tests/GroupPrincipalTest.cs +++ /dev/null @@ -1,68 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using Xunit; - -namespace System.DirectoryServices.AccountManagement.Tests -{ - public class GroupPrincipalTest : PrincipalTest - { - [Fact] - public void GroupPrincipalConstructorTest() - { - if (DomainContext == null) - { - return; - } - - GroupPrincipal group = new GroupPrincipal(DomainContext); - group.Dispose(); - } - - public override Principal CreatePrincipal(PrincipalContext context, string name) - { - return new GroupPrincipal(context, name); - } - - [Fact] - public void IsMemberOfTest() - { - if (DomainContext == null) - { - return; - } - - using (GroupPrincipal group = GroupPrincipal.FindByIdentity(DomainContext, "TestLargeGroup")) - { - Assert.True(UserPrincipal.FindByIdentity(DomainContext, "user1499-LargeGroup").IsMemberOf(group)); - Assert.True(UserPrincipal.FindByIdentity(DomainContext, "user1500-LargeGroup").IsMemberOf(group)); - Assert.True(UserPrincipal.FindByIdentity(DomainContext, "user1501-LargeGroup").IsMemberOf(group)); - Assert.True(UserPrincipal.FindByIdentity(DomainContext, "user3000-LargeGroup").IsMemberOf(group)); - Assert.True(UserPrincipal.FindByIdentity(DomainContext, "user3001-LargeGroup").IsMemberOf(group)); - Assert.False(UserPrincipal.FindByIdentity(DomainContext, "userNotInLargeGroup").IsMemberOf(group)); - } - } - - private void CreateManyUsersInGroup(GroupPrincipal group) - { - for (int i = 1; i < 3002; i++) - { - string name = $"user{i:0000}-LargeGroup"; - UserPrincipal user = new UserPrincipal(DomainContext, name, "Adrumble@6", false); - user.Save(); - group.Members.Add(user); - } - group.Save(); - } - - public override Principal CreateExtendedPrincipal(PrincipalContext context, string name) - { - throw new NotImplementedException(); - } - - public override Principal FindExtendedPrincipal(PrincipalContext context, string name) - { - throw new NotImplementedException(); - } - } -} diff --git a/src/libraries/System.DirectoryServices.AccountManagement/tests/PrincipalTest.cs b/src/libraries/System.DirectoryServices.AccountManagement/tests/PrincipalTest.cs deleted file mode 100644 index a0078001f74f46..00000000000000 --- a/src/libraries/System.DirectoryServices.AccountManagement/tests/PrincipalTest.cs +++ /dev/null @@ -1,143 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Collections.Generic; -using System.Security.Principal; -using Xunit; - -namespace System.DirectoryServices.AccountManagement.Tests -{ - public abstract class PrincipalTest : IDisposable - { - public PrincipalContext DomainContext { get; private set; } - - public PrincipalTest() => RefreshContext(); - - private void RefreshContext() - { - string username = "Administrator"; - string password = Environment.GetEnvironmentVariable("TESTPASSWORD"); - string OU = "Tests"; - string baseDomain = WindowsIdentity.GetCurrent().Name.Split(new char[] { '\\' })[1] + "-TEST"; - string domain = $"{baseDomain}.nttest.microsoft.com"; - string container = $"ou={OU},dc={baseDomain},dc=nttest,dc=microsoft,dc=com"; - DomainContext?.Dispose(); - try - { - DomainContext = new PrincipalContext(ContextType.Domain, domain, container, username, password); - } - catch - { - } - } - - public void Dispose() => DomainContext?.Dispose(); - - [Fact] - public void AddExistingPrincipal() - { - if (DomainContext == null) - { - return; - } - - // use new GUID for the user name so we be sure this user does not exist yet - string name = Guid.NewGuid().ToString(); - using (Principal principal = CreatePrincipal(DomainContext, name)) - { - principal.Save(); - } - - Assert.NotNull(Principal.FindByIdentity(DomainContext, name)); - - // this previously caused the user to be deleted. it is still expected to throw an exception, but not delete the user - bool exceptionThrown = false; - try - { - using (Principal principal = CreatePrincipal(DomainContext, name)) - { - principal.Save(); - } - } - catch (PrincipalExistsException) - { - exceptionThrown = true; - } - - // validate that we correctly throw an exception when trying to add an existing principal - Assert.True(exceptionThrown); - - // validate that we did not delete incorrectly delete the first principal - using (Principal principal2 = Principal.FindByIdentity(DomainContext, name)) - { - Assert.NotNull(principal2); - - // explicitly delete the user and check it was really deleted - principal2.Delete(); - } - - // ensure we cleaned up the test principal - Assert.Null(Principal.FindByIdentity(DomainContext, name)); - } - - [Fact] - public void TestExtendedPrincipal() - { - if (DomainContext == null) - { - return; - } - - string name = Guid.NewGuid().ToString(); - byte[] writtenArray = new byte[] { 10, 20, 30 }; - using (Principal principal = CreateExtendedPrincipal(DomainContext, name)) - { - IExtendedPrincipalTest extendedPrincipal = (IExtendedPrincipalTest)principal; - extendedPrincipal.ByteArrayExtension = writtenArray; - principal.Save(); - } - - RefreshContext(); - using (Principal principal = FindExtendedPrincipal(DomainContext, name)) - { - IExtendedPrincipalTest extendedPrincipal = (IExtendedPrincipalTest)principal; - byte[] readArray = extendedPrincipal.ByteArrayExtension; - principal.Delete(); - } - } - - [Theory] - [MemberData(nameof(TestDebuggerAttributes_Inputs))] - public void Save_ThrowsInvalidOperationException(PrincipalContext context) - { - if (DomainContext == null) - { - return; - } - - using (Principal principal = CreateExtendedPrincipal(DomainContext, Guid.NewGuid().ToString())) - { - Assert.Throws(() => principal.Save(context)); - } - } - - public static IEnumerable TestDebuggerAttributes_Inputs() - { - yield return new object[] { null }; - yield return new object[] { new PrincipalContext(ContextType.Machine) }; - } - - public abstract Principal CreatePrincipal(PrincipalContext context, string name); - - public abstract Principal CreateExtendedPrincipal(PrincipalContext context, string name); - - public abstract Principal FindExtendedPrincipal(PrincipalContext context, string name); - } - - public interface IExtendedPrincipalTest - { - object ObjectExtension { get; set; } - byte[] ByteArrayExtension { get; set; } - object[] ObjectArrayExtension { get; set; } - } -} diff --git a/src/libraries/System.DirectoryServices.AccountManagement/tests/System.DirectoryServices.AccountManagement.Tests.csproj b/src/libraries/System.DirectoryServices.AccountManagement/tests/System.DirectoryServices.AccountManagement.Tests.csproj index 6ee1a6b7217ba6..0bb24c8eadd87d 100644 --- a/src/libraries/System.DirectoryServices.AccountManagement/tests/System.DirectoryServices.AccountManagement.Tests.csproj +++ b/src/libraries/System.DirectoryServices.AccountManagement/tests/System.DirectoryServices.AccountManagement.Tests.csproj @@ -3,15 +3,9 @@ $(NetCoreAppCurrent)-windows;net48 - - - - - - + diff --git a/src/libraries/System.DirectoryServices.AccountManagement/tests/UserPrincipalTest.cs b/src/libraries/System.DirectoryServices.AccountManagement/tests/UserPrincipalTest.cs deleted file mode 100644 index 53b99ab5c939cc..00000000000000 --- a/src/libraries/System.DirectoryServices.AccountManagement/tests/UserPrincipalTest.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Security.Principal; -using Xunit; - -namespace System.DirectoryServices.AccountManagement.Tests -{ - public class UserPrincipalTest : PrincipalTest - { - public override Principal CreatePrincipal(PrincipalContext context, string name) - { - return new UserPrincipal(context) { Name = name }; - } - - public override Principal CreateExtendedPrincipal(PrincipalContext context, string name) - { - return new ExtendedUserPrincipal(context) { Name = name }; - } - - public override Principal FindExtendedPrincipal(PrincipalContext context, string name) - { - return ExtendedUserPrincipal.FindByIdentity(context, name); - } - - public void UserPrincipalConstructorTest() - { - UserPrincipal user = new UserPrincipal(DomainContext); - user.Dispose(); - } - } -} From feb25b01385242beb804b48f4954dbda62d3d54f Mon Sep 17 00:00:00 2001 From: Adeel Mujahid <3840695+am11@users.noreply.github.com> Date: Sat, 22 Jan 2022 22:24:54 +0200 Subject: [PATCH 007/161] Fix MultiByteToWideChar call in pal (#64146) --- src/coreclr/pal/src/init/pal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/pal/src/init/pal.cpp b/src/coreclr/pal/src/init/pal.cpp index 5469b4bebd483a..951680114d8868 100644 --- a/src/coreclr/pal/src/init/pal.cpp +++ b/src/coreclr/pal/src/init/pal.cpp @@ -1242,7 +1242,7 @@ static LPWSTR INIT_FormatCommandLine (int argc, const char * const *argv) return NULL; } - if(!MultiByteToWideChar(CP_ACP, 0,command_line, i, retval, i)) + if(!MultiByteToWideChar(CP_ACP, 0,command_line, -1, retval, i)) { ASSERT("MultiByteToWideChar failure\n"); free(retval); From 8d2268a5323f261d63b4b288fc96c2daa34fc6cf Mon Sep 17 00:00:00 2001 From: Vladimir Sadov Date: Sat, 22 Jan 2022 14:57:43 -0800 Subject: [PATCH 008/161] Extra tests for assembly name parser. (#64022) * Dead code in native assembly name parsing * disallow `\u` escaping in assembly names * misc cleanup * forward slash is illegal escaped or not * ignore "language" attribute in assembly name ("culture" must be used) * duplicate attributes are ok if unrecognized (just add tests) * drop support for "custom" blob attribute * drop support for publickey[token]=neutral ("null" must be used) * ignore unknown assembly name attributes in mono (compat) * disallow \0 anywhere in the assembly name * disallow \0 in assembly names on mono (compat) * only check for embedded nulls when parsing * fix mono build * make GCC happy * couple test scenarios for publickey vs. publickeytoken (CoreRT parser might trip on these) * produce errors on duplicate known attributes in mono --- src/coreclr/binder/inc/assemblyidentity.hpp | 5 - src/coreclr/binder/inc/stringlexer.hpp | 16 +- src/coreclr/binder/inc/stringlexer.inl | 164 +++--------------- .../binder/inc/textualidentityparser.hpp | 11 +- src/coreclr/binder/stringlexer.cpp | 28 ++- src/coreclr/binder/textualidentityparser.cpp | 71 +------- src/coreclr/vm/assemblyspec.cpp | 8 +- src/coreclr/vm/assemblyspec.hpp | 2 +- .../tests/AssemblyNameTests.cs | 38 ++++ .../System/Reflection/AssemblyName.Mono.cs | 3 + src/mono/mono/metadata/assembly.c | 29 ++-- 11 files changed, 137 insertions(+), 238 deletions(-) diff --git a/src/coreclr/binder/inc/assemblyidentity.hpp b/src/coreclr/binder/inc/assemblyidentity.hpp index cc0916c8780afa..ef4768d3b8cd9b 100644 --- a/src/coreclr/binder/inc/assemblyidentity.hpp +++ b/src/coreclr/binder/inc/assemblyidentity.hpp @@ -30,12 +30,9 @@ namespace BINDER_SPACE IDENTITY_FLAG_PUBLIC_KEY_TOKEN = 0x004, IDENTITY_FLAG_PUBLIC_KEY = 0x008, IDENTITY_FLAG_CULTURE = 0x010, - IDENTITY_FLAG_LANGUAGE = 0x020, IDENTITY_FLAG_PROCESSOR_ARCHITECTURE = 0x040, IDENTITY_FLAG_RETARGETABLE = 0x080, IDENTITY_FLAG_PUBLIC_KEY_TOKEN_NULL = 0x100, - IDENTITY_FLAG_CUSTOM = 0x200, - IDENTITY_FLAG_CUSTOM_NULL = 0x400, IDENTITY_FLAG_CONTENT_TYPE = 0x800, IDENTITY_FLAG_FULL_NAME = (IDENTITY_FLAG_SIMPLE_NAME | IDENTITY_FLAG_VERSION) @@ -50,7 +47,6 @@ namespace BINDER_SPACE // Need to pre-populate SBuffers because of bogus asserts static const BYTE byteArr[] = { 0 }; m_publicKeyOrTokenBLOB.SetImmutable(byteArr, sizeof(byteArr)); - m_customBLOB.SetImmutable(byteArr, sizeof(byteArr)); } ~AssemblyIdentity() { @@ -83,7 +79,6 @@ namespace BINDER_SPACE SBuffer m_publicKeyOrTokenBLOB; PEKIND m_kProcessorArchitecture; AssemblyContentType m_kContentType; - SBuffer m_customBLOB; DWORD m_dwIdentityFlags; }; diff --git a/src/coreclr/binder/inc/stringlexer.hpp b/src/coreclr/binder/inc/stringlexer.hpp index 41af7e7baa18d7..f08e046982c566 100644 --- a/src/coreclr/binder/inc/stringlexer.hpp +++ b/src/coreclr/binder/inc/stringlexer.hpp @@ -55,32 +55,28 @@ namespace BINDER_SPACE inline StringLexer(); inline ~StringLexer(); - inline void Init(SString &inputString, BOOL fSupportEscaping); + inline void Init(SString &inputString); static inline BOOL IsWhitespace(WCHAR wcChar); static inline BOOL IsEOS(WCHAR wcChar); static inline BOOL IsQuoteCharacter(WCHAR wcChar); - virtual BOOL IsSeparatorChar(WCHAR wcChar) = NULL; - virtual LEXEME_TYPE GetLexemeType(WCHAR wcChar) = NULL; + BOOL IsSeparatorChar(WCHAR wcChar); + LEXEME_TYPE GetLexemeType(WCHAR wcChar); protected: static const WCHAR INVALID_CHARACTER = -1; - LEXEME_TYPE GetNextLexeme(SString ¤tString, BOOL fPermitUnescapedQuotes = FALSE); + LEXEME_TYPE GetNextLexeme(SString ¤tString); inline WCHAR PopCharacter(BOOL *pfIsEscaped); inline void PushCharacter(WCHAR wcCurrentChar, BOOL fIsEscaped); inline WCHAR GetRawCharacter(); - inline void PushRawCharacter(); - inline WCHAR DecodeUTF16Character(); inline WCHAR GetNextCharacter(BOOL *pfIsEscaped); - inline WCHAR ParseUnicode(); - LEXEME_TYPE ParseString(SString ¤tString, - BOOL fPermitUnescapeQuotes); + LEXEME_TYPE ParseString(SString ¤tString); void TrimTrailingWhiteSpaces(SString ¤tString); @@ -89,8 +85,6 @@ namespace BINDER_SPACE WCHAR m_wcCurrentChar; BOOL m_fCurrentCharIsEscaped; - BOOL m_fSupportEscaping; - BOOL m_fReadRawCharacter; }; #include "stringlexer.inl" diff --git a/src/coreclr/binder/inc/stringlexer.inl b/src/coreclr/binder/inc/stringlexer.inl index bfe4bddeaa4c18..42f7f73ed0bbc2 100644 --- a/src/coreclr/binder/inc/stringlexer.inl +++ b/src/coreclr/binder/inc/stringlexer.inl @@ -25,12 +25,10 @@ StringLexer::~StringLexer() // Nothing to do here } -void StringLexer::Init(SString &inputString, BOOL fSupportEscaping) +void StringLexer::Init(SString &inputString) { m_cursor = inputString.Begin(); m_end = inputString.End(); - m_fSupportEscaping = fSupportEscaping; - m_fReadRawCharacter = FALSE; } BOOL StringLexer::IsWhitespace(WCHAR wcChar) @@ -55,6 +53,7 @@ WCHAR StringLexer::PopCharacter(BOOL *pfIsEscaped) { m_wcCurrentChar = INVALID_CHARACTER; *pfIsEscaped = m_fCurrentCharIsEscaped; + m_cursor++; } else { @@ -71,172 +70,63 @@ void StringLexer::PushCharacter(WCHAR wcCurrentChar, m_wcCurrentChar = wcCurrentChar; m_fCurrentCharIsEscaped = fIsEscaped; + m_cursor--; } WCHAR StringLexer::GetRawCharacter() { WCHAR wcCurrentChar = 0; - if (m_cursor <= m_end) + if (m_cursor < m_end) { wcCurrentChar = m_cursor[0]; - m_fReadRawCharacter = TRUE; m_cursor++; - } - else - { - m_fReadRawCharacter = FALSE; - } - - return wcCurrentChar; -} - -void StringLexer::PushRawCharacter() -{ - if (m_fReadRawCharacter) - { - m_cursor--; - m_fReadRawCharacter = FALSE; - } -} -WCHAR StringLexer::DecodeUTF16Character() -{ - // See http://www.ietf.org/rfc/rfc2781.txt for details on UTF-16 encoding. - - WCHAR wcCurrentChar = 0; - SCOUNT_T nCharacters = m_end - m_cursor + 1; - WCHAR wcChar1 = GetRawCharacter(); - - if (wcChar1 < 0xd800) - { - wcCurrentChar = wcChar1; + // do not allow \0 anywhere in the string. + if (wcCurrentChar == 0) + { + wcCurrentChar = INVALID_CHARACTER; + } } else { - // StringLexer is not designed to handle UTF-16 characters beyond the Basic Multilingual Plane, - // since it stores all characters in 16-bit WCHARs. - // However, since the vast majority of the time, we (Microsoft) produce the manifests, - // this is likely a non-scenario, as the other Unicode planes would never be used in practice. - - if (wcChar1 <= 0xdbff) // 0xd800 - 0xdbff indicates the first WCHAR of a surrogate pair - { - if (nCharacters >= 2) - { - GetRawCharacter(); // Skip the second WCHAR of the surrogate pair - } - } - // Otherwise, the character is either in the 0xdc00 - 0xdfff range, indicating the second WCHAR of a surrogate pair, - // or in the 0xE000 - 0xFFFF range, which has within it ranges of invalid characters, and which we conservatively treat - // as invalid. - - wcCurrentChar = INVALID_CHARACTER; + // EOS + wcCurrentChar = 0; } return wcCurrentChar; } - WCHAR StringLexer::GetNextCharacter(BOOL *pfIsEscaped) { *pfIsEscaped = FALSE; - WCHAR wcCurrentChar = GetRawCharacter(); // DecodeUTF16Character() + WCHAR wcCurrentChar = GetRawCharacter(); if (wcCurrentChar == L'\\') { - WCHAR wcTempChar = GetRawCharacter(); // DecodeUTF16Character() + WCHAR wcTempChar = GetRawCharacter(); - if (m_fSupportEscaping) - { - // Handle standard escapes - switch (wcTempChar) - { - case L'"': - case L'\'': - case L',': - case L'\\': - case L'/': - case L'=': - break; - case L't': - wcTempChar = 9; - break; - case L'n': - wcTempChar = 10; - break; - case L'r': - wcTempChar = 13; - break; - case L'u': - wcTempChar = ParseUnicode(); - break; - default: - return INVALID_CHARACTER; - } - - *pfIsEscaped = TRUE; - wcCurrentChar = wcTempChar; - } - else - { - // Do not handle escapes except for quotes - switch (wcTempChar) - { - case L'"': - case L'\'': - *pfIsEscaped = TRUE; - wcCurrentChar = wcTempChar; - break; - default: - PushRawCharacter(); - break; - } - } - } - - return wcCurrentChar; -} - -WCHAR StringLexer::ParseUnicode() -{ - int nCharacters = 0; - WCHAR wcUnicodeChar = 0; - - for(;;) - { - WCHAR wcCurrentChar = DecodeUTF16Character(); - nCharacters++; - - if (wcCurrentChar == L';') + // Handle standard escapes + switch (wcTempChar) { + case L'"': + case L'\'': + case L',': + case L'\\': + case L'=': + case L't': + case L'n': + case L'r': break; - } - else if ((wcCurrentChar == INVALID_CHARACTER) || (nCharacters >= 9)) - { + default: return INVALID_CHARACTER; } - wcUnicodeChar <<= 4; - - if ((wcCurrentChar >= L'0') && (wcCurrentChar <= L'9')) - { - wcUnicodeChar += (wcCurrentChar - L'0'); - } - else if ((wcCurrentChar >= L'a') && (wcCurrentChar <= L'f')) - { - wcUnicodeChar += (wcCurrentChar - L'a') + 10; - } - else if ((wcCurrentChar >= L'A') && (wcCurrentChar <= L'F')) - { - wcUnicodeChar += (wcCurrentChar - L'A') + 10; - } - else - { - return INVALID_CHARACTER; - } + *pfIsEscaped = TRUE; + wcCurrentChar = wcTempChar; } - return wcUnicodeChar; + return wcCurrentChar; } #endif diff --git a/src/coreclr/binder/inc/textualidentityparser.hpp b/src/coreclr/binder/inc/textualidentityparser.hpp index a5187d254a6522..2b60c3110f37f7 100644 --- a/src/coreclr/binder/inc/textualidentityparser.hpp +++ b/src/coreclr/binder/inc/textualidentityparser.hpp @@ -28,12 +28,9 @@ namespace BINDER_SPACE TextualIdentityParser(AssemblyIdentity *pAssemblyIdentity); ~TextualIdentityParser(); - virtual BOOL IsSeparatorChar(WCHAR wcChar); - virtual StringLexer::LEXEME_TYPE GetLexemeType(WCHAR wcChar); - static HRESULT Parse(/* in */ SString &textualIdentity, - /* out */ AssemblyIdentity *pAssemblyIdentity, - /* in */ BOOL fPermitUnescapedQuotes = FALSE); + /* out */ AssemblyIdentity *pAssemblyIdentity); + static HRESULT ToString(/* in */ AssemblyIdentity *pAssemblyIdentity, /* in */ DWORD dwIdentityFlags, /* out */ SString &textualIdentity); @@ -45,6 +42,7 @@ namespace BINDER_SPACE /* in */ BOOL fValidateHex, /* in */ BOOL fIsToken, /* out */ SBuffer &publicKeyOrTokenBLOB); + static void BlobToHex(/* in */ SBuffer &publicKeyOrTokenBLOB, /* out */ SString &publicKeyOrToken); @@ -52,8 +50,7 @@ namespace BINDER_SPACE /* out */ SString &contentString); protected: - BOOL Parse(/* in */ SString &textualIdentity, - /* in */ BOOL fPermitUnescapedQuotes = FALSE); + BOOL Parse(/* in */ SString &textualIdentity); BOOL PopulateAssemblyIdentity(/* in */ SString &attributeString, /* in */ SString &valueString); diff --git a/src/coreclr/binder/stringlexer.cpp b/src/coreclr/binder/stringlexer.cpp index b6b722fa77ab9f..44ec23e3b517cd 100644 --- a/src/coreclr/binder/stringlexer.cpp +++ b/src/coreclr/binder/stringlexer.cpp @@ -19,7 +19,7 @@ namespace BINDER_SPACE { StringLexer::LEXEME_TYPE - StringLexer::GetNextLexeme(SString ¤tString, BOOL fPermitUnescapedQuotes) + StringLexer::GetNextLexeme(SString ¤tString) { BOOL fIsEscaped = FALSE; WCHAR wcCurrentChar = INVALID_CHARACTER; @@ -43,11 +43,11 @@ namespace BINDER_SPACE // First character of string lexeme; push it back PushCharacter(wcCurrentChar, fIsEscaped); - return ParseString(currentString, fPermitUnescapedQuotes); + return ParseString(currentString); } StringLexer::LEXEME_TYPE - StringLexer::ParseString(SString ¤tString, BOOL fPermitUnescapedQuotes) + StringLexer::ParseString(SString ¤tString) { BOOL fIsFirstCharacter = TRUE; WCHAR wcCurrentChar = INVALID_CHARACTER; @@ -99,7 +99,7 @@ namespace BINDER_SPACE break; } - if (!fPermitUnescapedQuotes && !fIsEscaped && IsQuoteCharacter(wcCurrentChar) && !IsQuoteCharacter(wcOpeningQuote)) + if (!fIsEscaped && IsQuoteCharacter(wcCurrentChar) && !IsQuoteCharacter(wcOpeningQuote)) { // Unescaped quotes in the middle of the string are an error return LEXEME_TYPE_INVALID; @@ -147,4 +147,24 @@ namespace BINDER_SPACE currentString.Truncate(cursor + 1); } } + + BOOL StringLexer::IsSeparatorChar(WCHAR wcChar) + { + return ((wcChar == W(',')) || (wcChar == W('='))); + } + + StringLexer::LEXEME_TYPE StringLexer::GetLexemeType(WCHAR wcChar) + { + switch (wcChar) + { + case W('='): + return LEXEME_TYPE_EQUALS; + case W(','): + return LEXEME_TYPE_COMMA; + case 0: + return LEXEME_TYPE_END_OF_STREAM; + default: + return LEXEME_TYPE_STRING; + } + } }; diff --git a/src/coreclr/binder/textualidentityparser.cpp b/src/coreclr/binder/textualidentityparser.cpp index f69e0bf66b202b..35587df3cb7e4d 100644 --- a/src/coreclr/binder/textualidentityparser.cpp +++ b/src/coreclr/binder/textualidentityparser.cpp @@ -200,30 +200,9 @@ namespace BINDER_SPACE // Nothing to do here } - BOOL TextualIdentityParser::IsSeparatorChar(WCHAR wcChar) - { - return ((wcChar == W(',')) || (wcChar == W('='))); - } - - StringLexer::LEXEME_TYPE TextualIdentityParser::GetLexemeType(WCHAR wcChar) - { - switch (wcChar) - { - case W('='): - return LEXEME_TYPE_EQUALS; - case W(','): - return LEXEME_TYPE_COMMA; - case 0: - return LEXEME_TYPE_END_OF_STREAM; - default: - return LEXEME_TYPE_STRING; - } - } - /* static */ HRESULT TextualIdentityParser::Parse(SString &textualIdentity, - AssemblyIdentity *pAssemblyIdentity, - BOOL fPermitUnescapedQuotes) + AssemblyIdentity *pAssemblyIdentity) { HRESULT hr = S_OK; @@ -233,7 +212,7 @@ namespace BINDER_SPACE { TextualIdentityParser identityParser(pAssemblyIdentity); - if (!identityParser.Parse(textualIdentity, fPermitUnescapedQuotes)) + if (!identityParser.Parse(textualIdentity)) { IF_FAIL_GO(FUSION_E_INVALID_NAME); } @@ -335,18 +314,6 @@ namespace BINDER_SPACE textualIdentity.Append(ContentTypeToString(pAssemblyIdentity->m_kContentType)); } - if (AssemblyIdentity::Have(dwIdentityFlags, AssemblyIdentity::IDENTITY_FLAG_CUSTOM)) - { - textualIdentity.Append(W(", Custom=")); - tmpString.Clear(); - BlobToHex(pAssemblyIdentity->m_customBLOB, tmpString); - textualIdentity.Append(tmpString); - } - else if (AssemblyIdentity::Have(dwIdentityFlags, - AssemblyIdentity::IDENTITY_FLAG_CUSTOM_NULL)) - { - textualIdentity.Append(W(", Custom=null")); - } } EX_CATCH_HRESULT(hr); @@ -486,19 +453,19 @@ namespace BINDER_SPACE publicKeyOrToken.CloseBuffer(cbPublicKeyOrTokenBLOB * 2); } - BOOL TextualIdentityParser::Parse(SString &textualIdentity, BOOL fPermitUnescapedQuotes) + BOOL TextualIdentityParser::Parse(SString &textualIdentity) { BOOL fIsValid = TRUE; SString unicodeTextualIdentity; // Lexer modifies input string textualIdentity.ConvertToUnicode(unicodeTextualIdentity); - Init(unicodeTextualIdentity, TRUE /* fSupportEscaping */); + Init(unicodeTextualIdentity); SmallStackSString currentString; // Identity format is simple name (, attr = value)* - GO_IF_NOT_EXPECTED(GetNextLexeme(currentString, fPermitUnescapedQuotes), LEXEME_TYPE_STRING); + GO_IF_NOT_EXPECTED(GetNextLexeme(currentString), LEXEME_TYPE_STRING); m_pAssemblyIdentity->m_simpleName.Set(currentString); m_pAssemblyIdentity->m_simpleName.Normalize(); m_pAssemblyIdentity->SetHave(AssemblyIdentity::IDENTITY_FLAG_SIMPLE_NAME); @@ -532,7 +499,7 @@ namespace BINDER_SPACE // Lexer modifies input string textualString.ConvertToUnicode(unicodeTextualString); - Init(unicodeTextualString, TRUE /* fSupportEscaping */); + Init(unicodeTextualString); SmallStackSString currentString; GO_IF_NOT_EXPECTED(GetNextLexeme(currentString), LEXEME_TYPE_STRING); @@ -549,8 +516,7 @@ namespace BINDER_SPACE { BOOL fIsValid = TRUE; - if (EqualsCaseInsensitive(attributeString, W("culture")) || - EqualsCaseInsensitive(attributeString, W("language"))) + if (EqualsCaseInsensitive(attributeString, W("culture"))) { GO_IF_SEEN(AssemblyIdentity::IDENTITY_FLAG_CULTURE); GO_IF_WILDCARD(valueString); @@ -586,8 +552,7 @@ namespace BINDER_SPACE GO_IF_SEEN(AssemblyIdentity::IDENTITY_FLAG_PUBLIC_KEY_TOKEN); GO_IF_WILDCARD(valueString); - if (!EqualsCaseInsensitive(valueString, W("null")) && - !EqualsCaseInsensitive(valueString, W("neutral"))) + if (!EqualsCaseInsensitive(valueString, W("null"))) { GO_IF_VALIDATE_FAILED(ValidatePublicKeyToken, AssemblyIdentity::IDENTITY_FLAG_PUBLIC_KEY_TOKEN); @@ -606,8 +571,7 @@ namespace BINDER_SPACE GO_IF_SEEN(AssemblyIdentity::IDENTITY_FLAG_PUBLIC_KEY_TOKEN); GO_IF_SEEN(AssemblyIdentity::IDENTITY_FLAG_PUBLIC_KEY); - if (!EqualsCaseInsensitive(valueString, W("null")) && - !EqualsCaseInsensitive(valueString, W("neutral"))) + if (!EqualsCaseInsensitive(valueString, W("null"))) { GO_IF_VALIDATE_FAILED(ValidatePublicKey, AssemblyIdentity::IDENTITY_FLAG_PUBLIC_KEY); HexToBlob(valueString, @@ -661,23 +625,6 @@ namespace BINDER_SPACE fIsValid = FALSE; } } - else if (EqualsCaseInsensitive(attributeString, W("custom"))) - { - GO_IF_SEEN(AssemblyIdentity::IDENTITY_FLAG_CUSTOM); - - if (EqualsCaseInsensitive(valueString, W("null"))) - { - m_pAssemblyIdentity->SetHave(AssemblyIdentity::IDENTITY_FLAG_CUSTOM_NULL); - } - else - { - GO_IF_VALIDATE_FAILED(ValidateHex, AssemblyIdentity::IDENTITY_FLAG_CUSTOM); - HexToBlob(valueString, - FALSE /* fValidateHex */, - FALSE /* fIsToken */, - m_pAssemblyIdentity->m_customBLOB); - } - } Exit: return fIsValid; diff --git a/src/coreclr/vm/assemblyspec.cpp b/src/coreclr/vm/assemblyspec.cpp index dfbee7152df19a..0cea7dc7121070 100644 --- a/src/coreclr/vm/assemblyspec.cpp +++ b/src/coreclr/vm/assemblyspec.cpp @@ -271,6 +271,11 @@ HRESULT AssemblySpec::InitializeSpec(StackingAllocator* alloc, ASSEMBLYNAMEREF* WCHAR* pString; int iString; ((STRINGREF) (*pName)->GetSimpleName())->RefInterpretGetStringValuesDangerousForGC(&pString, &iString); + + // we will not parse names that contain nulls + if (fParse && (wcslen(pString) != (size_t)iString)) + ThrowHR(FUSION_E_INVALID_NAME); + DWORD lgth = WszWideCharToMultiByte(CP_UTF8, 0, pString, iString, NULL, 0, NULL, NULL); if (lgth + 1 < lgth) ThrowHR(E_INVALIDARG); @@ -290,7 +295,8 @@ HRESULT AssemblySpec::InitializeSpec(StackingAllocator* alloc, ASSEMBLYNAMEREF* SetName(lpName); } - if (fParse) { + if (fParse) + { HRESULT hr = ParseName(); // Sometimes Fusion flags invalid characters in the name, sometimes it doesn't // depending on where the invalid characters are diff --git a/src/coreclr/vm/assemblyspec.hpp b/src/coreclr/vm/assemblyspec.hpp index 5d09b5b75a664e..d6ce12300170ed 100644 --- a/src/coreclr/vm/assemblyspec.hpp +++ b/src/coreclr/vm/assemblyspec.hpp @@ -105,7 +105,7 @@ class AssemblySpec : public BaseAssemblySpec void InitializeSpec(PEAssembly* pPEAssembly); HRESULT InitializeSpec(StackingAllocator* alloc, ASSEMBLYNAMEREF* pName, - BOOL fParse = TRUE); + BOOL fParse); void AssemblyNameInit(ASSEMBLYNAMEREF* pName, PEImage* pImageInfo); //[in,out], [in] diff --git a/src/libraries/System.Reflection/tests/AssemblyNameTests.cs b/src/libraries/System.Reflection/tests/AssemblyNameTests.cs index 05f3bf31a0c685..7e9b8c5849b22d 100644 --- a/src/libraries/System.Reflection/tests/AssemblyNameTests.cs +++ b/src/libraries/System.Reflection/tests/AssemblyNameTests.cs @@ -68,6 +68,15 @@ public void Ctor_String(string name, string expectedName) Assert.Equal(ProcessorArchitecture.None, assemblyName.ProcessorArchitecture); } + [Theory] + [InlineData("MyAssemblyName, Version=1.0.0.0, PublicKeyToken=b77a5c561934e089", "MyAssemblyName, Version=1.0.0.0, PublicKeyToken=b77a5c561934e089")] + [InlineData("MyAssemblyName, Version=1.0.0.0, PublicKey=00000000000000000400000000000000", "MyAssemblyName, Version=1.0.0.0, PublicKeyToken=b77a5c561934e089")] + public void Ctor_String_Public_Key(string name, string expectedName) + { + AssemblyName assemblyName = new AssemblyName(name); + Assert.Equal(expectedName, assemblyName.FullName); + } + [Theory] [InlineData(null, typeof(ArgumentNullException))] [InlineData("", typeof(ArgumentException))] @@ -76,11 +85,40 @@ public void Ctor_String(string name, string expectedName) [InlineData("/a", typeof(FileLoadException))] [InlineData(" ", typeof(FileLoadException))] [InlineData(" \t \r \n ", typeof(FileLoadException))] + [InlineData("aa, culture=en-en, culture=en-en", typeof(FileLoadException))] + [InlineData("MyAssemblyName, PublicKey=00000000000000000400000000000000, PublicKeyToken=b77a5c561934e089", typeof(FileLoadException))] public void Ctor_String_Invalid(string assemblyName, Type exceptionType) { Assert.Throws(exceptionType, () => new AssemblyName(assemblyName)); } + [Theory] + [InlineData("aaaa, language=en-en", "aaaa")] + [InlineData("aaaa, foo=bar, foo=baz", "aaaa")] + [InlineData("aaaa, foo = bar, foo = bar", "aaaa")] + [InlineData("aaaa, custom=10", "aaaa")] + [InlineData("aaaa, custom=10, custom=20", "aaaa")] + [InlineData("aaaa, custom=lalala", "aaaa")] + public void Ctor_String_Valid_Legacy(string name, string expectedName) + { + AssemblyName assemblyName = new AssemblyName(name); + Assert.Equal(expectedName, assemblyName.Name); + } + + [Theory] + [InlineData("name\\u50; ", typeof(FileLoadException))] + [InlineData("aa/name ", typeof(FileLoadException))] + [InlineData("aa\\/tname", typeof(FileLoadException))] + [InlineData("aaaa, publickey=neutral", typeof(FileLoadException))] + [InlineData("aaaa, publickeytoken=neutral", typeof(FileLoadException))] + [InlineData("aaaa\0", typeof(FileLoadException))] + [InlineData("aaaa\0potato", typeof(FileLoadException))] + [InlineData("aaaa, publickeytoken=null\0,culture=en-en", typeof(FileLoadException))] + public void Ctor_String_Invalid_Legacy(string assemblyName, Type exceptionType) + { + Assert.Throws(exceptionType, () => new AssemblyName(assemblyName)); + } + [Theory] [InlineData("na,me", typeof(FileLoadException))] [InlineData("na=me", typeof(FileLoadException))] diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/AssemblyName.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/AssemblyName.Mono.cs index 867cf694cb2c4b..12b2a5936c3ded 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/AssemblyName.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/AssemblyName.Mono.cs @@ -19,6 +19,9 @@ public AssemblyName(string assemblyName) if (assemblyName.Length == 0 || assemblyName[0] == '\0') throw new ArgumentException(SR.Format_StringZeroLength); + if (assemblyName.Contains('\0')) + throw new FileLoadException("The assembly name is invalid."); + using (SafeStringMarshal name = RuntimeMarshal.MarshalString(assemblyName)) { // TODO: Should use CoreRT AssemblyNameParser diff --git a/src/mono/mono/metadata/assembly.c b/src/mono/mono/metadata/assembly.c index e8c4bbee3c0a46..493c3ff47d3c56 100644 --- a/src/mono/mono/metadata/assembly.c +++ b/src/mono/mono/metadata/assembly.c @@ -2544,7 +2544,7 @@ mono_assembly_name_parse_full (const char *name, MonoAssemblyName *aname, gboole gchar *key_uq; gchar *retargetable = NULL; gchar *retargetable_uq; - gchar *procarch; + gchar *procarch = NULL; gchar *procarch_uq; gboolean res; gchar *value, *part_name; @@ -2590,43 +2590,47 @@ mono_assembly_name_parse_full (const char *name, MonoAssemblyName *aname, gboole if (part_name_len == 7 && !g_ascii_strncasecmp (part_name, "Version", part_name_len)) { *is_version_defined = TRUE; - version = value; - if (strlen (version) == 0) { + if (version != NULL || strlen (value) == 0) { goto cleanup_and_fail; } + version = value; tmp++; continue; } if (part_name_len == 7 && !g_ascii_strncasecmp (part_name, "Culture", part_name_len)) { - culture = value; - if (strlen (culture) == 0) { + if (culture != NULL || strlen (value) == 0) { goto cleanup_and_fail; } + culture = value; tmp++; continue; } if (part_name_len == 14 && !g_ascii_strncasecmp (part_name, "PublicKeyToken", part_name_len)) { *is_token_defined = TRUE; - token = value; - if (strlen (token) == 0) { + if (token != NULL || key != NULL || strlen (value) == 0) { goto cleanup_and_fail; } + token = value; tmp++; continue; } if (part_name_len == 9 && !g_ascii_strncasecmp (part_name, "PublicKey", part_name_len)) { - key = value; - if (strlen (key) == 0) { + if (token != NULL || key != NULL || strlen (value) == 0) { goto cleanup_and_fail; } + key = value; tmp++; continue; } if (part_name_len == 12 && !g_ascii_strncasecmp (part_name, "Retargetable", part_name_len)) { + if (retargetable != NULL) { + goto cleanup_and_fail; + } + retargetable = value; retargetable_uq = unquote (retargetable); if (retargetable_uq != NULL) @@ -2645,6 +2649,10 @@ mono_assembly_name_parse_full (const char *name, MonoAssemblyName *aname, gboole } if (part_name_len == 21 && !g_ascii_strncasecmp (part_name, "ProcessorArchitecture", part_name_len)) { + if (procarch != NULL) { + goto cleanup_and_fail; + } + procarch = value; procarch_uq = unquote (procarch); if (procarch_uq != NULL) @@ -2672,7 +2680,8 @@ mono_assembly_name_parse_full (const char *name, MonoAssemblyName *aname, gboole continue; } - goto cleanup_and_fail; + // compat: If we got here, the attribute name is unknown to us. Ignore it. + tmp++; } /* if retargetable flag is set, then we must have a fully qualified name */ From 5605bdff4b104496941cc9e6acfc19783a52e7b8 Mon Sep 17 00:00:00 2001 From: Julius Hardt Date: Sun, 23 Jan 2022 02:32:42 +0100 Subject: [PATCH 009/161] Dispose LdapConnections used by ValidateCredentials (#62036) Ensure that cached LdapConnection instances created by PrincipalContext.ValidateCredentials are disposed when the corresponding PrincipalContext is disposed. Fix #62035 --- .../DirectoryServices/AccountManagement/Context.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/Context.cs b/src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/Context.cs index b132723c385ace..3a04bcc8a4b77c 100644 --- a/src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/Context.cs +++ b/src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/Context.cs @@ -44,7 +44,7 @@ internal static class CapabilityMap public const string LDAP_CAP_ACTIVE_DIRECTORY_V61_OID = "1.2.840.113556.1.4.1935"; } - internal sealed class CredentialValidator + internal sealed class CredentialValidator : IDisposable { private enum AuthMethod { @@ -341,6 +341,14 @@ public bool Validate(string userName, string password, ContextOptions connection return (BindSam(_serverName, userName, password)); } } + + public void Dispose() + { + foreach (LdapConnection connection in _connCache.Values) + { + connection.Dispose(); + } + } } // ******************************************** public class PrincipalContext : IDisposable @@ -1014,6 +1022,8 @@ public void Dispose() if (_queryCtx != null) _queryCtx.Dispose(); + _credValidate.Dispose(); + _disposed = true; GC.SuppressFinalize(this); } From 4a6d169f5391532340074b0be4cab737c6ccdfc8 Mon Sep 17 00:00:00 2001 From: Aaron Robinson Date: Sun, 23 Jan 2022 09:39:24 -0500 Subject: [PATCH 010/161] Add runtime support for `ref` fields (#63985) * Add mono and coreclr runtime support for ref fields * Update Reflection.Emit tests to validate ref fields. Add test for TypedReference as a ref field. --- .../System/Reflection/Emit/ModuleBuilder.cs | 25 ++-- .../src/System/Reflection/Emit/TypeBuilder.cs | 2 + src/coreclr/utilcode/util.cpp | 4 +- src/coreclr/vm/field.cpp | 8 +- src/coreclr/vm/jitinterface.cpp | 3 - src/coreclr/vm/methodtablebuilder.cpp | 26 +++- .../src/Resources/Strings.resx | 3 - .../MethodBuilder/MethodBuilderByRefs.cs | 21 +++ .../ModuleBuilder/ModuleBuilderDefineEnum.cs | 4 +- .../tests/System.Reflection.Emit.Tests.csproj | 1 + .../TypeBuilderAddInterfaceImplementaion.cs | 7 - .../TypeBuilder/TypeBuilderDefineEvent.cs | 6 +- .../TypeBuilder/TypeBuilderDefineField.cs | 73 +++++++++-- .../TypeBuilderDefineNestedType.cs | 8 +- .../tests/TypeBuilder/TypeBuilderSetParent.cs | 4 +- .../System.Reflection.Emit/tests/Utilities.cs | 11 +- .../Reflection/Emit/ILGenerator.Mono.cs | 3 - .../Reflection/Emit/TypeBuilder.Mono.cs | 24 ++-- src/mono/mono/metadata/class-init.c | 8 ++ src/mono/mono/metadata/class.c | 9 +- src/mono/mono/metadata/object-internals.h | 1 + src/mono/mono/metadata/object.c | 1 + src/mono/mono/metadata/sre.c | 11 ++ .../classloader/RefFields/InvalidCSharp.il | 123 ++++++++++++++++++ .../RefFields/InvalidCSharp.ilproj | 8 ++ .../Loader/classloader/RefFields/Validate.cs | 59 +++++++++ .../classloader/RefFields/Validate.csproj | 12 ++ src/tests/issues.targets | 5 +- 28 files changed, 391 insertions(+), 79 deletions(-) create mode 100644 src/libraries/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderByRefs.cs create mode 100644 src/tests/Loader/classloader/RefFields/InvalidCSharp.il create mode 100644 src/tests/Loader/classloader/RefFields/InvalidCSharp.ilproj create mode 100644 src/tests/Loader/classloader/RefFields/Validate.cs create mode 100644 src/tests/Loader/classloader/RefFields/Validate.csproj diff --git a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.cs b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.cs index fe5da8367cdd43..f8b8c1efd35d03 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.cs @@ -233,7 +233,7 @@ private int GetTypeRefNested(Type type, Module? refedModule, string? strRefedMod typeName = UnmangleTypeName(typeName); } - Debug.Assert(!type.IsByRef, "Must not be ByRef."); + Debug.Assert(!type.IsByRef, "Must not be ByRef. Get token from TypeSpec."); Debug.Assert(!type.IsGenericType || type.IsGenericTypeDefinition, "Must not have generic arguments."); ModuleBuilder thisModule = this; @@ -1081,19 +1081,16 @@ private int GetTypeTokenWorkerNoLock(Type type, bool getGenericDefinition) // instructions. Tokens are always relative to the Module. For example, // the token value for System.String is likely to be different from // Module to Module. Calling GetTypeToken will cause a reference to be - // added to the Module. This reference becomes a perminate part of the Module, - // multiple calles to this method with the same class have no additional side affects. - // This function is optimized to use the TypeDef token if Type is within the same module. - // We should also be aware of multiple dynamic modules and multiple implementation of Type!!! - if (type.IsByRef) - { - throw new ArgumentException(SR.Argument_CannotGetTypeTokenForByRef); - } - - if ((type.IsGenericType && (!type.IsGenericTypeDefinition || !getGenericDefinition)) || - type.IsGenericParameter || - type.IsArray || - type.IsPointer) + // added to the Module. This reference becomes a permanent part of the Module, + // multiple calls to this method with the same class have no additional side-effects. + // This function is optimized to use the TypeDef token if the Type is within the + // same module. We should also be aware of multiple dynamic modules and multiple + // implementations of a Type. + if ((type.IsGenericType && (!type.IsGenericTypeDefinition || !getGenericDefinition)) + || type.IsGenericParameter + || type.IsArray + || type.IsPointer + || type.IsByRef) { byte[] sig = SignatureHelper.GetTypeSigToken(this, type).InternalGetSignature(out int length); return GetTokenFromTypeSpec(sig, length); diff --git a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs index 6d9b8121fa6b42..a242ec948896be 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs @@ -1922,7 +1922,9 @@ private EventBuilder DefineEventNoLock(string name, EventAttributes attributes, int tkParent = 0; if (m_typeParent != null) + { tkParent = m_module.GetTypeTokenInternal(m_typeParent); + } ModuleBuilder module = m_module; diff --git a/src/coreclr/utilcode/util.cpp b/src/coreclr/utilcode/util.cpp index 44b5250547689c..bf31761902dcef 100644 --- a/src/coreclr/utilcode/util.cpp +++ b/src/coreclr/utilcode/util.cpp @@ -1806,9 +1806,7 @@ HRESULT validateOneArg( // Validate the referenced type. if(FAILED(hr = validateOneArg(tk, pSig, pulNSentinels, pImport, FALSE))) IfFailGo(hr); break; - case ELEMENT_TYPE_BYREF: //fallthru - if(TypeFromToken(tk)==mdtFieldDef) IfFailGo(VLDTR_E_SIG_BYREFINFIELD); - FALLTHROUGH; + case ELEMENT_TYPE_BYREF: case ELEMENT_TYPE_PINNED: case ELEMENT_TYPE_SZARRAY: // Validate the referenced type. diff --git a/src/coreclr/vm/field.cpp b/src/coreclr/vm/field.cpp index a0e1260976dee8..3855f4a22c0df7 100644 --- a/src/coreclr/vm/field.cpp +++ b/src/coreclr/vm/field.cpp @@ -61,6 +61,8 @@ VOID FieldDesc::Init(mdFieldDef mb, CorElementType FieldType, DWORD dwMemberAttr FieldType == ELEMENT_TYPE_R8 || FieldType == ELEMENT_TYPE_CLASS || FieldType == ELEMENT_TYPE_VALUETYPE || + FieldType == ELEMENT_TYPE_BYREF || + FieldType == ELEMENT_TYPE_TYPEDBYREF || FieldType == ELEMENT_TYPE_PTR || FieldType == ELEMENT_TYPE_FNPTR ); @@ -70,7 +72,8 @@ VOID FieldDesc::Init(mdFieldDef mb, CorElementType FieldType, DWORD dwMemberAttr m_requiresFullMbValue = 0; SetMemberDef(mb); - m_type = FieldType; + // A TypedByRef should be treated like a regular value type. + m_type = FieldType != ELEMENT_TYPE_TYPEDBYREF ? FieldType : ELEMENT_TYPE_VALUETYPE; m_prot = fdFieldAccessMask & dwMemberAttrs; m_isStatic = fIsStatic != 0; m_isRVA = fIsRVA != 0; @@ -81,7 +84,7 @@ VOID FieldDesc::Init(mdFieldDef mb, CorElementType FieldType, DWORD dwMemberAttr #endif _ASSERTE(GetMemberDef() == mb); // no truncation - _ASSERTE(GetFieldType() == FieldType); + _ASSERTE(GetFieldType() == FieldType || (FieldType == ELEMENT_TYPE_TYPEDBYREF && m_type == ELEMENT_TYPE_VALUETYPE)); _ASSERTE(GetFieldProtection() == (fdFieldAccessMask & dwMemberAttrs)); _ASSERTE((BOOL) IsStatic() == (fIsStatic != 0)); } @@ -152,6 +155,7 @@ TypeHandle FieldDesc::LookupFieldTypeHandle(ClassLoadLevel level, BOOL dropGener _ASSERTE(type == ELEMENT_TYPE_CLASS || type == ELEMENT_TYPE_VALUETYPE || type == ELEMENT_TYPE_STRING || + type == ELEMENT_TYPE_TYPEDBYREF || type == ELEMENT_TYPE_SZARRAY || type == ELEMENT_TYPE_VAR ); diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index e28434acabe56e..f02693ae034219 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -9002,9 +9002,6 @@ CorInfoType CEEInfo::getFieldTypeInternal (CORINFO_FIELD_HANDLE fieldHnd, FieldDesc* field = (FieldDesc*) fieldHnd; CorElementType type = field->GetFieldType(); - // TODO should not burn the time to do this for anything but Value Classes - _ASSERTE(type != ELEMENT_TYPE_BYREF); - if (type == ELEMENT_TYPE_I) { PTR_MethodTable enclosingMethodTable = field->GetApproxEnclosingMethodTable(); diff --git a/src/coreclr/vm/methodtablebuilder.cpp b/src/coreclr/vm/methodtablebuilder.cpp index 68d11affa4351f..59566e2e717179 100644 --- a/src/coreclr/vm/methodtablebuilder.cpp +++ b/src/coreclr/vm/methodtablebuilder.cpp @@ -3935,6 +3935,27 @@ VOID MethodTableBuilder::InitializeFieldDescs(FieldDesc *pFieldDescList, break; } + case ELEMENT_TYPE_BYREF: + { + dwLog2FieldSize = LOG2_PTRSIZE; + if (fIsStatic) + { + // Byref-like types cannot be used for static fields + BuildMethodTableThrowException(IDS_CLASSLOAD_BYREFLIKE_STATICFIELD); + } + if (!bmtFP->fIsByRefLikeType) + { + // Non-byref-like types cannot contain byref-like instance fields + BuildMethodTableThrowException(IDS_CLASSLOAD_BYREFLIKE_INSTANCEFIELD); + } + break; + } + + case ELEMENT_TYPE_TYPEDBYREF: + { + goto IS_VALUETYPE; + } + // Class type variable (method type variables aren't allowed in fields) // These only occur in open types used for verification/reflection. case ELEMENT_TYPE_VAR: @@ -4042,7 +4063,10 @@ VOID MethodTableBuilder::InitializeFieldDescs(FieldDesc *pFieldDescList, pByValueClass = (MethodTable *)-1; } } // If 'this' is a value class - + } + // TypedReference shares the rest of the code here +IS_VALUETYPE: + { // It's not self-referential so try to load it if (pByValueClass == NULL) { diff --git a/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx b/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx index f98789424343b4..e9d5e447ee90fc 100644 --- a/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx +++ b/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx @@ -903,9 +903,6 @@ Cannot use function evaluation to create a TypedReference object. - - Cannot get TypeToken for a ByRef type. - Cannot set parent to an interface. diff --git a/src/libraries/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderByRefs.cs b/src/libraries/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderByRefs.cs new file mode 100644 index 00000000000000..01baa3bc010d94 --- /dev/null +++ b/src/libraries/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderByRefs.cs @@ -0,0 +1,21 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Linq; +using Xunit; + +namespace System.Reflection.Emit.Tests +{ + public class MethodBuilderByRefs + { + [Fact] + public void ByRef_Ldtoken() + { + TypeBuilder type = Helpers.DynamicType(TypeAttributes.Public); + MethodBuilder method = type.DefineMethod("TestMethod", MethodAttributes.Public, typeof(Type), Type.EmptyTypes); + ILGenerator ilg = method.GetILGenerator(); + ilg.Emit(OpCodes.Ldtoken, typeof(int).MakeByRefType()); + ilg.Emit(OpCodes.Ret); + } + } +} \ No newline at end of file diff --git a/src/libraries/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineEnum.cs b/src/libraries/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineEnum.cs index 34433ae11f3918..e1d927cfa25b02 100644 --- a/src/libraries/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineEnum.cs +++ b/src/libraries/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineEnum.cs @@ -160,11 +160,11 @@ public void DefineEnum_VoidUnderlyingType_ThrowsArgumentException() } [Fact] - public void DefineEnum_ByRefUnderlyingType_ThrowsCOMExceptionOnCreation() + public void DefineEnum_ByRefUnderlyingType_ThrowsTypeLoadExceptionOnCreation() { ModuleBuilder module = Helpers.DynamicModule(); EnumBuilder enumBuilder = module.DefineEnum("Name", TypeAttributes.Public, typeof(int).MakeByRefType()); - Assert.Throws(() => enumBuilder.CreateTypeInfo()); + Assert.Throws(() => enumBuilder.CreateTypeInfo()); } [Theory] diff --git a/src/libraries/System.Reflection.Emit/tests/System.Reflection.Emit.Tests.csproj b/src/libraries/System.Reflection.Emit/tests/System.Reflection.Emit.Tests.csproj index e5d46e991da82f..d47bdd3466c796 100644 --- a/src/libraries/System.Reflection.Emit/tests/System.Reflection.Emit.Tests.csproj +++ b/src/libraries/System.Reflection.Emit/tests/System.Reflection.Emit.Tests.csproj @@ -33,6 +33,7 @@ + diff --git a/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderAddInterfaceImplementaion.cs b/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderAddInterfaceImplementaion.cs index 8d9adab4662e03..da3e695dcd389c 100644 --- a/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderAddInterfaceImplementaion.cs +++ b/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderAddInterfaceImplementaion.cs @@ -61,13 +61,6 @@ public void AddInterfaceImplementation_NullInterfaceType_ThrowsArgumentNullExcep AssertExtensions.Throws("interfaceType", () => type.AddInterfaceImplementation(null)); } - [Fact] - public void AddInterfaceImplementation_ByRefInterfaceType_ThrowsArgumentExceptioN() - { - TypeBuilder type = Helpers.DynamicType(TypeAttributes.Public); - AssertExtensions.Throws(null, () => type.AddInterfaceImplementation(typeof(int).MakeByRefType())); - } - [Fact] public void AddInterfaceImplementation_TypeAlreadyCreated_ThrowsInvalidOperationException() { diff --git a/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineEvent.cs b/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineEvent.cs index 2c7452339c9e84..59ebb7fc77bb40 100644 --- a/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineEvent.cs +++ b/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineEvent.cs @@ -106,11 +106,11 @@ public void DefineEvent_Invalid(string name, Type eventType, Type exceptionType) } [Fact] - public void DefineEvent_ByRefEventType_ThrowsArgumentException() + public void DefineEvent_ByRefEventType() { TypeBuilder type = Helpers.DynamicType(TypeAttributes.Class | TypeAttributes.Public); - - AssertExtensions.Throws(null, () => type.DefineEvent("Name", EventAttributes.None, typeof(int).MakeByRefType())); + type.DefineEvent("Name", EventAttributes.None, typeof(int).MakeByRefType()); + type.CreateTypeInfo().AsType(); } [Fact] diff --git a/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineField.cs b/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineField.cs index e765a08dcc403d..a09e69f6738adf 100644 --- a/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineField.cs +++ b/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineField.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using Xunit; @@ -112,15 +113,6 @@ public void DefineField_VoidFieldType_ThrowsArgumentException() AssertExtensions.Throws(null, () => type.DefineField("Name", typeof(void), FieldAttributes.Public)); } - [Fact] - public void DefineField_ByRefFieldType_ThrowsCOMExceptionOnCreation() - { - TypeBuilder type = Helpers.DynamicType(TypeAttributes.Public); - type.DefineField("Name", typeof(int).MakeByRefType(), FieldAttributes.Public); - - Assert.Throws(() => type.CreateTypeInfo()); - } - [Theory] [ActiveIssue("https://github.com/dotnet/runtime/issues/2389", TestRuntimes.Mono)] [InlineData((FieldAttributes)(-1), (FieldAttributes)(-38145))] @@ -152,6 +144,69 @@ public void DefineField_DynamicFieldTypeNotCreated_ThrowsTypeLoadException() Assert.Equal(createdFieldType, field.FieldType); } + [Fact] + public void DefineByRefField_Class_ThrowsTypeLoadExceptionOnCreation() + { + TypeBuilder type = Helpers.DynamicType(TypeAttributes.Public); + type.DefineField("Name", typeof(int).MakeByRefType(), FieldAttributes.Public); + + Assert.Throws(() => type.CreateTypeInfo()); + } + + [Fact] + public void DefineByRefField_ValueType_NonByRefLike_ThrowsTypeLoadExceptionOnCreation() + { + TypeBuilder type = Helpers.DynamicType(TypeAttributes.Public, baseType: typeof(ValueType)); + type.DefineField("Name", typeof(int).MakeByRefType(), FieldAttributes.Public); + + Assert.Throws(() => type.CreateTypeInfo()); + } + + [Fact] + public void DefineByRefField_ValueType_ByRefLike() + { + TypeBuilder type = Helpers.DynamicType(TypeAttributes.Public, baseType: typeof(ValueType)); + + // Define type to be ByRefLike + CustomAttributeBuilder ca = new(typeof(IsByRefLikeAttribute).GetConstructors()[0], new object[] { }); + type.SetCustomAttribute(ca); + + type.DefineField("Name", typeof(int).MakeByRefType(), FieldAttributes.Public); + + Type createdType = type.CreateTypeInfo().AsType(); + FieldInfo[] fields = createdType.GetFields(); + Assert.Equal(1, fields.Length); + Assert.True(fields[0].FieldType.IsByRef); + } + + [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/45152")] + public void Instantiate_ValueType_With_ByRefField() + { + TypeBuilder type = Helpers.DynamicType(TypeAttributes.Public, baseType: typeof(ValueType)); + + // Define type to be ByRefLike + CustomAttributeBuilder ca = new(typeof(IsByRefLikeAttribute).GetConstructors()[0], new object[] { }); + type.SetCustomAttribute(ca); + + var field = type.DefineField("Name", typeof(int).MakeByRefType(), FieldAttributes.Public); + + var ctor = type.DefineConstructor(MethodAttributes.Public, CallingConventions.HasThis, new Type[] { typeof(string) }); + { + ILGenerator il = ctor.GetILGenerator(); + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldarga_S, 1); + il.Emit(OpCodes.Stfld, field); + il.Emit(OpCodes.Ret); + } + + Type createdType = type.CreateTypeInfo().AsType(); + + var ctorToCall = createdType.GetConstructor(BindingFlags.Public | BindingFlags.Instance, new[] { typeof(string) }); + var str = "12345"; + ctorToCall.Invoke(new[] { str }); + } + [Fact] public void GetField_TypeNotCreated_ThrowsNotSupportedException() { diff --git a/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineNestedType.cs b/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineNestedType.cs index cf24e8d87adad7..d71506544525d6 100644 --- a/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineNestedType.cs +++ b/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineNestedType.cs @@ -210,15 +210,9 @@ public void DefineNestedType_NullInterface_ThrowsArgumentNullException() AssertExtensions.Throws("interfaces", () => type.DefineNestedType("Name", TypeAttributes.NestedPublic, typeof(object), new Type[] { null })); } - [Fact] - public void DefineNestedType_ByRefInterfaceType_ThrowsArgumentException() - { - TypeBuilder type = Helpers.DynamicType(TypeAttributes.Public); - AssertExtensions.Throws(null, () => type.DefineNestedType("Name", TypeAttributes.NestedPublic, typeof(object), new Type[] { typeof(int).MakeByRefType() })); - } - public static IEnumerable InvalidInterfaceType_TestData() { + yield return new object[] { typeof(int).MakeByRefType() }; yield return new object[] { typeof(EmptyNonGenericClass) }; yield return new object[] { typeof(EmptyNonGenericStruct) }; yield return new object[] { typeof(EmptyGenericClass) }; diff --git a/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderSetParent.cs b/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderSetParent.cs index 8a4e5ace9ec8d7..5c985d52a46769 100644 --- a/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderSetParent.cs +++ b/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderSetParent.cs @@ -56,14 +56,14 @@ public void SetParent_InterfaceType_ThrowsArgumentException(TypeAttributes attri } [Fact] - public void SetParent_ByRefType_ThrowsArgumentExceptionOnCreation() + public void SetParent_ByRefType_ThrowsNotSupportedExceptionOnCreation() { TypeBuilder type = Helpers.DynamicType(TypeAttributes.Public); type.SetParent(typeof(int).MakeByRefType()); Assert.Equal(typeof(int).MakeByRefType(), type.BaseType); - AssertExtensions.Throws(null, () => type.CreateTypeInfo()); + Assert.Throws(() => type.CreateTypeInfo()); } [Fact] diff --git a/src/libraries/System.Reflection.Emit/tests/Utilities.cs b/src/libraries/System.Reflection.Emit/tests/Utilities.cs index 8e1c965e19a274..1e951be849a862 100644 --- a/src/libraries/System.Reflection.Emit/tests/Utilities.cs +++ b/src/libraries/System.Reflection.Emit/tests/Utilities.cs @@ -54,9 +54,16 @@ public static ModuleBuilder DynamicModule(string assemblyName = "TestAssembly", return DynamicAssembly(assemblyName).DefineDynamicModule(moduleName); } - public static TypeBuilder DynamicType(TypeAttributes attributes, string assemblyName = "TestAssembly", string moduleName = "TestModule", string typeName = "TestType") + public static TypeBuilder DynamicType(TypeAttributes attributes, string assemblyName = "TestAssembly", string moduleName = "TestModule", string typeName = "TestType", Type? baseType = null) { - return DynamicModule(assemblyName, moduleName).DefineType(typeName, attributes); + if (baseType is null) + { + return DynamicModule(assemblyName, moduleName).DefineType(typeName, attributes); + } + else + { + return DynamicModule(assemblyName, moduleName).DefineType(typeName, attributes, baseType); + } } public static EnumBuilder DynamicEnum(TypeAttributes visibility, Type underlyingType, string enumName = "TestEnum", string assemblyName = "TestAssembly", string moduleName = "TestModule") diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ILGenerator.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ILGenerator.Mono.cs index 51edf3f6448752..64585857fffc09 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ILGenerator.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ILGenerator.Mono.cs @@ -819,9 +819,6 @@ public virtual void Emit(OpCode opcode, string str) public virtual void Emit(OpCode opcode, Type cls) { - if (cls != null && cls.IsByRef) - throw new ArgumentException("Cannot get TypeToken for a ByRef type."); - make_room(6); ll_emit(opcode); int token = token_gen.GetToken(cls!, opcode != OpCodes.Ldtoken); diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.Mono.cs index 1e73f98f1505f8..1209f517736a40 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.Mono.cs @@ -74,6 +74,7 @@ public sealed partial class TypeBuilder : TypeInfo [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] private TypeInfo? created; + private bool is_byreflike_set; private int state; #endregion @@ -273,8 +274,7 @@ public void AddInterfaceImplementation([DynamicallyAccessedMembers(DynamicallyAc { if (interfaceType == null) throw new ArgumentNullException(nameof(interfaceType)); - if (interfaceType.IsByRef) - throw new ArgumentException(SR.Argument_CannotGetTypeTokenForByRef); + check_not_created(); if (interfaces != null) @@ -838,7 +838,7 @@ private bool has_ctor_method() if (parent != null) { if (parent.IsByRef) - throw new ArgumentException(); + throw new NotSupportedException(); if (IsInterface) throw new TypeLoadException(); } @@ -877,17 +877,6 @@ private bool has_ctor_method() } } - if (fields != null) - { - foreach (FieldBuilder fb in fields) - { - if (fb == null) - continue; - if (fb.FieldType.IsByRef) - throw new COMException(); - } - } - if (methods != null) { bool is_concrete = !IsAbstract; @@ -1544,6 +1533,10 @@ public void SetCustomAttribute(CustomAttributeBuilder customBuilder) { attrs |= TypeAttributes.HasSecurity; } + else if (attrname == "System.Runtime.CompilerServices.IsByRefLikeAttribute") + { + is_byreflike_set = true; + } if (cattrs != null) { @@ -1571,8 +1564,7 @@ public EventBuilder DefineEvent(string name, EventAttributes attributes, Type ev if (eventtype == null) throw new ArgumentNullException(nameof(eventtype)); check_not_created(); - if (eventtype.IsByRef) - throw new ArgumentException(SR.Argument_CannotGetTypeTokenForByRef); + EventBuilder res = new EventBuilder(this, name, attributes, eventtype); if (events != null) { diff --git a/src/mono/mono/metadata/class-init.c b/src/mono/mono/metadata/class-init.c index 2ae4f39dab8554..0d8a74442b4d26 100644 --- a/src/mono/mono/metadata/class-init.c +++ b/src/mono/mono/metadata/class-init.c @@ -364,6 +364,14 @@ mono_class_setup_fields (MonoClass *klass) g_free (type_name); break; } + if (m_type_is_byref (field->type)) { + if (!m_class_is_byreflike (klass)) { + char *class_name = mono_type_get_full_name (klass); + mono_class_set_type_load_failure (klass, "Type %s is not a ByRefLike type so ref field, '%s', is invalid", class_name, field->name); + g_free (class_name); + break; + } + } /* The def_value of fields is compute lazily during vtable creation */ } diff --git a/src/mono/mono/metadata/class.c b/src/mono/mono/metadata/class.c index 895a654cbfeaad..eceb20cf4d0f63 100644 --- a/src/mono/mono/metadata/class.c +++ b/src/mono/mono/metadata/class.c @@ -4626,13 +4626,20 @@ mono_ldtoken_checked (MonoImage *image, guint32 token, MonoClass **handle_class, case MONO_TOKEN_TYPE_REF: case MONO_TOKEN_TYPE_SPEC: { MonoType *type; + MonoClass *klass; if (handle_class) *handle_class = mono_defaults.typehandle_class; type = mono_type_get_checked (image, token, context, error); if (!type) return NULL; - mono_class_init_internal (mono_class_from_mono_type_internal (type)); + klass = mono_class_from_mono_type_internal (type); + mono_class_init_internal (klass); + if (mono_class_has_failure (klass)) { + mono_error_set_for_class_failure (error, klass); + return NULL; + } + /* We return a MonoType* as handle */ return type; } diff --git a/src/mono/mono/metadata/object-internals.h b/src/mono/mono/metadata/object-internals.h index 2be830e375b151..efa4b0624548d6 100644 --- a/src/mono/mono/metadata/object-internals.h +++ b/src/mono/mono/metadata/object-internals.h @@ -1222,6 +1222,7 @@ struct _MonoReflectionTypeBuilder { MonoGenericContainer *generic_container; MonoArray *generic_params; MonoReflectionType *created; + gboolean is_byreflike_set; gint32 state; }; diff --git a/src/mono/mono/metadata/object.c b/src/mono/mono/metadata/object.c index d87fade6e61228..5863a967d544f0 100644 --- a/src/mono/mono/metadata/object.c +++ b/src/mono/mono/metadata/object.c @@ -887,6 +887,7 @@ compute_class_bitmap (MonoClass *klass, gsize *bitmap, int size, int offset, int } else { /* fall through */ } + case MONO_TYPE_TYPEDBYREF: case MONO_TYPE_VALUETYPE: { MonoClass *fclass = mono_class_from_mono_type_internal (field->type); if (m_class_has_references (fclass)) { diff --git a/src/mono/mono/metadata/sre.c b/src/mono/mono/metadata/sre.c index 5a9e16eb81b8f1..62254b3fa2c3e8 100644 --- a/src/mono/mono/metadata/sre.c +++ b/src/mono/mono/metadata/sre.c @@ -3556,6 +3556,11 @@ typebuilder_setup_one_field (MonoDynamicImage *dynamic_image, MonoClass *klass, } } + if (m_type_is_byref (field->type) && !m_class_is_byreflike (klass)) { + mono_error_set_type_load_name (error, NULL, NULL, "Field '%s' is a byref in a non-byref-like type", field->name); + goto leave; + } + if ((fb->attrs & FIELD_ATTRIBUTE_HAS_FIELD_RVA) && (rva_data = fb->rva_data)) { char *base = mono_array_addr_internal (rva_data, char, 0); size_t size = mono_array_length_internal (rva_data); @@ -3857,6 +3862,12 @@ ves_icall_TypeBuilder_create_runtime_class (MonoReflectionTypeBuilderHandle ref_ mono_class_setup_supertypes (klass); mono_class_setup_mono_type (klass); + /* Check if the type is marked as byreflike. + * The IsByRefLike attribute only applies to value types and enums. This matches CoreCLR behavior. + */ + if (klass->enumtype || klass->valuetype) + klass->is_byreflike = MONO_HANDLE_GETVAL (MONO_HANDLE_CAST (MonoReflectionTypeBuilder, ref_tb), is_byreflike_set); + /* enums are done right away */ if (!klass->enumtype) if (!ensure_runtime_vtable (klass, error)) diff --git a/src/tests/Loader/classloader/RefFields/InvalidCSharp.il b/src/tests/Loader/classloader/RefFields/InvalidCSharp.il new file mode 100644 index 00000000000000..b976227547def5 --- /dev/null +++ b/src/tests/Loader/classloader/RefFields/InvalidCSharp.il @@ -0,0 +1,123 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +.assembly extern System.Runtime { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) } + +.assembly InvalidCSharp { } + +.class public auto ansi sealed beforefieldinit InvalidCSharp.InvalidStructWithRefField + extends [System.Runtime]System.ValueType +{ + // Type requires IsByRefLikeAttribute to be valid. + .field public string& invalid +} + +// This is invalid metadata and is unable to be loaded. +// - [field sig] (0x80131815 (VER_E_FIELD_SIG)) +// +// .class public auto ansi sealed beforefieldinit InvalidCSharp.InvalidStructWithStaticRefField +// extends [System.Runtime]System.ValueType +// { +// .custom instance void [System.Runtime]System.Runtime.CompilerServices.IsByRefLikeAttribute::.ctor() = ( +// 01 00 00 00 +// ) +// .field public static string& invalid +// } + +.class public auto ansi sealed beforefieldinit InvalidCSharp.WithRefField + extends [System.Runtime]System.ValueType +{ + .custom instance void [System.Runtime]System.Runtime.CompilerServices.IsByRefLikeAttribute::.ctor() = ( + 01 00 00 00 + ) + .field public string& Str + + .method public hidebysig specialname rtspecialname + instance void .ctor ( + string& + ) cil managed + { + ldarg.0 + ldarg.1 + stfld string& InvalidCSharp.WithRefField::Str + ret + } + + .method public hidebysig + instance bool ConfirmFieldInstance ( + string + ) cil managed + { + ldarg.0 + ldfld string& InvalidCSharp.WithRefField::Str + ldind.ref + ldarg.1 + ceq + ret + } +} + +.class public auto ansi sealed beforefieldinit InvalidCSharp.WithRefStructField + extends [System.Runtime]System.ValueType +{ + .custom instance void [System.Runtime]System.Runtime.CompilerServices.IsByRefLikeAttribute::.ctor() = ( + 01 00 00 00 + ) + .field public valuetype InvalidCSharp.WithRefField& Field + + .method public hidebysig specialname rtspecialname + instance void .ctor ( + valuetype InvalidCSharp.WithRefField& + ) cil managed + { + ldarg.0 + ldarg.1 + stfld valuetype InvalidCSharp.WithRefField& InvalidCSharp.WithRefStructField::Field + ret + } + + .method public hidebysig + instance bool ConfirmFieldInstance ( + valuetype InvalidCSharp.WithRefField& + ) cil managed + { + ldarg.0 + ldfld valuetype InvalidCSharp.WithRefField& InvalidCSharp.WithRefStructField::Field + ldind.ref + ldarg.1 + ldind.ref + ceq + ret + } +} + +.class public auto ansi sealed beforefieldinit InvalidCSharp.WithTypedReferenceField`1 + extends [System.Runtime]System.ValueType +{ + .custom instance void [System.Runtime]System.Runtime.CompilerServices.IsByRefLikeAttribute::.ctor() = ( + 01 00 00 00 + ) + .field public typedref Field + + .method public hidebysig specialname rtspecialname + instance void .ctor ( + !T + ) cil managed + { + ldarg.0 + ldarga.s 1 + mkrefany !T + stfld typedref InvalidCSharp.WithTypedReferenceField`1::Field + ret + } + + .method public hidebysig + instance class [System.Runtime]System.Type GetFieldType () cil managed + { + ldarg.0 + ldfld typedref InvalidCSharp.WithTypedReferenceField`1::Field + refanytype + call class [System.Runtime]System.Type [System.Runtime]System.Type::GetTypeFromHandle(valuetype [System.Runtime]System.RuntimeTypeHandle ) + ret + } +} \ No newline at end of file diff --git a/src/tests/Loader/classloader/RefFields/InvalidCSharp.ilproj b/src/tests/Loader/classloader/RefFields/InvalidCSharp.ilproj new file mode 100644 index 00000000000000..d577c8f9c7a1a1 --- /dev/null +++ b/src/tests/Loader/classloader/RefFields/InvalidCSharp.ilproj @@ -0,0 +1,8 @@ + + + Library + + + + + diff --git a/src/tests/Loader/classloader/RefFields/Validate.cs b/src/tests/Loader/classloader/RefFields/Validate.cs new file mode 100644 index 00000000000000..bffcd53de2f00a --- /dev/null +++ b/src/tests/Loader/classloader/RefFields/Validate.cs @@ -0,0 +1,59 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.IO; +using InvalidCSharp; + +using Xunit; + +class Validate +{ + [Fact] + public static void Validate_Invalid_RefField_Fails() + { + Console.WriteLine($"{nameof(Validate_Invalid_RefField_Fails)}..."); + Assert.Throws(() => { var t = typeof(InvalidStructWithRefField); }); + } + + [Fact] + public static void Validate_RefStructWithRefField_Load() + { + Console.WriteLine($"{nameof(Validate_RefStructWithRefField_Load)}..."); + var t = typeof(WithRefField); + } + + [Fact] + public static void Validate_Create_RefField() + { + var str = nameof(Validate_Create_RefField); + Console.WriteLine($"{str}..."); + + WithRefField s = new(ref str); + Assert.True(s.ConfirmFieldInstance(str)); + + string newStr = new(str); + Assert.False(s.ConfirmFieldInstance(newStr)); + } + + [Fact] + public static void Validate_Create_RefStructField() + { + var str = nameof(Validate_Create_RefStructField); + Console.WriteLine($"{str}..."); + + WithRefField s = new(ref str); + WithRefStructField t = new(ref s); + Assert.True(t.ConfirmFieldInstance(ref s)); + } + + [Fact] + public static void Validate_Create_TypedReferenceRefField() + { + Console.WriteLine($"{nameof(Validate_Create_TypedReferenceRefField)}..."); + + Validate v = new(); + WithTypedReferenceField s = new(v); + Assert.Equal(typeof(Validate), s.GetFieldType()); + } +} \ No newline at end of file diff --git a/src/tests/Loader/classloader/RefFields/Validate.csproj b/src/tests/Loader/classloader/RefFields/Validate.csproj new file mode 100644 index 00000000000000..96fedddd4bdda7 --- /dev/null +++ b/src/tests/Loader/classloader/RefFields/Validate.csproj @@ -0,0 +1,12 @@ + + + true + Exe + + + + + + + + diff --git a/src/tests/issues.targets b/src/tests/issues.targets index 7b718aa15617d3..edf95e8c106f62 100644 --- a/src/tests/issues.targets +++ b/src/tests/issues.targets @@ -1329,7 +1329,7 @@ - + @@ -2589,6 +2589,9 @@ expected failure: overlapped structs fail at AOT compile time, not runtime + + expected failure: unsupported type with ref field fails at AOT compile time, not runtime + https://github.com/dotnet/runtime/issues/57361 From 605ed5d89dc8e3dde2c9d4ca8072f9bd41d54333 Mon Sep 17 00:00:00 2001 From: Egor Chesakov Date: Sun, 23 Jan 2022 14:07:40 -0800 Subject: [PATCH 011/161] Spmi replay asmdiffs mac os arm64 (#64119) * Split unix-arm64 into linux-arm64 and osx-arm64 in src/coreclr/scripts/superpmi-replay.proj * Split unix-arm64 into linux-arm64 and osx-arm64 in src/coreclr/scripts/superpmi-asmdiffs.proj * Add all subdirectories of $(SuperPMIDirectory) as PMIPATH in src/coreclr/scripts/superpmi-collect.proj --- src/coreclr/scripts/superpmi-asmdiffs.proj | 3 ++- src/coreclr/scripts/superpmi-collect.proj | 9 +++++++-- src/coreclr/scripts/superpmi-replay.proj | 3 ++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/coreclr/scripts/superpmi-asmdiffs.proj b/src/coreclr/scripts/superpmi-asmdiffs.proj index aef782d769cb9e..661a60aca831a2 100644 --- a/src/coreclr/scripts/superpmi-asmdiffs.proj +++ b/src/coreclr/scripts/superpmi-asmdiffs.proj @@ -55,7 +55,8 @@ - + + diff --git a/src/coreclr/scripts/superpmi-collect.proj b/src/coreclr/scripts/superpmi-collect.proj index 046a699917fc62..4a6edd8b5923b8 100644 --- a/src/coreclr/scripts/superpmi-collect.proj +++ b/src/coreclr/scripts/superpmi-collect.proj @@ -42,6 +42,11 @@ PmiAssembliesPayload - Path that will be sent to helix machine to run collection on PmiAssembliesDirectory - Path on helix machine itself where superpmi.py will discover the sent assemblies. --> + + + + + %HELIX_PYTHONPATH% $(WorkItemDirectory)\pmiAssembliesDirectory @@ -54,7 +59,7 @@ %HELIX_WORKITEM_UPLOAD_ROOT% $(BUILD_SOURCESDIRECTORY)\artifacts\helixresults - $(SuperPMIDirectory)\superpmi.py collect -log_level DEBUG --$(CollectionType) -pmi_location $(SuperPMIDirectory)\pmi.dll -pmi_path $(SuperPMIDirectory)\crossgen2 + $(SuperPMIDirectory)\superpmi.py collect -log_level DEBUG --$(CollectionType) -pmi_location $(SuperPMIDirectory)\pmi.dll -pmi_path @(PmiPathDirectories->'%(FullPath)', ' ') $HELIX_PYTHONPATH @@ -68,7 +73,7 @@ $HELIX_WORKITEM_UPLOAD_ROOT $(BUILD_SOURCESDIRECTORY)/artifacts/helixresults - $(SuperPMIDirectory)/superpmi.py collect -log_level DEBUG --$(CollectionType) -pmi_location $(SuperPMIDirectory)/pmi.dll -pmi_path $(SuperPMIDirectory)/crossgen2 + $(SuperPMIDirectory)/superpmi.py collect -log_level DEBUG --$(CollectionType) -pmi_location $(SuperPMIDirectory)/pmi.dll -pmi_path @(PmiPathDirectories->'%(FullPath)', ' ') diff --git a/src/coreclr/scripts/superpmi-replay.proj b/src/coreclr/scripts/superpmi-replay.proj index e76a4a3d810e5d..cac87c580fdde4 100644 --- a/src/coreclr/scripts/superpmi-replay.proj +++ b/src/coreclr/scripts/superpmi-replay.proj @@ -55,7 +55,8 @@ - + + From 9d360c9aa24a61da9fc769644102da1b71179911 Mon Sep 17 00:00:00 2001 From: David Wrighton Date: Sun, 23 Jan 2022 14:23:32 -0800 Subject: [PATCH 012/161] Update NativeAOT codegen and Crossgen2 for CreateSpan (#63977) - Make sure FieldRVA pointers remain aligned as required by the code generator - Use the same Packing Size approach as the IL Linker will use (See jbevain/cecil#817 for details) - Compilers that generate CreateSpan will need to follow that trick to be compatible with rewriters. - Provide ECMA spec augment describing packing size detail --- docs/design/specs/Ecma-335-Augments.md | 10 ++++++++++ .../aot/ILCompiler.Compiler/Compiler/Compilation.cs | 3 ++- .../ReadyToRun/CopiedFieldRvaNode.cs | 9 ++++++--- src/tests/JIT/Intrinsics/CreateSpan_il.il | 2 +- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/docs/design/specs/Ecma-335-Augments.md b/docs/design/specs/Ecma-335-Augments.md index 1c52fedd4d84ce..6e1900c1dc6bd0 100644 --- a/docs/design/specs/Ecma-335-Augments.md +++ b/docs/design/specs/Ecma-335-Augments.md @@ -13,6 +13,7 @@ This is a list of additions and edits to be made in ECMA-335 specifications. It - [Static Interface Methods](#static-interface-methods) - [Covariant Return Types](#covariant-return-types) - [Unsigned data conversion with overflow detection](#unsigned-data-conversion-with-overflow-detection) +- [Rules for IL rewriters](#rules-for-il-rewriters) ## Signatures @@ -948,3 +949,12 @@ Conversions from floating-point numbers to integral values truncate the number t on the top of the stack is reinterpreted as an unsigned value before the conversion. Note that integer values of less than 4 bytes are extended to int32 (not native int) on the evaluation stack. + +## Rules for IL Rewriters + +There are apis such as `System.Runtime.CompilerServices.RuntimeHelpers.CreateSpan(...)` which require that the PE file have a particular structure. In particular, that api requires that the associated RVA of a FieldDef which is used to create a span must be naturally aligned over the data type that `CreateSpan` is instantiated over. There are 2 major concerns. + +1. That the RVA be aligned when the PE file is constructed. This may be achieved by whatever means is most convenient for the compiler. +2. That in the presence of IL rewriters that the RVA remains aligned. This section descibes metadata which will be processed by IL rewriters in order to maintain the required alignment. + +In order to maintain alignment, if the field needs alignment to be preserved, the field must be of a type locally defined within the module which has a Pack (§II.10.7) value of the desired alignment. Unlike other uses of the .pack directive, in this circumstance the .pack specifies a minimum alignment. diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Compilation.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Compilation.cs index f3f780e87e060b..d19b60b104c242 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Compilation.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Compilation.cs @@ -143,8 +143,9 @@ public virtual ISymbolNode GetFieldRvaData(FieldDesc field) { // Use the typical field definition in case this is an instantiated generic type field = field.GetTypicalFieldDefinition(); + int fieldTypePack = (field.FieldType as MetadataType)?.GetClassLayout().PackingSize ?? 1; return NodeFactory.ReadOnlyDataBlob(NameMangler.GetMangledFieldName(field), - ((EcmaField)field).GetFieldRvaData(), NodeFactory.Target.PointerSize); + ((EcmaField)field).GetFieldRvaData(), Math.Max(NodeFactory.Target.PointerSize, fieldTypePack)); } } diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CopiedFieldRvaNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CopiedFieldRvaNode.cs index e8596cf24c894a..a8ff518ac7591e 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CopiedFieldRvaNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CopiedFieldRvaNode.cs @@ -46,15 +46,17 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false) } ObjectDataBuilder builder = new ObjectDataBuilder(factory, relocsOnly); - builder.RequireInitialPointerAlignment(); + byte[] rvaData = GetRvaData(factory.Target.PointerSize, out int requiredAlignment); + builder.RequireInitialAlignment(requiredAlignment); builder.AddSymbol(this); - builder.EmitBytes(GetRvaData(factory.Target.PointerSize)); + builder.EmitBytes(rvaData); return builder.ToObjectData(); } - private unsafe byte[] GetRvaData(int targetPointerSize) + private unsafe byte[] GetRvaData(int targetPointerSize, out int requiredAlignment) { int size = 0; + requiredAlignment = targetPointerSize; MetadataReader metadataReader = _module.MetadataReader; BlobReader metadataBlob = new BlobReader(_module.PEReader.GetMetadata().Pointer, _module.PEReader.GetMetadata().Length); @@ -80,6 +82,7 @@ private unsafe byte[] GetRvaData(int targetPointerSize) Debug.Assert(field.HasRva); int currentSize = field.FieldType.GetElementSize().AsInt; + requiredAlignment = Math.Max(requiredAlignment, (field.FieldType as MetadataType)?.GetClassLayout().PackingSize ?? 1); if (currentSize > size) { // We need to handle overlapping fields by reusing blobs based on the rva, and just update diff --git a/src/tests/JIT/Intrinsics/CreateSpan_il.il b/src/tests/JIT/Intrinsics/CreateSpan_il.il index d6a269b6f4d5f4..cd950298337bb8 100644 --- a/src/tests/JIT/Intrinsics/CreateSpan_il.il +++ b/src/tests/JIT/Intrinsics/CreateSpan_il.il @@ -100,7 +100,7 @@ .class explicit ansi sealed nested private '__StaticArrayInitTypeSize=16' extends [System.Runtime]System.ValueType { - .pack 1 + .pack 4 .size 16 } // end of class '__StaticArrayInitTypeSize=16' From 352a6b8d0ded088314e572303e7fec6ac0684c51 Mon Sep 17 00:00:00 2001 From: David Wrighton Date: Sun, 23 Jan 2022 14:25:26 -0800 Subject: [PATCH 013/161] Add alignment to mapped field stream (#63305) * Align MappeFieldDataStream at 8 byte boundary * Add test to verify that the mapped field rva data blob is aligned to ManagedPEBuilder.MappedFieldDataAlignment * Only align when the mapped field data is of size not equal to 0 --- .../PortableExecutable/ManagedTextSection.cs | 16 ++- .../PortableExecutable/PEBuilderTests.cs | 98 ++++++++++++++++++- 2 files changed, 110 insertions(+), 4 deletions(-) diff --git a/src/libraries/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/ManagedTextSection.cs b/src/libraries/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/ManagedTextSection.cs index 33bd80dec21f75..1762b12d928ba0 100644 --- a/src/libraries/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/ManagedTextSection.cs +++ b/src/libraries/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/ManagedTextSection.cs @@ -121,7 +121,7 @@ public ManagedTextSection( public const int MappedFieldDataAlignment = 8; - public int CalculateOffsetToMappedFieldDataStream() + internal int CalculateOffsetToMappedFieldDataStreamUnaligned() { int result = ComputeOffsetToImportTable(); @@ -135,6 +135,16 @@ public int CalculateOffsetToMappedFieldDataStream() return result; } + public int CalculateOffsetToMappedFieldDataStream() + { + int result = CalculateOffsetToMappedFieldDataStreamUnaligned(); + if (MappedFieldDataSize != 0) + { + result = BitArithmetic.Align(result, MappedFieldDataAlignment); + } + return result; + } + internal int ComputeOffsetToDebugDirectory() { Debug.Assert(MetadataSize % 4 == 0); @@ -185,7 +195,7 @@ public int GetEntryPointAddress(int rva) { // TODO: constants return RequiresStartupStub ? - rva + CalculateOffsetToMappedFieldDataStream() - (Is32Bit ? 6 : 10) : + rva + CalculateOffsetToMappedFieldDataStreamUnaligned() - (Is32Bit ? 6 : 10) : 0; } @@ -293,6 +303,8 @@ public void Serialize( // mapped field data: if (mappedFieldDataBuilderOpt != null) { + if (mappedFieldDataBuilderOpt.Count != 0) + builder.Align(MappedFieldDataAlignment); builder.LinkSuffix(mappedFieldDataBuilderOpt); } diff --git a/src/libraries/System.Reflection.Metadata/tests/PortableExecutable/PEBuilderTests.cs b/src/libraries/System.Reflection.Metadata/tests/PortableExecutable/PEBuilderTests.cs index 763e26dbc1811c..c3dab37bbd3590 100644 --- a/src/libraries/System.Reflection.Metadata/tests/PortableExecutable/PEBuilderTests.cs +++ b/src/libraries/System.Reflection.Metadata/tests/PortableExecutable/PEBuilderTests.cs @@ -64,7 +64,8 @@ private static void WritePEImage( Blob mvidFixup = default(Blob), byte[] privateKeyOpt = null, bool publicSigned = false, - Machine machine = 0) + Machine machine = 0, + BlobBuilder? mappedFieldData = null) { var peHeaderBuilder = new PEHeaderBuilder(imageCharacteristics: entryPointHandle.IsNil ? Characteristics.Dll : Characteristics.ExecutableImage, machine: machine); @@ -75,7 +76,8 @@ private static void WritePEImage( ilBuilder, entryPoint: entryPointHandle, flags: CorFlags.ILOnly | (privateKeyOpt != null || publicSigned ? CorFlags.StrongNameSigned : 0), - deterministicIdProvider: content => s_contentId); + deterministicIdProvider: content => s_contentId, + mappedFieldData: mappedFieldData); var peBlob = new BlobBuilder(); @@ -487,6 +489,98 @@ private static MethodDefinitionHandle ComplexEmit(MetadataBuilder metadata, Blob return default(MethodDefinitionHandle); } + [Theory] // Validate FieldRVA alignment on common machine types + [MemberData(nameof(AllMachineTypes))] + public void FieldRVAAlignmentVerify(Machine machine) + { + using (var peStream = new MemoryStream()) + { + var ilBuilder = new BlobBuilder(); + var mappedRVADataBuilder = new BlobBuilder(); + var metadataBuilder = new MetadataBuilder(); + double validationNumber = 0.100001; + var fieldDef = FieldRVAValidationEmit(metadataBuilder, mappedRVADataBuilder, validationNumber); + + WritePEImage(peStream, metadataBuilder, ilBuilder, default(MethodDefinitionHandle), + mappedFieldData: mappedRVADataBuilder, + machine: machine); + + // Validate FieldRVA is aligned as ManagedPEBuilder.MappedFieldDataAlignemnt + peStream.Position = 0; + using (var peReader = new PEReader(peStream, PEStreamOptions.LeaveOpen)) + { + var mdReader = peReader.GetMetadataReader(); + + // Validate that there is only 1 field rva entry + Assert.Equal(1, mdReader.FieldRvaTable.NumberOfRows); + + // Validate that the RVA is aligned properly (which should be at least an 8 byte alignment + Assert.Equal(0, mdReader.FieldRvaTable.GetRva(1) % ManagedPEBuilder.MappedFieldDataAlignment); + + // Validate that the correct data is at the RVA + var fieldRVAData = peReader.GetSectionData(mdReader.FieldRvaTable.GetRva(1)); + Assert.Equal(validationNumber, fieldRVAData.GetReader().ReadDouble()); + } + + VerifyPE(peStream, machine); + } + } + + private static FieldDefinitionHandle FieldRVAValidationEmit(MetadataBuilder metadata, BlobBuilder mappedRVAData, double doubleToWriteAsData) + { + metadata.AddModule( + 0, + metadata.GetOrAddString("ConsoleApplication.exe"), + metadata.GetOrAddGuid(s_guid), + default(GuidHandle), + default(GuidHandle)); + + metadata.AddAssembly( + metadata.GetOrAddString("ConsoleApplication"), + version: new Version(1, 0, 0, 0), + culture: default(StringHandle), + publicKey: metadata.GetOrAddBlob(ImmutableArray.Create(Misc.KeyPair_PublicKey)), + flags: AssemblyFlags.PublicKey, + hashAlgorithm: AssemblyHashAlgorithm.Sha1); + + var mscorlibAssemblyRef = metadata.AddAssemblyReference( + name: metadata.GetOrAddString("mscorlib"), + version: new Version(4, 0, 0, 0), + culture: default(StringHandle), + publicKeyOrToken: metadata.GetOrAddBlob(ImmutableArray.Create(0xB7, 0x7A, 0x5C, 0x56, 0x19, 0x34, 0xE0, 0x89)), + flags: default(AssemblyFlags), + hashValue: default(BlobHandle)); + + var systemObjectTypeRef = metadata.AddTypeReference( + mscorlibAssemblyRef, + metadata.GetOrAddString("System"), + metadata.GetOrAddString("Object")); + + mappedRVAData.WriteDouble(doubleToWriteAsData); + + var rvaFieldSignature = new BlobBuilder(); + + new BlobEncoder(rvaFieldSignature). + FieldSignature().Double(); + + var fieldRVADef = metadata.AddFieldDefinition( + FieldAttributes.Public | FieldAttributes.Static | FieldAttributes.HasFieldRVA, + metadata.GetOrAddString("RvaField"), + metadata.GetOrAddBlob(rvaFieldSignature)); + + metadata.AddFieldRelativeVirtualAddress(fieldRVADef, 0); + + metadata.AddTypeDefinition( + TypeAttributes.Class | TypeAttributes.Public | TypeAttributes.AutoLayout | TypeAttributes.BeforeFieldInit, + metadata.GetOrAddString("ConsoleApplication"), + metadata.GetOrAddString("Program"), + systemObjectTypeRef, + fieldList: fieldRVADef, + methodList: MetadataTokens.MethodDefinitionHandle(1)); + + return fieldRVADef; + } + private class TestResourceSectionBuilder : ResourceSectionBuilder { public TestResourceSectionBuilder() From 1f2116cd60ec0f3e39abbf60d7feedc537e5dfd3 Mon Sep 17 00:00:00 2001 From: Kevin Jones Date: Sun, 23 Jan 2022 18:23:24 -0500 Subject: [PATCH 014/161] Implement hash and HMAC stream one shots This implements hashing and HMAC statics for streams. Additionally, "LiteHmac" and "LiteHash" were introduced. The existing HMAC and hash provider functionality do some bookkeeping we don't need for resetting. Since we do not need to use these hash handles after the digest has been finalized, resetting is unnecessary work. For HMAC, that also means keeping a copy of the key around for some implementations which we don't need to do. The LiteHash and LiteHmac types are implemented as structs with a common interface. To avoid boxing, generics are used and constrained to the interface where possible. The Browser implementation just defers to the existing HashDispenser rather than do anything novel. The HashProviderCng is somewhat specialized in its ability to reset. It did up-front check to determine if the platform supported reusable hash providers, and further had a single implementation for HMAC and Digests. The current Lite hash design requires that they remain separate types. --- .../Interop.Hmac.cs | 10 +- .../ref/System.Security.Cryptography.cs | 50 ++++ .../src/System.Security.Cryptography.csproj | 7 + .../System/Security/Cryptography/HMACMD5.cs | 172 ++++++++++++++ .../System/Security/Cryptography/HMACSHA1.cs | 173 +++++++++++++- .../Security/Cryptography/HMACSHA256.cs | 173 +++++++++++++- .../Security/Cryptography/HMACSHA384.cs | 176 +++++++++++++- .../Security/Cryptography/HMACSHA512.cs | 176 +++++++++++++- .../Cryptography/HashAlgorithmNames.Apple.cs | 19 ++ .../Cryptography/HashAlgorithmNames.cs | 2 +- .../HashProviderDispenser.Apple.cs | 209 +++++----------- .../HashProviderDispenser.OpenSsl.cs | 130 +++------- .../Security/Cryptography/LiteHash.Apple.cs | 215 +++++++++++++++++ .../Security/Cryptography/LiteHash.Browser.cs | 57 +++++ .../Security/Cryptography/LiteHash.Unix.cs | 174 ++++++++++++++ .../Security/Cryptography/LiteHash.Windows.cs | 173 ++++++++++++++ .../Security/Cryptography/LiteHashProvider.cs | 195 +++++++++++++++ .../src/System/Security/Cryptography/MD5.cs | 125 ++++++++++ .../src/System/Security/Cryptography/SHA1.cs | 125 ++++++++++ .../System/Security/Cryptography/SHA256.cs | 125 ++++++++++ .../System/Security/Cryptography/SHA384.cs | 125 ++++++++++ .../System/Security/Cryptography/SHA512.cs | 125 ++++++++++ .../tests/HashAlgorithmTestDriver.cs | 223 +++++++++++------- .../tests/HmacMD5Tests.cs | 100 ++++++++ .../tests/HmacSha1Tests.cs | 102 +++++++- .../tests/HmacSha256Tests.cs | 102 +++++++- .../tests/HmacSha384Tests.cs | 102 +++++++- .../tests/HmacSha512Tests.cs | 102 +++++++- .../tests/HmacTests.cs | 221 +++++++++++++++++ .../tests/MD5Tests.cs | 64 +++++ .../tests/Sha1Tests.cs | 70 ++++++ .../tests/Sha256Tests.cs | 79 +++++++ .../tests/Sha384Tests.cs | 78 +++++- .../tests/Sha512Tests.cs | 85 +++++++ .../tests/StreamHelpers.cs | 147 ++++++++++++ .../System.Security.Cryptography.Tests.csproj | 1 + 36 files changed, 3860 insertions(+), 352 deletions(-) create mode 100644 src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HashAlgorithmNames.Apple.cs create mode 100644 src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/LiteHash.Apple.cs create mode 100644 src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/LiteHash.Browser.cs create mode 100644 src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/LiteHash.Unix.cs create mode 100644 src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/LiteHash.Windows.cs create mode 100644 src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/LiteHashProvider.cs create mode 100644 src/libraries/System.Security.Cryptography/tests/StreamHelpers.cs diff --git a/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Hmac.cs b/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Hmac.cs index 6cf3766ad8ed53..993d6d42ae7517 100644 --- a/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Hmac.cs +++ b/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Hmac.cs @@ -16,7 +16,15 @@ internal static partial class AppleCrypto internal static partial SafeHmacHandle HmacCreate(PAL_HashAlgorithm algorithm, ref int cbDigest); [GeneratedDllImport(Libraries.AppleCryptoNative, EntryPoint = "AppleCryptoNative_HmacInit")] - internal static partial int HmacInit(SafeHmacHandle ctx, byte[] pbKey, int cbKey); + private static unsafe partial int HmacInit(SafeHmacHandle ctx, byte* pbKey, int cbKey); + + internal static unsafe int HmacInit(SafeHmacHandle ctx, ReadOnlySpan key) + { + fixed (byte* pKey = &MemoryMarshal.GetReference(key)) + { + return HmacInit(ctx, pKey, key.Length); + } + } internal static int HmacUpdate(SafeHmacHandle ctx, ReadOnlySpan data) => HmacUpdate(ctx, ref MemoryMarshal.GetReference(data), data.Length); diff --git a/src/libraries/System.Security.Cryptography/ref/System.Security.Cryptography.cs b/src/libraries/System.Security.Cryptography/ref/System.Security.Cryptography.cs index be3a8b7bb3b0b3..e671b178a816b0 100644 --- a/src/libraries/System.Security.Cryptography/ref/System.Security.Cryptography.cs +++ b/src/libraries/System.Security.Cryptography/ref/System.Security.Cryptography.cs @@ -681,8 +681,14 @@ protected override void Dispose(bool disposing) { } protected override void HashCore(byte[] rgb, int ib, int cb) { } protected override void HashCore(System.ReadOnlySpan source) { } public static byte[] HashData(byte[] key, byte[] source) { throw null; } + public static byte[] HashData(byte[] key, System.IO.Stream source) { throw null; } + public static byte[] HashData(System.ReadOnlySpan key, System.IO.Stream source) { throw null; } + public static int HashData(System.ReadOnlySpan key, System.IO.Stream source, System.Span destination) { throw null; } public static byte[] HashData(System.ReadOnlySpan key, System.ReadOnlySpan source) { throw null; } public static int HashData(System.ReadOnlySpan key, System.ReadOnlySpan source, System.Span destination) { throw null; } + public static System.Threading.Tasks.ValueTask HashDataAsync(byte[] key, System.IO.Stream source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.ValueTask HashDataAsync(System.ReadOnlyMemory key, System.IO.Stream source, System.Memory destination, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.ValueTask HashDataAsync(System.ReadOnlyMemory key, System.IO.Stream source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } protected override byte[] HashFinal() { throw null; } public override void Initialize() { } public static bool TryHashData(System.ReadOnlySpan key, System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } @@ -703,8 +709,14 @@ protected override void Dispose(bool disposing) { } protected override void HashCore(byte[] rgb, int ib, int cb) { } protected override void HashCore(System.ReadOnlySpan source) { } public static byte[] HashData(byte[] key, byte[] source) { throw null; } + public static byte[] HashData(byte[] key, System.IO.Stream source) { throw null; } + public static byte[] HashData(System.ReadOnlySpan key, System.IO.Stream source) { throw null; } + public static int HashData(System.ReadOnlySpan key, System.IO.Stream source, System.Span destination) { throw null; } public static byte[] HashData(System.ReadOnlySpan key, System.ReadOnlySpan source) { throw null; } public static int HashData(System.ReadOnlySpan key, System.ReadOnlySpan source, System.Span destination) { throw null; } + public static System.Threading.Tasks.ValueTask HashDataAsync(byte[] key, System.IO.Stream source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.ValueTask HashDataAsync(System.ReadOnlyMemory key, System.IO.Stream source, System.Memory destination, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.ValueTask HashDataAsync(System.ReadOnlyMemory key, System.IO.Stream source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } protected override byte[] HashFinal() { throw null; } public override void Initialize() { } public static bool TryHashData(System.ReadOnlySpan key, System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } @@ -722,8 +734,14 @@ protected override void Dispose(bool disposing) { } protected override void HashCore(byte[] rgb, int ib, int cb) { } protected override void HashCore(System.ReadOnlySpan source) { } public static byte[] HashData(byte[] key, byte[] source) { throw null; } + public static byte[] HashData(byte[] key, System.IO.Stream source) { throw null; } + public static byte[] HashData(System.ReadOnlySpan key, System.IO.Stream source) { throw null; } + public static int HashData(System.ReadOnlySpan key, System.IO.Stream source, System.Span destination) { throw null; } public static byte[] HashData(System.ReadOnlySpan key, System.ReadOnlySpan source) { throw null; } public static int HashData(System.ReadOnlySpan key, System.ReadOnlySpan source, System.Span destination) { throw null; } + public static System.Threading.Tasks.ValueTask HashDataAsync(byte[] key, System.IO.Stream source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.ValueTask HashDataAsync(System.ReadOnlyMemory key, System.IO.Stream source, System.Memory destination, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.ValueTask HashDataAsync(System.ReadOnlyMemory key, System.IO.Stream source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } protected override byte[] HashFinal() { throw null; } public override void Initialize() { } public static bool TryHashData(System.ReadOnlySpan key, System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } @@ -743,8 +761,14 @@ protected override void Dispose(bool disposing) { } protected override void HashCore(byte[] rgb, int ib, int cb) { } protected override void HashCore(System.ReadOnlySpan source) { } public static byte[] HashData(byte[] key, byte[] source) { throw null; } + public static byte[] HashData(byte[] key, System.IO.Stream source) { throw null; } + public static byte[] HashData(System.ReadOnlySpan key, System.IO.Stream source) { throw null; } + public static int HashData(System.ReadOnlySpan key, System.IO.Stream source, System.Span destination) { throw null; } public static byte[] HashData(System.ReadOnlySpan key, System.ReadOnlySpan source) { throw null; } public static int HashData(System.ReadOnlySpan key, System.ReadOnlySpan source, System.Span destination) { throw null; } + public static System.Threading.Tasks.ValueTask HashDataAsync(byte[] key, System.IO.Stream source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.ValueTask HashDataAsync(System.ReadOnlyMemory key, System.IO.Stream source, System.Memory destination, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.ValueTask HashDataAsync(System.ReadOnlyMemory key, System.IO.Stream source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } protected override byte[] HashFinal() { throw null; } public override void Initialize() { } public static bool TryHashData(System.ReadOnlySpan key, System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } @@ -764,8 +788,14 @@ protected override void Dispose(bool disposing) { } protected override void HashCore(byte[] rgb, int ib, int cb) { } protected override void HashCore(System.ReadOnlySpan source) { } public static byte[] HashData(byte[] key, byte[] source) { throw null; } + public static byte[] HashData(byte[] key, System.IO.Stream source) { throw null; } + public static byte[] HashData(System.ReadOnlySpan key, System.IO.Stream source) { throw null; } + public static int HashData(System.ReadOnlySpan key, System.IO.Stream source, System.Span destination) { throw null; } public static byte[] HashData(System.ReadOnlySpan key, System.ReadOnlySpan source) { throw null; } public static int HashData(System.ReadOnlySpan key, System.ReadOnlySpan source, System.Span destination) { throw null; } + public static System.Threading.Tasks.ValueTask HashDataAsync(byte[] key, System.IO.Stream source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.ValueTask HashDataAsync(System.ReadOnlyMemory key, System.IO.Stream source, System.Memory destination, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.ValueTask HashDataAsync(System.ReadOnlyMemory key, System.IO.Stream source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } protected override byte[] HashFinal() { throw null; } public override void Initialize() { } public static bool TryHashData(System.ReadOnlySpan key, System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } @@ -834,8 +864,12 @@ protected MD5() { } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] public static new System.Security.Cryptography.MD5? Create(string algName) { throw null; } public static byte[] HashData(byte[] source) { throw null; } + public static byte[] HashData(System.IO.Stream source) { throw null; } + public static int HashData(System.IO.Stream source, System.Span destination) { throw null; } public static byte[] HashData(System.ReadOnlySpan source) { throw null; } public static int HashData(System.ReadOnlySpan source, System.Span destination) { throw null; } + public static System.Threading.Tasks.ValueTask HashDataAsync(System.IO.Stream source, System.Memory destination, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.ValueTask HashDataAsync(System.IO.Stream source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static bool TryHashData(System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } } public sealed partial class Oid @@ -1197,8 +1231,12 @@ protected SHA1() { } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] public static new System.Security.Cryptography.SHA1? Create(string hashName) { throw null; } public static byte[] HashData(byte[] source) { throw null; } + public static byte[] HashData(System.IO.Stream source) { throw null; } + public static int HashData(System.IO.Stream source, System.Span destination) { throw null; } public static byte[] HashData(System.ReadOnlySpan source) { throw null; } public static int HashData(System.ReadOnlySpan source, System.Span destination) { throw null; } + public static System.Threading.Tasks.ValueTask HashDataAsync(System.IO.Stream source, System.Memory destination, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.ValueTask HashDataAsync(System.IO.Stream source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static bool TryHashData(System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } } [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] @@ -1222,8 +1260,12 @@ protected SHA256() { } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] public static new System.Security.Cryptography.SHA256? Create(string hashName) { throw null; } public static byte[] HashData(byte[] source) { throw null; } + public static byte[] HashData(System.IO.Stream source) { throw null; } + public static int HashData(System.IO.Stream source, System.Span destination) { throw null; } public static byte[] HashData(System.ReadOnlySpan source) { throw null; } public static int HashData(System.ReadOnlySpan source, System.Span destination) { throw null; } + public static System.Threading.Tasks.ValueTask HashDataAsync(System.IO.Stream source, System.Memory destination, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.ValueTask HashDataAsync(System.IO.Stream source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static bool TryHashData(System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } } [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] @@ -1247,8 +1289,12 @@ protected SHA384() { } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] public static new System.Security.Cryptography.SHA384? Create(string hashName) { throw null; } public static byte[] HashData(byte[] source) { throw null; } + public static byte[] HashData(System.IO.Stream source) { throw null; } + public static int HashData(System.IO.Stream source, System.Span destination) { throw null; } public static byte[] HashData(System.ReadOnlySpan source) { throw null; } public static int HashData(System.ReadOnlySpan source, System.Span destination) { throw null; } + public static System.Threading.Tasks.ValueTask HashDataAsync(System.IO.Stream source, System.Memory destination, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.ValueTask HashDataAsync(System.IO.Stream source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static bool TryHashData(System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } } [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] @@ -1272,8 +1318,12 @@ protected SHA512() { } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] public static new System.Security.Cryptography.SHA512? Create(string hashName) { throw null; } public static byte[] HashData(byte[] source) { throw null; } + public static byte[] HashData(System.IO.Stream source) { throw null; } + public static int HashData(System.IO.Stream source, System.Span destination) { throw null; } public static byte[] HashData(System.ReadOnlySpan source) { throw null; } public static int HashData(System.ReadOnlySpan source, System.Span destination) { throw null; } + public static System.Threading.Tasks.ValueTask HashDataAsync(System.IO.Stream source, System.Memory destination, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.ValueTask HashDataAsync(System.IO.Stream source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static bool TryHashData(System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } } [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] diff --git a/src/libraries/System.Security.Cryptography/src/System.Security.Cryptography.csproj b/src/libraries/System.Security.Cryptography/src/System.Security.Cryptography.csproj index 9a268d9a83d9a0..a2a2d2d52ca21c 100644 --- a/src/libraries/System.Security.Cryptography/src/System.Security.Cryptography.csproj +++ b/src/libraries/System.Security.Cryptography/src/System.Security.Cryptography.csproj @@ -278,6 +278,7 @@ + @@ -378,6 +379,7 @@ + + + + + + diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACMD5.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACMD5.cs index 97067a63b3f93c..eff5baa635b8d6 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACMD5.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACMD5.cs @@ -2,7 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics; +using System.IO; using System.Runtime.Versioning; +using System.Threading; +using System.Threading.Tasks; using Internal.Cryptography; namespace System.Security.Cryptography @@ -162,6 +165,175 @@ public static bool TryHashData(ReadOnlySpan key, ReadOnlySpan source return true; } + /// + /// Computes the HMAC of a stream using the MD5 algorithm. + /// + /// The HMAC key. + /// The stream to HMAC. + /// The buffer to receive the HMAC value. + /// The total number of bytes written to . + /// + /// is . + /// + /// + ///

+ /// The buffer in is too small to hold the calculated HMAC + /// size. The MD5 algorithm always produces a 128-bit HMAC, or 16 bytes. + ///

+ ///

-or-

+ ///

+ /// does not support reading. + ///

+ ///
+ public static int HashData(ReadOnlySpan key, Stream source, Span destination) + { + ArgumentNullException.ThrowIfNull(source); + + if (destination.Length < HashSizeInBytes) + throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(destination)); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HmacStream(HashAlgorithmNames.MD5, HashSizeInBytes, key, source, destination); + } + + /// + /// Computes the HMAC of a stream using the MD5 algorithm. + /// + /// The HMAC key. + /// The stream to HMAC. + /// The HMAC of the data. + /// + /// is . + /// + /// + /// does not support reading. + /// + public static byte[] HashData(ReadOnlySpan key, Stream source) + { + ArgumentNullException.ThrowIfNull(source); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HmacStream(HashAlgorithmNames.MD5, HashSizeInBytes, key, source); + } + + /// + /// Computes the HMAC of a stream using the MD5 algorithm. + /// + /// The HMAC key. + /// The stream to HMAC. + /// The HMAC of the data. + /// + /// or is . + /// + /// + /// does not support reading. + /// + public static byte[] HashData(byte[] key, Stream source) + { + ArgumentNullException.ThrowIfNull(key); + return HashData(new ReadOnlySpan(key), source); + } + + /// + /// Asynchronously computes the HMAC of a stream using the MD5 algorithm. + /// + /// The HMAC key. + /// The stream to HMAC. + /// + /// The token to monitor for cancellation requests. + /// The default value is . + /// + /// The HMAC of the data. + /// + /// is . + /// + /// + /// does not support reading. + /// + public static ValueTask HashDataAsync(ReadOnlyMemory key, Stream source, CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(source); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HmacStreamAsync(HashAlgorithmNames.MD5, HashSizeInBytes, key.Span, source, cancellationToken); + } + + /// + /// Asynchronously computes the HMAC of a stream using the MD5 algorithm. + /// + /// The HMAC key. + /// The stream to HMAC. + /// + /// The token to monitor for cancellation requests. + /// The default value is . + /// + /// The HMAC of the data. + /// + /// or is . + /// + /// + /// does not support reading. + /// + public static ValueTask HashDataAsync(byte[] key, Stream source, CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(key); + + return HashDataAsync(new ReadOnlyMemory(key), source, cancellationToken); + } + + /// + /// Asynchronously computes the HMAC of a stream using the MD5 algorithm. + /// + /// The HMAC key. + /// The stream to HMAC. + /// The buffer to receive the HMAC value. + /// + /// The token to monitor for cancellation requests. + /// The default value is . + /// + /// The total number of bytes written to . + /// + /// is . + /// + /// + ///

+ /// The buffer in is too small to hold the calculated hash + /// size. The MD5 algorithm always produces a 128-bit hash, or 16 bytes. + ///

+ ///

-or-

+ ///

+ /// does not support reading. + ///

+ ///
+ public static ValueTask HashDataAsync( + ReadOnlyMemory key, + Stream source, + Memory destination, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(source); + + if (destination.Length < HashSizeInBytes) + throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(destination)); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HmacStreamAsync( + HashAlgorithmNames.MD5, + HashSizeInBytes, + key.Span, + source, + destination, + cancellationToken); + } + protected override void Dispose(bool disposing) { if (disposing) diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACSHA1.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACSHA1.cs index 006898d72c6ac7..cc8d5619da2084 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACSHA1.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACSHA1.cs @@ -2,10 +2,12 @@ // The .NET Foundation licenses this file to you under the MIT license. using Internal.Cryptography; -using System; using System.ComponentModel; using System.Diagnostics; +using System.IO; using System.Runtime.Versioning; +using System.Threading; +using System.Threading.Tasks; namespace System.Security.Cryptography { @@ -171,6 +173,175 @@ public static bool TryHashData(ReadOnlySpan key, ReadOnlySpan source return true; } + /// + /// Computes the HMAC of a stream using the SHA1 algorithm. + /// + /// The HMAC key. + /// The stream to HMAC. + /// The buffer to receive the HMAC value. + /// The total number of bytes written to . + /// + /// is . + /// + /// + ///

+ /// The buffer in is too small to hold the calculated HMAC + /// size. The SHA1 algorithm always produces a 160-bit HMAC, or 20 bytes. + ///

+ ///

-or-

+ ///

+ /// does not support reading. + ///

+ ///
+ public static int HashData(ReadOnlySpan key, Stream source, Span destination) + { + ArgumentNullException.ThrowIfNull(source); + + if (destination.Length < HashSizeInBytes) + throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(destination)); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HmacStream(HashAlgorithmNames.SHA1, HashSizeInBytes, key, source, destination); + } + + /// + /// Computes the HMAC of a stream using the SHA1 algorithm. + /// + /// The HMAC key. + /// The stream to HMAC. + /// The HMAC of the data. + /// + /// is . + /// + /// + /// does not support reading. + /// + public static byte[] HashData(ReadOnlySpan key, Stream source) + { + ArgumentNullException.ThrowIfNull(source); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HmacStream(HashAlgorithmNames.SHA1, HashSizeInBytes, key, source); + } + + /// + /// Computes the HMAC of a stream using the SHA1 algorithm. + /// + /// The HMAC key. + /// The stream to HMAC. + /// The HMAC of the data. + /// + /// or is . + /// + /// + /// does not support reading. + /// + public static byte[] HashData(byte[] key, Stream source) + { + ArgumentNullException.ThrowIfNull(key); + return HashData(new ReadOnlySpan(key), source); + } + + /// + /// Asynchronously computes the HMAC of a stream using the SHA1 algorithm. + /// + /// The HMAC key. + /// The stream to HMAC. + /// + /// The token to monitor for cancellation requests. + /// The default value is . + /// + /// The HMAC of the data. + /// + /// is . + /// + /// + /// does not support reading. + /// + public static ValueTask HashDataAsync(ReadOnlyMemory key, Stream source, CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(source); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HmacStreamAsync(HashAlgorithmNames.SHA1, HashSizeInBytes, key.Span, source, cancellationToken); + } + + /// + /// Asynchronously computes the HMAC of a stream using the SHA1 algorithm. + /// + /// The HMAC key. + /// The stream to HMAC. + /// + /// The token to monitor for cancellation requests. + /// The default value is . + /// + /// The HMAC of the data. + /// + /// or is . + /// + /// + /// does not support reading. + /// + public static ValueTask HashDataAsync(byte[] key, Stream source, CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(key); + + return HashDataAsync(new ReadOnlyMemory(key), source, cancellationToken); + } + + /// + /// Asynchronously computes the HMAC of a stream using the SHA1 algorithm. + /// + /// The HMAC key. + /// The stream to HMAC. + /// The buffer to receive the HMAC value. + /// + /// The token to monitor for cancellation requests. + /// The default value is . + /// + /// The total number of bytes written to . + /// + /// is . + /// + /// + ///

+ /// The buffer in is too small to hold the calculated hash + /// size. The SHA1 algorithm always produces a 160-bit hash, or 20 bytes. + ///

+ ///

-or-

+ ///

+ /// does not support reading. + ///

+ ///
+ public static ValueTask HashDataAsync( + ReadOnlyMemory key, + Stream source, + Memory destination, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(source); + + if (destination.Length < HashSizeInBytes) + throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(destination)); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HmacStreamAsync( + HashAlgorithmNames.SHA1, + HashSizeInBytes, + key.Span, + source, + destination, + cancellationToken); + } + protected override void Dispose(bool disposing) { if (disposing) diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACSHA256.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACSHA256.cs index 0cb3ff2ab423da..797f60dd3b49b0 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACSHA256.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACSHA256.cs @@ -3,8 +3,10 @@ using Internal.Cryptography; using System.Diagnostics; +using System.IO; using System.Runtime.Versioning; -using System.Security.Cryptography; +using System.Threading; +using System.Threading.Tasks; namespace System.Security.Cryptography { @@ -163,6 +165,175 @@ public static bool TryHashData(ReadOnlySpan key, ReadOnlySpan source return true; } + /// + /// Computes the HMAC of a stream using the SHA256 algorithm. + /// + /// The HMAC key. + /// The stream to HMAC. + /// The buffer to receive the HMAC value. + /// The total number of bytes written to . + /// + /// is . + /// + /// + ///

+ /// The buffer in is too small to hold the calculated HMAC + /// size. The SHA256 algorithm always produces a 256-bit HMAC, or 32 bytes. + ///

+ ///

-or-

+ ///

+ /// does not support reading. + ///

+ ///
+ public static int HashData(ReadOnlySpan key, Stream source, Span destination) + { + ArgumentNullException.ThrowIfNull(source); + + if (destination.Length < HashSizeInBytes) + throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(destination)); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HmacStream(HashAlgorithmNames.SHA256, HashSizeInBytes, key, source, destination); + } + + /// + /// Computes the HMAC of a stream using the SHA256 algorithm. + /// + /// The HMAC key. + /// The stream to HMAC. + /// The HMAC of the data. + /// + /// is . + /// + /// + /// does not support reading. + /// + public static byte[] HashData(ReadOnlySpan key, Stream source) + { + ArgumentNullException.ThrowIfNull(source); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HmacStream(HashAlgorithmNames.SHA256, HashSizeInBytes, key, source); + } + + /// + /// Computes the HMAC of a stream using the SHA256 algorithm. + /// + /// The HMAC key. + /// The stream to HMAC. + /// The HMAC of the data. + /// + /// or is . + /// + /// + /// does not support reading. + /// + public static byte[] HashData(byte[] key, Stream source) + { + ArgumentNullException.ThrowIfNull(key); + return HashData(new ReadOnlySpan(key), source); + } + + /// + /// Asynchronously computes the HMAC of a stream using the SHA256 algorithm. + /// + /// The HMAC key. + /// The stream to HMAC. + /// + /// The token to monitor for cancellation requests. + /// The default value is . + /// + /// The HMAC of the data. + /// + /// is . + /// + /// + /// does not support reading. + /// + public static ValueTask HashDataAsync(ReadOnlyMemory key, Stream source, CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(source); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HmacStreamAsync(HashAlgorithmNames.SHA256, HashSizeInBytes, key.Span, source, cancellationToken); + } + + /// + /// Asynchronously computes the HMAC of a stream using the SHA256 algorithm. + /// + /// The HMAC key. + /// The stream to HMAC. + /// + /// The token to monitor for cancellation requests. + /// The default value is . + /// + /// The HMAC of the data. + /// + /// or is . + /// + /// + /// does not support reading. + /// + public static ValueTask HashDataAsync(byte[] key, Stream source, CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(key); + + return HashDataAsync(new ReadOnlyMemory(key), source, cancellationToken); + } + + /// + /// Asynchronously computes the HMAC of a stream using the SHA256 algorithm. + /// + /// The HMAC key. + /// The stream to HMAC. + /// The buffer to receive the HMAC value. + /// + /// The token to monitor for cancellation requests. + /// The default value is . + /// + /// The total number of bytes written to . + /// + /// is . + /// + /// + ///

+ /// The buffer in is too small to hold the calculated hash + /// size. The SHA256 algorithm always produces a 256-bit hash, or 32 bytes. + ///

+ ///

-or-

+ ///

+ /// does not support reading. + ///

+ ///
+ public static ValueTask HashDataAsync( + ReadOnlyMemory key, + Stream source, + Memory destination, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(source); + + if (destination.Length < HashSizeInBytes) + throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(destination)); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HmacStreamAsync( + HashAlgorithmNames.SHA256, + HashSizeInBytes, + key.Span, + source, + destination, + cancellationToken); + } + protected override void Dispose(bool disposing) { if (disposing) diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACSHA384.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACSHA384.cs index db9781f1fea2b1..1162850933c35e 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACSHA384.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACSHA384.cs @@ -1,11 +1,12 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using Internal.Cryptography; -using System; using System.Diagnostics; +using System.IO; using System.Runtime.Versioning; -using System.Security.Cryptography; +using System.Threading; +using System.Threading.Tasks; +using Internal.Cryptography; namespace System.Security.Cryptography { @@ -181,6 +182,175 @@ public static bool TryHashData(ReadOnlySpan key, ReadOnlySpan source return true; } + /// + /// Computes the HMAC of a stream using the SHA384 algorithm. + /// + /// The HMAC key. + /// The stream to HMAC. + /// The buffer to receive the HMAC value. + /// The total number of bytes written to . + /// + /// is . + /// + /// + ///

+ /// The buffer in is too small to hold the calculated HMAC + /// size. The SHA384 algorithm always produces a 384-bit HMAC, or 48 bytes. + ///

+ ///

-or-

+ ///

+ /// does not support reading. + ///

+ ///
+ public static int HashData(ReadOnlySpan key, Stream source, Span destination) + { + ArgumentNullException.ThrowIfNull(source); + + if (destination.Length < HashSizeInBytes) + throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(destination)); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HmacStream(HashAlgorithmNames.SHA384, HashSizeInBytes, key, source, destination); + } + + /// + /// Computes the HMAC of a stream using the SHA384 algorithm. + /// + /// The HMAC key. + /// The stream to HMAC. + /// The HMAC of the data. + /// + /// is . + /// + /// + /// does not support reading. + /// + public static byte[] HashData(ReadOnlySpan key, Stream source) + { + ArgumentNullException.ThrowIfNull(source); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HmacStream(HashAlgorithmNames.SHA384, HashSizeInBytes, key, source); + } + + /// + /// Computes the HMAC of a stream using the SHA384 algorithm. + /// + /// The HMAC key. + /// The stream to HMAC. + /// The HMAC of the data. + /// + /// or is . + /// + /// + /// does not support reading. + /// + public static byte[] HashData(byte[] key, Stream source) + { + ArgumentNullException.ThrowIfNull(key); + return HashData(new ReadOnlySpan(key), source); + } + + /// + /// Asynchronously computes the HMAC of a stream using the SHA384 algorithm. + /// + /// The HMAC key. + /// The stream to HMAC. + /// + /// The token to monitor for cancellation requests. + /// The default value is . + /// + /// The HMAC of the data. + /// + /// is . + /// + /// + /// does not support reading. + /// + public static ValueTask HashDataAsync(ReadOnlyMemory key, Stream source, CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(source); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HmacStreamAsync(HashAlgorithmNames.SHA384, HashSizeInBytes, key.Span, source, cancellationToken); + } + + /// + /// Asynchronously computes the HMAC of a stream using the SHA384 algorithm. + /// + /// The HMAC key. + /// The stream to HMAC. + /// + /// The token to monitor for cancellation requests. + /// The default value is . + /// + /// The HMAC of the data. + /// + /// or is . + /// + /// + /// does not support reading. + /// + public static ValueTask HashDataAsync(byte[] key, Stream source, CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(key); + + return HashDataAsync(new ReadOnlyMemory(key), source, cancellationToken); + } + + /// + /// Asynchronously computes the HMAC of a stream using the SHA384 algorithm. + /// + /// The HMAC key. + /// The stream to HMAC. + /// The buffer to receive the HMAC value. + /// + /// The token to monitor for cancellation requests. + /// The default value is . + /// + /// The total number of bytes written to . + /// + /// is . + /// + /// + ///

+ /// The buffer in is too small to hold the calculated hash + /// size. The SHA384 algorithm always produces a 384-bit hash, or 48 bytes. + ///

+ ///

-or-

+ ///

+ /// does not support reading. + ///

+ ///
+ public static ValueTask HashDataAsync( + ReadOnlyMemory key, + Stream source, + Memory destination, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(source); + + if (destination.Length < HashSizeInBytes) + throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(destination)); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HmacStreamAsync( + HashAlgorithmNames.SHA384, + HashSizeInBytes, + key.Span, + source, + destination, + cancellationToken); + } + protected override void Dispose(bool disposing) { if (disposing) diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACSHA512.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACSHA512.cs index ee743669edf8ae..079798b459a2b7 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACSHA512.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACSHA512.cs @@ -1,11 +1,12 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using Internal.Cryptography; -using System; using System.Diagnostics; +using System.IO; using System.Runtime.Versioning; -using System.Security.Cryptography; +using System.Threading; +using System.Threading.Tasks; +using Internal.Cryptography; namespace System.Security.Cryptography { @@ -178,6 +179,175 @@ public static bool TryHashData(ReadOnlySpan key, ReadOnlySpan source return true; } + /// + /// Computes the HMAC of a stream using the SHA512 algorithm. + /// + /// The HMAC key. + /// The stream to HMAC. + /// The buffer to receive the HMAC value. + /// The total number of bytes written to . + /// + /// is . + /// + /// + ///

+ /// The buffer in is too small to hold the calculated HMAC + /// size. The SHA512 algorithm always produces a 512-bit HMAC, or 64 bytes. + ///

+ ///

-or-

+ ///

+ /// does not support reading. + ///

+ ///
+ public static int HashData(ReadOnlySpan key, Stream source, Span destination) + { + ArgumentNullException.ThrowIfNull(source); + + if (destination.Length < HashSizeInBytes) + throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(destination)); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HmacStream(HashAlgorithmNames.SHA512, HashSizeInBytes, key, source, destination); + } + + /// + /// Computes the HMAC of a stream using the SHA512 algorithm. + /// + /// The HMAC key. + /// The stream to HMAC. + /// The HMAC of the data. + /// + /// is . + /// + /// + /// does not support reading. + /// + public static byte[] HashData(ReadOnlySpan key, Stream source) + { + ArgumentNullException.ThrowIfNull(source); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HmacStream(HashAlgorithmNames.SHA512, HashSizeInBytes, key, source); + } + + /// + /// Computes the HMAC of a stream using the SHA512 algorithm. + /// + /// The HMAC key. + /// The stream to HMAC. + /// The HMAC of the data. + /// + /// or is . + /// + /// + /// does not support reading. + /// + public static byte[] HashData(byte[] key, Stream source) + { + ArgumentNullException.ThrowIfNull(key); + return HashData(new ReadOnlySpan(key), source); + } + + /// + /// Asynchronously computes the HMAC of a stream using the SHA512 algorithm. + /// + /// The HMAC key. + /// The stream to HMAC. + /// + /// The token to monitor for cancellation requests. + /// The default value is . + /// + /// The HMAC of the data. + /// + /// is . + /// + /// + /// does not support reading. + /// + public static ValueTask HashDataAsync(ReadOnlyMemory key, Stream source, CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(source); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HmacStreamAsync(HashAlgorithmNames.SHA512, HashSizeInBytes, key.Span, source, cancellationToken); + } + + /// + /// Asynchronously computes the HMAC of a stream using the SHA512 algorithm. + /// + /// The HMAC key. + /// The stream to HMAC. + /// + /// The token to monitor for cancellation requests. + /// The default value is . + /// + /// The HMAC of the data. + /// + /// or is . + /// + /// + /// does not support reading. + /// + public static ValueTask HashDataAsync(byte[] key, Stream source, CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(key); + + return HashDataAsync(new ReadOnlyMemory(key), source, cancellationToken); + } + + /// + /// Asynchronously computes the HMAC of a stream using the SHA512 algorithm. + /// + /// The HMAC key. + /// The stream to HMAC. + /// The buffer to receive the HMAC value. + /// + /// The token to monitor for cancellation requests. + /// The default value is . + /// + /// The total number of bytes written to . + /// + /// is . + /// + /// + ///

+ /// The buffer in is too small to hold the calculated hash + /// size. The SHA512 algorithm always produces a 512-bit hash, or 64 bytes. + ///

+ ///

-or-

+ ///

+ /// does not support reading. + ///

+ ///
+ public static ValueTask HashDataAsync( + ReadOnlyMemory key, + Stream source, + Memory destination, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(source); + + if (destination.Length < HashSizeInBytes) + throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(destination)); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HmacStreamAsync( + HashAlgorithmNames.SHA512, + HashSizeInBytes, + key.Span, + source, + destination, + cancellationToken); + } + protected override void Dispose(bool disposing) { if (disposing) diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HashAlgorithmNames.Apple.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HashAlgorithmNames.Apple.cs new file mode 100644 index 00000000000000..3cc658ee231648 --- /dev/null +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HashAlgorithmNames.Apple.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using PAL_HashAlgorithm = Interop.AppleCrypto.PAL_HashAlgorithm; + +namespace System.Security.Cryptography +{ + internal static partial class HashAlgorithmNames + { + internal static PAL_HashAlgorithm HashAlgorithmToPal(string hashAlgorithmId) => hashAlgorithmId switch { + HashAlgorithmNames.MD5 => PAL_HashAlgorithm.Md5, + HashAlgorithmNames.SHA1 => PAL_HashAlgorithm.Sha1, + HashAlgorithmNames.SHA256 => PAL_HashAlgorithm.Sha256, + HashAlgorithmNames.SHA384 => PAL_HashAlgorithm.Sha384, + HashAlgorithmNames.SHA512 => PAL_HashAlgorithm.Sha512, + _ => throw new CryptographicException(SR.Format(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithmId)) + }; + } +} diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HashAlgorithmNames.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HashAlgorithmNames.cs index dc0a42f78ac8d3..24cb46bdc2fd50 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HashAlgorithmNames.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HashAlgorithmNames.cs @@ -5,7 +5,7 @@ namespace System.Security.Cryptography { - internal static class HashAlgorithmNames + internal static partial class HashAlgorithmNames { // These are accepted by CNG public const string MD5 = "MD5"; diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HashProviderDispenser.Apple.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HashProviderDispenser.Apple.cs index fa80816a75abfb..296cafef903597 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HashProviderDispenser.Apple.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HashProviderDispenser.Apple.cs @@ -5,31 +5,22 @@ using System.Security.Cryptography.Apple; using Internal.Cryptography; +using PAL_HashAlgorithm = Interop.AppleCrypto.PAL_HashAlgorithm; + namespace System.Security.Cryptography { internal static partial class HashProviderDispenser { public static HashProvider CreateHashProvider(string hashAlgorithmId) { - Interop.AppleCrypto.PAL_HashAlgorithm algorithm = HashAlgorithmToPal(hashAlgorithmId); - return new AppleDigestProvider(algorithm); + return new AppleDigestProvider(hashAlgorithmId); } public static HashProvider CreateMacProvider(string hashAlgorithmId, ReadOnlySpan key) { - Interop.AppleCrypto.PAL_HashAlgorithm algorithm = HashAlgorithmToPal(hashAlgorithmId); - return new AppleHmacProvider(algorithm, key); + return new AppleHmacProvider(hashAlgorithmId, key); } - private static Interop.AppleCrypto.PAL_HashAlgorithm HashAlgorithmToPal(string hashAlgorithmId) => hashAlgorithmId switch { - HashAlgorithmNames.MD5 => Interop.AppleCrypto.PAL_HashAlgorithm.Md5, - HashAlgorithmNames.SHA1 => Interop.AppleCrypto.PAL_HashAlgorithm.Sha1, - HashAlgorithmNames.SHA256 => Interop.AppleCrypto.PAL_HashAlgorithm.Sha256, - HashAlgorithmNames.SHA384 => Interop.AppleCrypto.PAL_HashAlgorithm.Sha384, - HashAlgorithmNames.SHA512 => Interop.AppleCrypto.PAL_HashAlgorithm.Sha512, - _ => throw new CryptographicException(SR.Format(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithmId)) - }; - internal static class OneShotHashProvider { public static unsafe int MacData( @@ -38,7 +29,7 @@ public static unsafe int MacData( ReadOnlySpan source, Span destination) { - Interop.AppleCrypto.PAL_HashAlgorithm algorithm = HashAlgorithmToPal(hashAlgorithmId); + Interop.AppleCrypto.PAL_HashAlgorithm algorithm = HashAlgorithmNames.HashAlgorithmToPal(hashAlgorithmId); fixed (byte* pKey = key) fixed (byte* pSource = source) @@ -69,7 +60,7 @@ public static unsafe int MacData( public static unsafe int HashData(string hashAlgorithmId, ReadOnlySpan source, Span destination) { - Interop.AppleCrypto.PAL_HashAlgorithm algorithm = HashAlgorithmToPal(hashAlgorithmId); + Interop.AppleCrypto.PAL_HashAlgorithm algorithm = HashAlgorithmNames.HashAlgorithmToPal(hashAlgorithmId); fixed (byte* pSource = source) fixed (byte* pDestination = destination) @@ -96,205 +87,117 @@ public static unsafe int HashData(string hashAlgorithmId, ReadOnlySpan sou } } - private sealed class AppleHmacProvider : HashProvider + private sealed class AppleDigestProvider : HashProvider { - private readonly byte[] _key; - private readonly SafeHmacHandle _ctx; - + private readonly LiteHash _liteHash; private bool _running; - public override int HashSizeInBytes { get; } - - internal AppleHmacProvider(Interop.AppleCrypto.PAL_HashAlgorithm algorithm, ReadOnlySpan key) + public AppleDigestProvider(string hashAlgorithmId) { - _key = key.ToArray(); - int hashSizeInBytes = 0; - _ctx = Interop.AppleCrypto.HmacCreate(algorithm, ref hashSizeInBytes); - - if (hashSizeInBytes < 0) - { - _ctx.Dispose(); - throw new PlatformNotSupportedException( - SR.Format( - SR.Cryptography_UnknownHashAlgorithm, - Enum.GetName(typeof(Interop.AppleCrypto.PAL_HashAlgorithm), algorithm))); - } - - if (_ctx.IsInvalid) - { - _ctx.Dispose(); - throw new CryptographicException(); - } - - HashSizeInBytes = hashSizeInBytes; + _liteHash = LiteHashProvider.CreateHash(hashAlgorithmId); } public override void AppendHashData(ReadOnlySpan data) { - if (!_running) - { - SetKey(); - } - - if (Interop.AppleCrypto.HmacUpdate(_ctx, data) != 1) - { - throw new CryptographicException(); - } - } - - private void SetKey() - { - if (Interop.AppleCrypto.HmacInit(_ctx, _key, _key.Length) != 1) - { - throw new CryptographicException(); - } - + _liteHash.Append(data); _running = true; } - public override unsafe int FinalizeHashAndReset(Span destination) + public override int FinalizeHashAndReset(Span destination) { - Debug.Assert(destination.Length >= HashSizeInBytes); - - if (!_running) - { - SetKey(); - } - - if (Interop.AppleCrypto.HmacFinal(_ctx, destination) != 1) - { - throw new CryptographicException(); - } - + int written = _liteHash.Finalize(destination); + // Apple's DigestFinal self-resets, so don't bother calling reset. _running = false; - return HashSizeInBytes; + return written; } - public override unsafe int GetCurrentHash(Span destination) + public override int GetCurrentHash(Span destination) { - Debug.Assert(destination.Length >= HashSizeInBytes); + return _liteHash.Current(destination); + } - if (!_running) - { - SetKey(); - } + public override int HashSizeInBytes => _liteHash.HashSizeInBytes; - if (Interop.AppleCrypto.HmacCurrent(_ctx, destination) != 1) + public override void Dispose(bool disposing) + { + if (disposing) { - throw new CryptographicException(); + _liteHash.Dispose(); } - - return HashSizeInBytes; } - public override void Dispose(bool disposing) + public override void Reset() { - if (disposing) + if (_running) { - _ctx?.Dispose(); - Array.Clear(_key); + _liteHash.Reset(); + _running = false; } } - - public override void Reset() => _running = false; } - private sealed class AppleDigestProvider : HashProvider + private sealed class AppleHmacProvider : HashProvider { - private readonly SafeDigestCtxHandle _ctx; + private readonly LiteHmac _liteHmac; + private readonly byte[] _key; private bool _running; - public override int HashSizeInBytes { get; } - - internal AppleDigestProvider(Interop.AppleCrypto.PAL_HashAlgorithm algorithm) + public AppleHmacProvider(string hashAlgorithmId, ReadOnlySpan key) { - int hashSizeInBytes; - _ctx = Interop.AppleCrypto.DigestCreate(algorithm, out hashSizeInBytes); - - if (hashSizeInBytes < 0) - { - _ctx.Dispose(); - throw new PlatformNotSupportedException( - SR.Format( - SR.Cryptography_UnknownHashAlgorithm, - Enum.GetName(typeof(Interop.AppleCrypto.PAL_HashAlgorithm), algorithm))); - } - - if (_ctx.IsInvalid) - { - _ctx.Dispose(); - throw new CryptographicException(); - } - - HashSizeInBytes = hashSizeInBytes; + PAL_HashAlgorithm algorithm = HashAlgorithmNames.HashAlgorithmToPal(hashAlgorithmId); + _liteHmac = new LiteHmac(algorithm, key, preinitialize: false); + _key = key.ToArray(); } public override void AppendHashData(ReadOnlySpan data) { - _running = true; - int ret = Interop.AppleCrypto.DigestUpdate(_ctx, data); - - if (ret != 1) + if (!_running) { - Debug.Assert(ret == 0, $"DigestUpdate return value {ret} was not 0 or 1"); - throw new CryptographicException(); + _liteHmac.Reset(_key); } + + _liteHmac.Append(data); + _running = true; } public override int FinalizeHashAndReset(Span destination) { - Debug.Assert(destination.Length >= HashSizeInBytes); - - int ret = Interop.AppleCrypto.DigestFinal(_ctx, destination); - _running = false; - - if (ret != 1) + if (!_running) { - Debug.Assert(ret == 0, $"DigestFinal return value {ret} was not 0 or 1"); - throw new CryptographicException(); + _liteHmac.Reset(_key); } - return HashSizeInBytes; + int written = _liteHmac.Finalize(destination); + _liteHmac.Reset(_key); + _running = false; + return written; } public override int GetCurrentHash(Span destination) { - Debug.Assert(destination.Length >= HashSizeInBytes); - - int ret = Interop.AppleCrypto.DigestCurrent(_ctx, destination); - - if (ret != 1) + if (!_running) { - Debug.Assert(ret == 0, $"DigestFinal return value {ret} was not 0 or 1"); - throw new CryptographicException(); + _liteHmac.Reset(_key); } - return HashSizeInBytes; + return _liteHmac.Current(destination); } - public override void Reset() - { - if (_running) - { - int ret = Interop.AppleCrypto.DigestReset(_ctx); - - if (ret != 1) - { - Debug.Assert(ret == 0, $"DigestReset return value {ret} was not 0 or 1"); - throw new CryptographicException(); - } - - _running = false; - } - } + public override int HashSizeInBytes => _liteHmac.HashSizeInBytes; public override void Dispose(bool disposing) { if (disposing) { - _ctx?.Dispose(); + _liteHmac.Dispose(); + Array.Clear(_key); } } + + public override void Reset() + { + _running = false; + } } } } diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HashProviderDispenser.OpenSsl.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HashProviderDispenser.OpenSsl.cs index db75677b66ae8f..32cdc7dd93b1cc 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HashProviderDispenser.OpenSsl.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HashProviderDispenser.OpenSsl.cs @@ -14,14 +14,12 @@ internal static partial class HashProviderDispenser { internal static HashProvider CreateHashProvider(string hashAlgorithmId) { - IntPtr evpType = Interop.Crypto.HashAlgorithmToEvp(hashAlgorithmId); - return new EvpHashProvider(evpType); + return new EvpHashProvider(hashAlgorithmId); } internal static HashProvider CreateMacProvider(string hashAlgorithmId, ReadOnlySpan key) { - IntPtr evpType = Interop.Crypto.HashAlgorithmToEvp(hashAlgorithmId); - return new HmacHashProvider(evpType, key); + return new HmacHashProvider(hashAlgorithmId, key); } internal static class OneShotHashProvider @@ -61,8 +59,16 @@ public static unsafe int HashData(string hashAlgorithmId, ReadOnlySpan sou fixed (byte* pSource = source) fixed (byte* pDestination = destination) { + const int Success = 1; uint length = (uint)destination.Length; - Check(Interop.Crypto.EvpDigestOneShot(evpType, pSource, source.Length, pDestination, &length)); + int ret = Interop.Crypto.EvpDigestOneShot(evpType, pSource, source.Length, pDestination, &length); + + if (ret != Success) + { + Debug.Assert(ret == 0); + throw Interop.Crypto.CreateOpenSslCryptographicException(); + } + Debug.Assert(length == hashSize); } @@ -72,71 +78,40 @@ public static unsafe int HashData(string hashAlgorithmId, ReadOnlySpan sou private sealed class EvpHashProvider : HashProvider { - private readonly IntPtr _algorithmEvp; - private readonly int _hashSize; - private readonly SafeEvpMdCtxHandle _ctx; + private readonly LiteHash _liteHash; private bool _running; - public EvpHashProvider(IntPtr algorithmEvp) + public EvpHashProvider(string hashAlgorithmId) { - _algorithmEvp = algorithmEvp; - Debug.Assert(algorithmEvp != IntPtr.Zero); - - _hashSize = Interop.Crypto.EvpMdSize(_algorithmEvp); - if (_hashSize <= 0 || _hashSize > Interop.Crypto.EVP_MAX_MD_SIZE) - { - throw new CryptographicException(); - } - - _ctx = Interop.Crypto.EvpMdCtxCreate(_algorithmEvp); - - Interop.Crypto.CheckValidOpenSslHandle(_ctx); + _liteHash = LiteHashProvider.CreateHash(hashAlgorithmId); } public override void AppendHashData(ReadOnlySpan data) { - if (data.IsEmpty) - { - return; - } - + _liteHash.Append(data); _running = true; - Check(Interop.Crypto.EvpDigestUpdate(_ctx, data, data.Length)); } public override int FinalizeHashAndReset(Span destination) { - Debug.Assert(destination.Length >= _hashSize); - - uint length = (uint)destination.Length; - Check(Interop.Crypto.EvpDigestFinalEx(_ctx, ref MemoryMarshal.GetReference(destination), ref length)); - Debug.Assert(length == _hashSize); - - // Reset the algorithm provider. - Check(Interop.Crypto.EvpDigestReset(_ctx, _algorithmEvp)); + int written = _liteHash.Finalize(destination); + _liteHash.Reset(); _running = false; - - return _hashSize; + return written; } public override int GetCurrentHash(Span destination) { - Debug.Assert(destination.Length >= _hashSize); - - uint length = (uint)destination.Length; - Check(Interop.Crypto.EvpDigestCurrent(_ctx, ref MemoryMarshal.GetReference(destination), ref length)); - Debug.Assert(length == _hashSize); - - return _hashSize; + return _liteHash.Current(destination); } - public override int HashSizeInBytes => _hashSize; + public override int HashSizeInBytes => _liteHash.HashSizeInBytes; public override void Dispose(bool disposing) { if (disposing) { - _ctx.Dispose(); + _liteHash.Dispose(); } } @@ -144,7 +119,7 @@ public override void Reset() { if (_running) { - Check(Interop.Crypto.EvpDigestReset(_ctx, _algorithmEvp)); + _liteHash.Reset(); _running = false; } } @@ -152,67 +127,40 @@ public override void Reset() private sealed class HmacHashProvider : HashProvider { - private readonly int _hashSize; - private SafeHmacCtxHandle _hmacCtx; + private readonly LiteHmac _liteHmac; private bool _running; - public HmacHashProvider(IntPtr algorithmEvp, ReadOnlySpan key) + public HmacHashProvider(string hashAlgorithmId, ReadOnlySpan key) { - Debug.Assert(algorithmEvp != IntPtr.Zero); - - _hashSize = Interop.Crypto.EvpMdSize(algorithmEvp); - if (_hashSize <= 0 || _hashSize > Interop.Crypto.EVP_MAX_MD_SIZE) - { - throw new CryptographicException(); - } - - _hmacCtx = Interop.Crypto.HmacCreate(ref MemoryMarshal.GetReference(key), key.Length, algorithmEvp); - Interop.Crypto.CheckValidOpenSslHandle(_hmacCtx); + _liteHmac = LiteHashProvider.CreateHmac(hashAlgorithmId, key); } public override void AppendHashData(ReadOnlySpan data) { - if (data.IsEmpty) - { - return; - } - + _liteHmac.Append(data); _running = true; - Check(Interop.Crypto.HmacUpdate(_hmacCtx, data, data.Length)); } public override int FinalizeHashAndReset(Span destination) { - Debug.Assert(destination.Length >= _hashSize); - - int length = destination.Length; - Check(Interop.Crypto.HmacFinal(_hmacCtx, ref MemoryMarshal.GetReference(destination), ref length)); - Debug.Assert(length == _hashSize); - - Check(Interop.Crypto.HmacReset(_hmacCtx)); + int written = _liteHmac.Finalize(destination); + _liteHmac.Reset(); _running = false; - return _hashSize; + return written; } public override int GetCurrentHash(Span destination) { - Debug.Assert(destination.Length >= _hashSize); - - int length = destination.Length; - Check(Interop.Crypto.HmacCurrent(_hmacCtx, ref MemoryMarshal.GetReference(destination), ref length)); - Debug.Assert(length == _hashSize); - - return _hashSize; + return _liteHmac.Current(destination); } - public override int HashSizeInBytes => _hashSize; + public override int HashSizeInBytes => _liteHmac.HashSizeInBytes; public override void Dispose(bool disposing) { - if (disposing && _hmacCtx != null) + if (disposing) { - _hmacCtx.Dispose(); - _hmacCtx = null!; + _liteHmac.Dispose(); } } @@ -220,20 +168,10 @@ public override void Reset() { if (_running) { - Check(Interop.Crypto.HmacReset(_hmacCtx)); + _liteHmac.Reset(); _running = false; } } } - - private static void Check(int result) - { - const int Success = 1; - if (result != Success) - { - Debug.Assert(result == 0); - throw Interop.Crypto.CreateOpenSslCryptographicException(); - } - } } } diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/LiteHash.Apple.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/LiteHash.Apple.cs new file mode 100644 index 00000000000000..d00b61334320c7 --- /dev/null +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/LiteHash.Apple.cs @@ -0,0 +1,215 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Diagnostics; +using System.Security.Cryptography.Apple; + +using PAL_HashAlgorithm = Interop.AppleCrypto.PAL_HashAlgorithm; + +namespace System.Security.Cryptography +{ + internal static partial class LiteHashProvider + { + internal static LiteHash CreateHash(string hashAlgorithmId) + { + PAL_HashAlgorithm algorithm = HashAlgorithmNames.HashAlgorithmToPal(hashAlgorithmId); + return new LiteHash(algorithm); + } + + internal static LiteHmac CreateHmac(string hashAlgorithmId, ReadOnlySpan key) + { + PAL_HashAlgorithm algorithm = HashAlgorithmNames.HashAlgorithmToPal(hashAlgorithmId); + return new LiteHmac(algorithm, key, preinitialize: true); + } + } + + internal readonly struct LiteHash : ILiteHash + { + private readonly SafeDigestCtxHandle _ctx; + private readonly int _hashSizeInBytes; + + private const int Success = 1; + + public int HashSizeInBytes => _hashSizeInBytes; + + internal LiteHash(PAL_HashAlgorithm algorithm) + { + int hashSizeInBytes; + _ctx = Interop.AppleCrypto.DigestCreate(algorithm, out hashSizeInBytes); + + if (hashSizeInBytes < 0) + { + _ctx.Dispose(); + throw new PlatformNotSupportedException( + SR.Format( + SR.Cryptography_UnknownHashAlgorithm, + Enum.GetName(typeof(PAL_HashAlgorithm), algorithm))); + } + + if (_ctx.IsInvalid) + { + _ctx.Dispose(); + throw new CryptographicException(); + } + + _hashSizeInBytes = hashSizeInBytes; + } + + public void Append(ReadOnlySpan data) + { + if (data.IsEmpty) + { + return; + } + + int ret = Interop.AppleCrypto.DigestUpdate(_ctx, data); + + if (ret != Success) + { + Debug.Assert(ret == 0, $"{nameof(Interop.AppleCrypto.DigestUpdate)} return value {ret} was not 0 or 1"); + throw new CryptographicException(); + } + } + + public int Current(Span destination) + { + Debug.Assert(destination.Length >= _hashSizeInBytes); + + int ret = Interop.AppleCrypto.DigestCurrent(_ctx, destination); + + if (ret != Success) + { + Debug.Assert(ret == 0, $"{nameof(Interop.AppleCrypto.DigestCurrent)} return value {ret} was not 0 or 1"); + throw new CryptographicException(); + } + + return _hashSizeInBytes; + } + + public int Finalize(Span destination) + { + Debug.Assert(destination.Length >= _hashSizeInBytes); + + int ret = Interop.AppleCrypto.DigestFinal(_ctx, destination); + + if (ret != Success) + { + Debug.Assert(ret == 0, $"{nameof(Interop.AppleCrypto.DigestFinal)} return value {ret} was not 0 or 1"); + throw new CryptographicException(); + } + + return _hashSizeInBytes; + } + + public void Reset() + { + int ret = Interop.AppleCrypto.DigestReset(_ctx); + + if (ret != Success) + { + Debug.Assert(ret == 0, $"DigestReset return value {ret} was not 0 or 1"); + throw new CryptographicException(); + } + } + + public void Dispose() + { + _ctx.Dispose(); + } + } + + internal readonly struct LiteHmac : ILiteHash + { + private readonly SafeHmacHandle _ctx; + private readonly int _hashSizeInBytes; + + private const int Success = 1; + + public int HashSizeInBytes => _hashSizeInBytes; + + internal LiteHmac(PAL_HashAlgorithm algorithm, ReadOnlySpan key, bool preinitialize) + { + int hashSizeInBytes = 0; + _ctx = Interop.AppleCrypto.HmacCreate(algorithm, ref hashSizeInBytes); + + if (hashSizeInBytes < 0) + { + _ctx.Dispose(); + throw new PlatformNotSupportedException( + SR.Format( + SR.Cryptography_UnknownHashAlgorithm, + Enum.GetName(typeof(Interop.AppleCrypto.PAL_HashAlgorithm), algorithm))); + } + + if (_ctx.IsInvalid) + { + _ctx.Dispose(); + throw new CryptographicException(); + } + + if (preinitialize) + { + if (Interop.AppleCrypto.HmacInit(_ctx, key) != Success) + { + _ctx.Dispose(); + throw new CryptographicException(); + } + } + + _hashSizeInBytes = hashSizeInBytes; + } + + public void Append(ReadOnlySpan data) + { + if (data.IsEmpty) + { + return; + } + + if (Interop.AppleCrypto.HmacUpdate(_ctx, data) != Success) + { + Debug.Fail($"{nameof(Interop.AppleCrypto.HmacUpdate)} unexpectedly failed."); + throw new CryptographicException(); + } + } + + public int Current(ReadOnlySpan destination) + { + Debug.Assert(destination.Length >= _hashSizeInBytes); + + if (Interop.AppleCrypto.HmacCurrent(_ctx, destination) != Success) + { + Debug.Fail($"{nameof(Interop.AppleCrypto.HmacCurrent)} unexpectedly failed."); + throw new CryptographicException(); + } + + return _hashSizeInBytes; + } + + public int Finalize(Span destination) + { + Debug.Assert(destination.Length >= _hashSizeInBytes); + + if (Interop.AppleCrypto.HmacFinal(_ctx, destination) != Success) + { + Debug.Fail($"{nameof(Interop.AppleCrypto.HmacFinal)} unexpectedly failed."); + throw new CryptographicException(); + } + + return _hashSizeInBytes; + } + + public void Reset(ReadOnlySpan key) + { + if (Interop.AppleCrypto.HmacInit(_ctx, key) != Success) + { + Debug.Fail($"{nameof(Interop.AppleCrypto.HmacInit)} unexpectedly failed."); + } + } + + public void Dispose() + { + _ctx.Dispose(); + } + } +} diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/LiteHash.Browser.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/LiteHash.Browser.cs new file mode 100644 index 00000000000000..706427758605c6 --- /dev/null +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/LiteHash.Browser.cs @@ -0,0 +1,57 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Diagnostics; +using Internal.Cryptography; + +namespace System.Security.Cryptography +{ + internal static partial class LiteHashProvider + { + private static LiteHash CreateHash(string hashAlgorithmId) + { + return new LiteHash(hashAlgorithmId); + } + + private static LiteHmac CreateHmac(string hashAlgorithmId, ReadOnlySpan key) + { + return new LiteHmac(hashAlgorithmId, key); + } + } + + internal readonly struct LiteHash : ILiteHash + { + private readonly HashProvider _provider; + private readonly int _hashSizeInBytes; + + public int HashSizeInBytes => _hashSizeInBytes; + + internal LiteHash(string hashAlgorithmId) + { + _provider = HashProviderDispenser.CreateHashProvider(hashAlgorithmId); + _hashSizeInBytes = _provider.HashSizeInBytes; + } + + public void Append(ReadOnlySpan data) => _provider.AppendHashData(data); + public int Finalize(Span destination) => _provider.FinalizeHashAndReset(destination); + public void Dispose() => _provider.Dispose(); + } + + internal readonly struct LiteHmac : ILiteHash + { + private readonly HashProvider _provider; + private readonly int _hashSizeInBytes; + + public int HashSizeInBytes => _hashSizeInBytes; + + internal LiteHmac(string hashAlgorithmId, ReadOnlySpan key) + { + _provider = HashProviderDispenser.CreateMacProvider(hashAlgorithmId, key); + _hashSizeInBytes = _provider.HashSizeInBytes; + } + + public void Append(ReadOnlySpan data) => _provider.AppendHashData(data); + public int Finalize(Span destination) => _provider.FinalizeHashAndReset(destination); + public void Dispose() => _provider.Dispose(); + } +} diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/LiteHash.Unix.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/LiteHash.Unix.cs new file mode 100644 index 00000000000000..05b55230e14b70 --- /dev/null +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/LiteHash.Unix.cs @@ -0,0 +1,174 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.Win32.SafeHandles; +using System.Diagnostics; +using System.Runtime.InteropServices; + +namespace System.Security.Cryptography +{ + internal static partial class LiteHashProvider + { + internal static LiteHash CreateHash(string hashAlgorithmId) + { + IntPtr algorithm = Interop.Crypto.HashAlgorithmToEvp(hashAlgorithmId); + return new LiteHash(algorithm); + } + + internal static LiteHmac CreateHmac(string hashAlgorithmId, ReadOnlySpan key) + { + IntPtr algorithm = Interop.Crypto.HashAlgorithmToEvp(hashAlgorithmId); + return new LiteHmac(algorithm, key); + } + } + + internal readonly struct LiteHash : ILiteHash + { + private readonly SafeEvpMdCtxHandle _ctx; + private readonly IntPtr _algorithm; + private readonly int _hashSizeInBytes; + + public int HashSizeInBytes => _hashSizeInBytes; + + internal LiteHash(IntPtr algorithm) + { + Debug.Assert(algorithm != IntPtr.Zero); + + _algorithm = algorithm; + _hashSizeInBytes = Interop.Crypto.EvpMdSize(algorithm); + + if (_hashSizeInBytes <= 0 || _hashSizeInBytes > Interop.Crypto.EVP_MAX_MD_SIZE) + { + Debug.Fail($"Unexpected hash '{_hashSizeInBytes}' size from {nameof(Interop.Crypto.EvpMdSize)}."); + throw new CryptographicException(); + } + + _ctx = Interop.Crypto.EvpMdCtxCreate(algorithm); + Interop.Crypto.CheckValidOpenSslHandle(_ctx); + } + + public void Append(ReadOnlySpan data) + { + if (data.IsEmpty) + { + return; + } + + Check(Interop.Crypto.EvpDigestUpdate(_ctx, data, data.Length)); + } + + public int Finalize(Span destination) + { + Debug.Assert(destination.Length >= _hashSizeInBytes); + + uint length = (uint)destination.Length; + Check(Interop.Crypto.EvpDigestFinalEx(_ctx, ref MemoryMarshal.GetReference(destination), ref length)); + + Debug.Assert(length == _hashSizeInBytes); + return _hashSizeInBytes; + } + + public void Reset() + { + Check(Interop.Crypto.EvpDigestReset(_ctx, _algorithm)); + } + + public int Current(Span destination) + { + uint length = (uint)destination.Length; + Check(Interop.Crypto.EvpDigestCurrent(_ctx, ref MemoryMarshal.GetReference(destination), ref length)); + Debug.Assert(length == _hashSizeInBytes); + return _hashSizeInBytes; + } + + public void Dispose() + { + _ctx.Dispose(); + } + + private static void Check(int result) + { + const int Success = 1; + + if (result != Success) + { + Debug.Assert(result == 0); + throw Interop.Crypto.CreateOpenSslCryptographicException(); + } + } + } + + internal readonly struct LiteHmac : ILiteHash + { + private readonly SafeHmacCtxHandle _ctx; + private readonly int _hashSizeInBytes; + + public int HashSizeInBytes => _hashSizeInBytes; + + internal LiteHmac(IntPtr algorithm, ReadOnlySpan key) + { + Debug.Assert(algorithm != IntPtr.Zero); + _hashSizeInBytes = Interop.Crypto.EvpMdSize(algorithm); + + if (_hashSizeInBytes <= 0 || _hashSizeInBytes > Interop.Crypto.EVP_MAX_MD_SIZE) + { + Debug.Fail($"Unexpected hash '{_hashSizeInBytes}' size from {nameof(Interop.Crypto.EvpMdSize)}."); + throw new CryptographicException(); + } + + _ctx = Interop.Crypto.HmacCreate(ref MemoryMarshal.GetReference(key), key.Length, algorithm); + Interop.Crypto.CheckValidOpenSslHandle(_ctx); + } + + public void Append(ReadOnlySpan data) + { + if (data.IsEmpty) + { + return; + } + + Check(Interop.Crypto.HmacUpdate(_ctx, data, data.Length)); + } + + public int Current(Span destination) + { + Debug.Assert(destination.Length >= _hashSizeInBytes); + + int length = destination.Length; + Check(Interop.Crypto.HmacCurrent(_ctx, ref MemoryMarshal.GetReference(destination), ref length)); + Debug.Assert(length == _hashSizeInBytes); + return _hashSizeInBytes; + } + + public int Finalize(Span destination) + { + Debug.Assert(destination.Length >= _hashSizeInBytes); + + int length = destination.Length; + Check(Interop.Crypto.HmacFinal(_ctx, ref MemoryMarshal.GetReference(destination), ref length)); + Debug.Assert(length == _hashSizeInBytes); + return _hashSizeInBytes; + } + + public void Reset() + { + Check(Interop.Crypto.HmacReset(_ctx)); + } + + public void Dispose() + { + _ctx.Dispose(); + } + + private static void Check(int result) + { + const int Success = 1; + + if (result != Success) + { + Debug.Assert(result == 0); + throw Interop.Crypto.CreateOpenSslCryptographicException(); + } + } + } +} diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/LiteHash.Windows.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/LiteHash.Windows.cs new file mode 100644 index 00000000000000..0fa10b16cbabb7 --- /dev/null +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/LiteHash.Windows.cs @@ -0,0 +1,173 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.Win32.SafeHandles; +using System.Diagnostics; +using System.Runtime.InteropServices; + +using BCryptCreateHashFlags = Interop.BCrypt.BCryptCreateHashFlags; +using BCryptOpenAlgorithmProviderFlags = Interop.BCrypt.BCryptOpenAlgorithmProviderFlags; +using NTSTATUS = Interop.BCrypt.NTSTATUS; + +namespace System.Security.Cryptography +{ + internal static partial class LiteHashProvider + { + private static LiteHash CreateHash(string hashAlgorithmId) + { + return new LiteHash(hashAlgorithmId); + } + + private static LiteHmac CreateHmac(string hashAlgorithmId, ReadOnlySpan key) + { + return new LiteHmac(hashAlgorithmId, key); + } + } + + internal readonly struct LiteHash : ILiteHash + { + private readonly SafeBCryptHashHandle _hashHandle; + private readonly int _hashSizeInBytes; + + public int HashSizeInBytes => _hashSizeInBytes; + + internal LiteHash(string algorithm) + { + + BCryptOpenAlgorithmProviderFlags algorithmFlags = + BCryptOpenAlgorithmProviderFlags.None; + + // This is a shared handle, do not put this in a using. + SafeBCryptAlgorithmHandle algorithmHandle = Interop.BCrypt.BCryptAlgorithmCache.GetCachedBCryptAlgorithmHandle( + algorithm, + algorithmFlags, + out _hashSizeInBytes); + + SafeBCryptHashHandle hashHandle; + + NTSTATUS ntStatus = Interop.BCrypt.BCryptCreateHash( + algorithmHandle, + out hashHandle, + pbHashObject: IntPtr.Zero, + cbHashObject: 0, + secret: ReadOnlySpan.Empty, + cbSecret: 0, + BCryptCreateHashFlags.None); + + if (ntStatus != NTSTATUS.STATUS_SUCCESS) + { + hashHandle.Dispose(); + throw Interop.BCrypt.CreateCryptographicException(ntStatus); + } + + _hashHandle = hashHandle; + } + + public void Append(ReadOnlySpan data) + { + if (data.IsEmpty) + { + return; + } + + NTSTATUS ntStatus = Interop.BCrypt.BCryptHashData(_hashHandle, data, data.Length, dwFlags: 0); + + if (ntStatus != NTSTATUS.STATUS_SUCCESS) + { + throw Interop.BCrypt.CreateCryptographicException(ntStatus); + } + } + + public int Finalize(Span destination) + { + Debug.Assert(destination.Length >= _hashSizeInBytes); + + NTSTATUS ntStatus = Interop.BCrypt.BCryptFinishHash(_hashHandle, destination, _hashSizeInBytes, dwFlags: 0); + + if (ntStatus != NTSTATUS.STATUS_SUCCESS) + { + throw Interop.BCrypt.CreateCryptographicException(ntStatus); + } + + return _hashSizeInBytes; + } + + public void Dispose() + { + _hashHandle.Dispose(); + } + } + + internal readonly struct LiteHmac : ILiteHash + { + private readonly SafeBCryptHashHandle _hashHandle; + private readonly int _hashSizeInBytes; + + public int HashSizeInBytes => _hashSizeInBytes; + + internal LiteHmac(string algorithm, ReadOnlySpan key) + { + BCryptOpenAlgorithmProviderFlags algorithmFlags = + BCryptOpenAlgorithmProviderFlags.BCRYPT_ALG_HANDLE_HMAC_FLAG; + + // This is a shared handle, do not put this in a using. + SafeBCryptAlgorithmHandle algorithmHandle = Interop.BCrypt.BCryptAlgorithmCache.GetCachedBCryptAlgorithmHandle( + algorithm, + algorithmFlags, + out _hashSizeInBytes); + + SafeBCryptHashHandle hashHandle; + + NTSTATUS ntStatus = Interop.BCrypt.BCryptCreateHash( + algorithmHandle, + out hashHandle, + pbHashObject: IntPtr.Zero, + cbHashObject: 0, + key, + key.Length, + BCryptCreateHashFlags.None); + + if (ntStatus != NTSTATUS.STATUS_SUCCESS) + { + hashHandle.Dispose(); + throw Interop.BCrypt.CreateCryptographicException(ntStatus); + } + + _hashHandle = hashHandle; + } + + public void Append(ReadOnlySpan data) + { + if (data.IsEmpty) + { + return; + } + + NTSTATUS ntStatus = Interop.BCrypt.BCryptHashData(_hashHandle, data, data.Length, dwFlags: 0); + + if (ntStatus != NTSTATUS.STATUS_SUCCESS) + { + throw Interop.BCrypt.CreateCryptographicException(ntStatus); + } + } + + public int Finalize(Span destination) + { + Debug.Assert(destination.Length >= _hashSizeInBytes); + + NTSTATUS ntStatus = Interop.BCrypt.BCryptFinishHash(_hashHandle, destination, _hashSizeInBytes, dwFlags: 0); + + if (ntStatus != NTSTATUS.STATUS_SUCCESS) + { + throw Interop.BCrypt.CreateCryptographicException(ntStatus); + } + + return _hashSizeInBytes; + } + + public void Dispose() + { + _hashHandle.Dispose(); + } + } +} diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/LiteHashProvider.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/LiteHashProvider.cs new file mode 100644 index 00000000000000..82aceb127fb625 --- /dev/null +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/LiteHashProvider.cs @@ -0,0 +1,195 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.IO; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; + +namespace System.Security.Cryptography +{ + internal static partial class LiteHashProvider + { + internal static int HashStream(string hashAlgorithmId, int hashSizeInBytes, Stream source, Span destination) + { + LiteHash hash = CreateHash(hashAlgorithmId); + return ProcessStream(hash, source, destination); + } + + internal static byte[] HashStream(string hashAlgorithmId, int hashSizeInBytes, Stream source) + { + byte[] result = new byte[hashSizeInBytes]; + LiteHash hash = CreateHash(hashAlgorithmId); + int written = ProcessStream(hash, source, result); + Debug.Assert(written == hashSizeInBytes); + return result; + } + + internal static ValueTask HashStreamAsync( + string hashAlgorithmId, + int hashSizeInBytes, + Stream source, + Memory destination, + CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return ValueTask.FromCanceled(cancellationToken); + } + + LiteHash hash = CreateHash(hashAlgorithmId); + return ProcessStreamAsync(hash, source, destination, cancellationToken); + } + + internal static ValueTask HashStreamAsync( + string hashAlgorithmId, + int hashSizeInBytes, + Stream source, + CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return ValueTask.FromCanceled(cancellationToken); + } + + LiteHash hash = CreateHash(hashAlgorithmId); + return ProcessStreamAsync(hash, source, cancellationToken); + } + + internal static int HmacStream( + string hashAlgorithmId, + int hashSizeInBytes, + ReadOnlySpan key, + Stream source, + Span destination) + { + LiteHmac hash = CreateHmac(hashAlgorithmId, key); + return ProcessStream(hash, source, destination); + } + + internal static byte[] HmacStream( + string hashAlgorithmId, + int hashSizeInBytes, + ReadOnlySpan key, + Stream source) + { + byte[] result = new byte[hashSizeInBytes]; + LiteHmac hash = CreateHmac(hashAlgorithmId, key); + int written = ProcessStream(hash, source, result); + Debug.Assert(written == hashSizeInBytes); + return result; + } + + internal static ValueTask HmacStreamAsync( + string hashAlgorithmId, + int hashSizeInBytes, + ReadOnlySpan key, + Stream source, + Memory destination, + CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return ValueTask.FromCanceled(cancellationToken); + } + + LiteHmac hash = CreateHmac(hashAlgorithmId, key); + return ProcessStreamAsync(hash, source, destination, cancellationToken); + } + + internal static ValueTask HmacStreamAsync( + string hashAlgorithmId, + int hashSizeInBytes, + ReadOnlySpan key, + Stream source, + CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return ValueTask.FromCanceled(cancellationToken); + } + + LiteHmac hash = CreateHmac(hashAlgorithmId, key); + return ProcessStreamAsync(hash, source, cancellationToken); + } + + /// This takes ownership of the hash parameter and disposes of it when done. + private static int ProcessStream(T hash, Stream source, Span destination) where T : ILiteHash + { + using (hash) + { + byte[] rented = CryptoPool.Rent(4096); + + int maxRead = 0; + int read; + + try + { + while ((read = source.Read(rented)) > 0) + { + maxRead = Math.Max(maxRead, read); + hash.Append(rented.AsSpan(0, read)); + } + + return hash.Finalize(destination); + } + finally + { + CryptoPool.Return(rented, clearSize: maxRead); + } + } + } + + /// This takes ownership of the hash parameter and disposes of it when done. + private static async ValueTask ProcessStreamAsync( + T hash, + Stream source, + Memory destination, + CancellationToken cancellationToken) where T : ILiteHash + { + using (hash) + { + byte[] rented = CryptoPool.Rent(4096); + + int maxRead = 0; + int read; + + try + { + while ((read = await source.ReadAsync(rented, cancellationToken).ConfigureAwait(false)) > 0) + { + maxRead = Math.Max(maxRead, read); + hash.Append(rented.AsSpan(0, read)); + } + + return hash.Finalize(destination.Span); + } + finally + { + CryptoPool.Return(rented, clearSize: maxRead); + } + } + } + + /// This takes ownership of the hash parameter and disposes of it when done. + private static async ValueTask ProcessStreamAsync( + T hash, + Stream source, + CancellationToken cancellationToken) where T : ILiteHash + { + byte[] result = new byte[hash.HashSizeInBytes]; + int written = await ProcessStreamAsync(hash, source, result, cancellationToken).ConfigureAwait(false); + + Debug.Assert(written == result.Length); + return result; + } + } + + internal interface ILiteHash : IDisposable + { + int HashSizeInBytes { get; } + + void Append(ReadOnlySpan data); + int Finalize(Span destination); + } +} diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/MD5.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/MD5.cs index ce70b333089bcf..c1ba826d593559 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/MD5.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/MD5.cs @@ -3,7 +3,10 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; +using System.IO; using System.Runtime.Versioning; +using System.Threading; +using System.Threading.Tasks; using Internal.Cryptography; namespace System.Security.Cryptography @@ -112,6 +115,128 @@ public static bool TryHashData(ReadOnlySpan source, Span destination return true; } + /// + /// Computes the hash of a stream using the MD5 algorithm. + /// + /// The stream to hash. + /// The buffer to receive the hash value. + /// The total number of bytes written to . + /// + /// is . + /// + /// + ///

+ /// The buffer in is too small to hold the calculated hash + /// size. The MD5 algorithm always produces a 128-bit hash, or 16 bytes. + ///

+ ///

-or-

+ ///

+ /// does not support reading. + ///

+ ///
+ public static int HashData(Stream source, Span destination) + { + ArgumentNullException.ThrowIfNull(source); + + if (destination.Length < HashSizeInBytes) + throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(destination)); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HashStream(HashAlgorithmNames.MD5, HashSizeInBytes, source, destination); + } + + /// + /// Computes the hash of a stream using the MD5 algorithm. + /// + /// The stream to hash. + /// The hash of the data. + /// + /// is . + /// + /// + /// does not support reading. + /// + public static byte[] HashData(Stream source) + { + ArgumentNullException.ThrowIfNull(source); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HashStream(HashAlgorithmNames.MD5, HashSizeInBytes, source); + } + + /// + /// Asynchronously computes the hash of a stream using the MD5 algorithm. + /// + /// The stream to hash. + /// + /// The token to monitor for cancellation requests. + /// The default value is . + /// + /// The hash of the data. + /// + /// is . + /// + /// + /// does not support reading. + /// + public static ValueTask HashDataAsync(Stream source, CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(source); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HashStreamAsync(HashAlgorithmNames.MD5, HashSizeInBytes, source, cancellationToken); + } + + /// + /// Asynchronously computes the hash of a stream using the MD5 algorithm. + /// + /// The stream to hash. + /// The buffer to receive the hash value. + /// + /// The token to monitor for cancellation requests. + /// The default value is . + /// + /// The total number of bytes written to . + /// + /// is . + /// + /// + ///

+ /// The buffer in is too small to hold the calculated hash + /// size. The MD5 algorithm always produces a 128-bit hash, or 16 bytes. + ///

+ ///

-or-

+ ///

+ /// does not support reading. + ///

+ ///
+ public static ValueTask HashDataAsync( + Stream source, + Memory destination, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(source); + + if (destination.Length < HashSizeInBytes) + throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(destination)); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HashStreamAsync( + HashAlgorithmNames.MD5, + HashSizeInBytes, + source, + destination, + cancellationToken); + } + private sealed class Implementation : MD5 { private readonly HashProvider _hashProvider; diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHA1.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHA1.cs index 0a66bc18b2854b..684d69e9a228c4 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHA1.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHA1.cs @@ -4,6 +4,9 @@ using Internal.Cryptography; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; +using System.IO; +using System.Threading; +using System.Threading.Tasks; namespace System.Security.Cryptography { @@ -111,6 +114,128 @@ public static bool TryHashData(ReadOnlySpan source, Span destination return true; } + /// + /// Computes the hash of a stream using the SHA1 algorithm. + /// + /// The stream to hash. + /// The buffer to receive the hash value. + /// The total number of bytes written to . + /// + /// is . + /// + /// + ///

+ /// The buffer in is too small to hold the calculated hash + /// size. The SHA1 algorithm always produces a 160-bit hash, or 20 bytes. + ///

+ ///

-or-

+ ///

+ /// does not support reading. + ///

+ ///
+ public static int HashData(Stream source, Span destination) + { + ArgumentNullException.ThrowIfNull(source); + + if (destination.Length < HashSizeInBytes) + throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(destination)); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HashStream(HashAlgorithmNames.SHA1, HashSizeInBytes, source, destination); + } + + /// + /// Computes the hash of a stream using the SHA1 algorithm. + /// + /// The stream to hash. + /// The hash of the data. + /// + /// is . + /// + /// + /// does not support reading. + /// + public static byte[] HashData(Stream source) + { + ArgumentNullException.ThrowIfNull(source); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HashStream(HashAlgorithmNames.SHA1, HashSizeInBytes, source); + } + + /// + /// Asynchronously computes the hash of a stream using the SHA1 algorithm. + /// + /// The stream to hash. + /// + /// The token to monitor for cancellation requests. + /// The default value is . + /// + /// The hash of the data. + /// + /// is . + /// + /// + /// does not support reading. + /// + public static ValueTask HashDataAsync(Stream source, CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(source); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HashStreamAsync(HashAlgorithmNames.SHA1, HashSizeInBytes, source, cancellationToken); + } + + /// + /// Asynchronously computes the hash of a stream using the SHA1 algorithm. + /// + /// The stream to hash. + /// The buffer to receive the hash value. + /// + /// The token to monitor for cancellation requests. + /// The default value is . + /// + /// The total number of bytes written to . + /// + /// is . + /// + /// + ///

+ /// The buffer in is too small to hold the calculated hash + /// size. The SHA1 algorithm always produces a 160-bit hash, or 20 bytes. + ///

+ ///

-or-

+ ///

+ /// does not support reading. + ///

+ ///
+ public static ValueTask HashDataAsync( + Stream source, + Memory destination, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(source); + + if (destination.Length < HashSizeInBytes) + throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(destination)); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HashStreamAsync( + HashAlgorithmNames.SHA1, + HashSizeInBytes, + source, + destination, + cancellationToken); + } + private sealed class Implementation : SHA1 { private readonly HashProvider _hashProvider; diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHA256.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHA256.cs index da16eb86064301..fb48e9ffe00319 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHA256.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHA256.cs @@ -4,6 +4,9 @@ using Internal.Cryptography; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; +using System.IO; +using System.Threading; +using System.Threading.Tasks; namespace System.Security.Cryptography { @@ -111,6 +114,128 @@ public static bool TryHashData(ReadOnlySpan source, Span destination return true; } + /// + /// Computes the hash of a stream using the SHA256 algorithm. + /// + /// The stream to hash. + /// The buffer to receive the hash value. + /// The total number of bytes written to . + /// + /// is . + /// + /// + ///

+ /// The buffer in is too small to hold the calculated hash + /// size. The SHA256 algorithm always produces a 256-bit hash, or 32 bytes. + ///

+ ///

-or-

+ ///

+ /// does not support reading. + ///

+ ///
+ public static int HashData(Stream source, Span destination) + { + ArgumentNullException.ThrowIfNull(source); + + if (destination.Length < HashSizeInBytes) + throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(destination)); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HashStream(HashAlgorithmNames.SHA256, HashSizeInBytes, source, destination); + } + + /// + /// Computes the hash of a stream using the SHA256 algorithm. + /// + /// The stream to hash. + /// The hash of the data. + /// + /// is . + /// + /// + /// does not support reading. + /// + public static byte[] HashData(Stream source) + { + ArgumentNullException.ThrowIfNull(source); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HashStream(HashAlgorithmNames.SHA256, HashSizeInBytes, source); + } + + /// + /// Asynchronously computes the hash of a stream using the SHA256 algorithm. + /// + /// The stream to hash. + /// + /// The token to monitor for cancellation requests. + /// The default value is . + /// + /// The hash of the data. + /// + /// is . + /// + /// + /// does not support reading. + /// + public static ValueTask HashDataAsync(Stream source, CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(source); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HashStreamAsync(HashAlgorithmNames.SHA256, HashSizeInBytes, source, cancellationToken); + } + + /// + /// Asynchronously computes the hash of a stream using the SHA256 algorithm. + /// + /// The stream to hash. + /// The buffer to receive the hash value. + /// + /// The token to monitor for cancellation requests. + /// The default value is . + /// + /// The total number of bytes written to . + /// + /// is . + /// + /// + ///

+ /// The buffer in is too small to hold the calculated hash + /// size. The SHA256 algorithm always produces a 256-bit hash, or 32 bytes. + ///

+ ///

-or-

+ ///

+ /// does not support reading. + ///

+ ///
+ public static ValueTask HashDataAsync( + Stream source, + Memory destination, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(source); + + if (destination.Length < HashSizeInBytes) + throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(destination)); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HashStreamAsync( + HashAlgorithmNames.SHA256, + HashSizeInBytes, + source, + destination, + cancellationToken); + } + private sealed class Implementation : SHA256 { private readonly HashProvider _hashProvider; diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHA384.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHA384.cs index 1ed1b72c04f615..89ba9d5c78b85c 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHA384.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHA384.cs @@ -4,6 +4,9 @@ using Internal.Cryptography; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; +using System.IO; +using System.Threading; +using System.Threading.Tasks; namespace System.Security.Cryptography { @@ -110,6 +113,128 @@ public static bool TryHashData(ReadOnlySpan source, Span destination return true; } + /// + /// Computes the hash of a stream using the SHA384 algorithm. + /// + /// The stream to hash. + /// The buffer to receive the hash value. + /// The total number of bytes written to . + /// + /// is . + /// + /// + ///

+ /// The buffer in is too small to hold the calculated hash + /// size. The SHA384 algorithm always produces a 384-bit hash, or 48 bytes. + ///

+ ///

-or-

+ ///

+ /// does not support reading. + ///

+ ///
+ public static int HashData(Stream source, Span destination) + { + ArgumentNullException.ThrowIfNull(source); + + if (destination.Length < HashSizeInBytes) + throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(destination)); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HashStream(HashAlgorithmNames.SHA384, HashSizeInBytes, source, destination); + } + + /// + /// Computes the hash of a stream using the SHA384 algorithm. + /// + /// The stream to hash. + /// The hash of the data. + /// + /// is . + /// + /// + /// does not support reading. + /// + public static byte[] HashData(Stream source) + { + ArgumentNullException.ThrowIfNull(source); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HashStream(HashAlgorithmNames.SHA384, HashSizeInBytes, source); + } + + /// + /// Asynchronously computes the hash of a stream using the SHA384 algorithm. + /// + /// The stream to hash. + /// + /// The token to monitor for cancellation requests. + /// The default value is . + /// + /// The hash of the data. + /// + /// is . + /// + /// + /// does not support reading. + /// + public static ValueTask HashDataAsync(Stream source, CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(source); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HashStreamAsync(HashAlgorithmNames.SHA384, HashSizeInBytes, source, cancellationToken); + } + + /// + /// Asynchronously computes the hash of a stream using the SHA384 algorithm. + /// + /// The stream to hash. + /// The buffer to receive the hash value. + /// + /// The token to monitor for cancellation requests. + /// The default value is . + /// + /// The total number of bytes written to . + /// + /// is . + /// + /// + ///

+ /// The buffer in is too small to hold the calculated hash + /// size. The SHA384 algorithm always produces a 384-bit hash, or 48 bytes. + ///

+ ///

-or-

+ ///

+ /// does not support reading. + ///

+ ///
+ public static ValueTask HashDataAsync( + Stream source, + Memory destination, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(source); + + if (destination.Length < HashSizeInBytes) + throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(destination)); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HashStreamAsync( + HashAlgorithmNames.SHA384, + HashSizeInBytes, + source, + destination, + cancellationToken); + } + private sealed class Implementation : SHA384 { private readonly HashProvider _hashProvider; diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHA512.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHA512.cs index 5c6e52ab9cd9a2..924af115013d97 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHA512.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHA512.cs @@ -4,6 +4,9 @@ using Internal.Cryptography; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; +using System.IO; +using System.Threading; +using System.Threading.Tasks; namespace System.Security.Cryptography { @@ -110,6 +113,128 @@ public static bool TryHashData(ReadOnlySpan source, Span destination return true; } + /// + /// Computes the hash of a stream using the SHA512 algorithm. + /// + /// The stream to hash. + /// The buffer to receive the hash value. + /// The total number of bytes written to . + /// + /// is . + /// + /// + ///

+ /// The buffer in is too small to hold the calculated hash + /// size. The SHA512 algorithm always produces a 512-bit hash, or 64 bytes. + ///

+ ///

-or-

+ ///

+ /// does not support reading. + ///

+ ///
+ public static int HashData(Stream source, Span destination) + { + ArgumentNullException.ThrowIfNull(source); + + if (destination.Length < HashSizeInBytes) + throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(destination)); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HashStream(HashAlgorithmNames.SHA512, HashSizeInBytes, source, destination); + } + + /// + /// Computes the hash of a stream using the SHA512 algorithm. + /// + /// The stream to hash. + /// The hash of the data. + /// + /// is . + /// + /// + /// does not support reading. + /// + public static byte[] HashData(Stream source) + { + ArgumentNullException.ThrowIfNull(source); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HashStream(HashAlgorithmNames.SHA512, HashSizeInBytes, source); + } + + /// + /// Asynchronously computes the hash of a stream using the SHA512 algorithm. + /// + /// The stream to hash. + /// + /// The token to monitor for cancellation requests. + /// The default value is . + /// + /// The hash of the data. + /// + /// is . + /// + /// + /// does not support reading. + /// + public static ValueTask HashDataAsync(Stream source, CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(source); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HashStreamAsync(HashAlgorithmNames.SHA512, HashSizeInBytes, source, cancellationToken); + } + + /// + /// Asynchronously computes the hash of a stream using the SHA512 algorithm. + /// + /// The stream to hash. + /// The buffer to receive the hash value. + /// + /// The token to monitor for cancellation requests. + /// The default value is . + /// + /// The total number of bytes written to . + /// + /// is . + /// + /// + ///

+ /// The buffer in is too small to hold the calculated hash + /// size. The SHA512 algorithm always produces a 512-bit hash, or 64 bytes. + ///

+ ///

-or-

+ ///

+ /// does not support reading. + ///

+ ///
+ public static ValueTask HashDataAsync( + Stream source, + Memory destination, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(source); + + if (destination.Length < HashSizeInBytes) + throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(destination)); + + if (!source.CanRead) + throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source)); + + return LiteHashProvider.HashStreamAsync( + HashAlgorithmNames.SHA512, + HashSizeInBytes, + source, + destination, + cancellationToken); + } + private sealed class Implementation : SHA512 { private readonly HashProvider _hashProvider; diff --git a/src/libraries/System.Security.Cryptography/tests/HashAlgorithmTestDriver.cs b/src/libraries/System.Security.Cryptography/tests/HashAlgorithmTestDriver.cs index 9f940b3753a63e..8890808c6a0cca 100644 --- a/src/libraries/System.Security.Cryptography/tests/HashAlgorithmTestDriver.cs +++ b/src/libraries/System.Security.Cryptography/tests/HashAlgorithmTestDriver.cs @@ -3,6 +3,8 @@ using System.IO; using System.Linq; +using System.Threading; +using System.Threading.Tasks; using Test.Cryptography; using Xunit; @@ -15,6 +17,10 @@ public abstract class HashAlgorithmTestDriver protected abstract byte[] HashData(byte[] source); protected abstract byte[] HashData(ReadOnlySpan source); protected abstract int HashData(ReadOnlySpan source, Span destination); + protected abstract int HashData(Stream source, Span destination); + protected abstract byte[] HashData(Stream source); + protected abstract ValueTask HashDataAsync(Stream source, Memory destination, CancellationToken cancellationToken); + protected abstract ValueTask HashDataAsync(Stream source, CancellationToken cancellationToken); protected void Verify(string input, string output) { @@ -35,6 +41,54 @@ private void VerifyComputeHashStream(Stream input, string output) Assert.Equal(expected, actual); } + private async Task VerifyComputeHashStreamAsync(Stream input, string output) + { + byte[] expected = ByteUtils.HexToByteArray(output); + byte[] actual; + + using (HashAlgorithm hash = Create()) + { + Assert.True(hash.HashSize > 0); + actual = await hash.ComputeHashAsync(input); + } + + Assert.Equal(expected, actual); + } + + private void VerifyOneShotStream(Stream input, string output) + { + byte[] expected = ByteUtils.HexToByteArray(output); + Span buffer = stackalloc byte[512 / 8]; + + int written = HashData(input, buffer); + AssertExtensions.SequenceEqual(expected, buffer.Slice(0, written)); + } + + private async Task VerifyOneShotStreamAsync(Stream input, string output) + { + byte[] expected = ByteUtils.HexToByteArray(output); + Memory buffer = new byte[512 / 8]; + + int written = await HashDataAsync(input, buffer, cancellationToken: default); + AssertExtensions.SequenceEqual(expected, buffer.Slice(0, written).Span); + } + + private void VerifyOneShotAllocatingStream(Stream input, string output) + { + byte[] expected = ByteUtils.HexToByteArray(output); + + byte[] digest = HashData(input); + Assert.Equal(expected, digest); + } + + private async Task VerifyOneShotAllocatingStreamAsync(Stream input, string output) + { + byte[] expected = ByteUtils.HexToByteArray(output); + + byte[] digest = await HashDataAsync(input, cancellationToken: default); + Assert.Equal(expected, digest); + } + private void VerifyICryptoTransformStream(Stream input, string output) { byte[] expected = ByteUtils.HexToByteArray(output); @@ -140,13 +194,13 @@ private void VerifyTransformBlockComputeHashInteraction(byte[] block1, byte[] bl [Fact] public void HashData_ByteArray_Null() { - AssertExtensions.Throws("source", () => HashData(null)); + AssertExtensions.Throws("source", () => HashData((byte[])null)); } [Fact] public void HashData_BufferTooSmall() { - AssertExtensions.Throws("destination", () => HashData(default, default)); + AssertExtensions.Throws("destination", () => HashData(Span.Empty, default)); } [Fact] @@ -320,6 +374,85 @@ protected void VerifyRepeating(string input, int repeatCount, string output) { VerifyICryptoTransformStream(stream, output); } + + using (Stream stream = new DataRepeatingStream(input, repeatCount)) + { + VerifyOneShotStream(stream, output); + } + + using (Stream stream = new DataRepeatingStream(input, repeatCount)) + { + VerifyOneShotAllocatingStream(stream, output); + } + } + + protected async Task VerifyRepeatingAsync(string input, int repeatCount, string output) + { + using (Stream stream = new DataRepeatingStream(input, repeatCount)) + { + await VerifyComputeHashStreamAsync(stream, output); + } + + using (Stream stream = new DataRepeatingStream(input, repeatCount)) + { + await VerifyOneShotStreamAsync(stream, output); + } + + using (Stream stream = new DataRepeatingStream(input, repeatCount)) + { + await VerifyOneShotAllocatingStreamAsync(stream, output); + } + } + + [Fact] + public void HashData_Null_Stream_Throws() + { + AssertExtensions.Throws("source", () => HashData((Stream)null)); + AssertExtensions.Throws("source", () => HashData((Stream)null, Span.Empty)); + } + + [Fact] + public void HashData_ShortDestination_Throws() + { + AssertExtensions.Throws("destination", () => HashData(Stream.Null, Span.Empty)); + } + + [Fact] + public void HashDataAsync_Null_Stream_Throws() + { + AssertExtensions.Throws( + "source", + () => HashDataAsync((Stream)null, cancellationToken: default)); + + AssertExtensions.Throws( + "source", + () => HashDataAsync((Stream)null, Memory.Empty, cancellationToken: default)); + } + + [Fact] + public void HashDataAsync_ShortDestination_Throws() + { + AssertExtensions.Throws( + "destination", + () => HashDataAsync(Stream.Null, Memory.Empty, cancellationToken: default)); + } + + [Fact] + public void HashDataAsync_Buffer_CancelledToken() + { + Memory buffer = new byte[512 / 8]; + CancellationToken cancelledToken = new CancellationToken(canceled: true); + ValueTask waitable = HashDataAsync(Stream.Null, buffer, cancelledToken); + Assert.True(waitable.IsCanceled, nameof(waitable.IsCanceled)); + AssertExtensions.FilledWith(0, buffer.Span); + } + + [Fact] + public void HashDataAsync_Allocating_CancelledToken() + { + CancellationToken cancelledToken = new CancellationToken(canceled: true); + ValueTask waitable = HashDataAsync(Stream.Null, cancelledToken); + Assert.True(waitable.IsCanceled, nameof(waitable.IsCanceled)); } [Fact] @@ -511,91 +644,5 @@ public void Initialize_DoubleInitialize_Works() Assert.Equal(expectedDigest, hash.Hash); } } - - protected class DataRepeatingStream : Stream - { - private int _remaining; - private byte[] _data; - - public DataRepeatingStream(string data, int repeatCount) - { - _remaining = repeatCount; - _data = ByteUtils.AsciiBytes(data); - } - - public override int Read(byte[] buffer, int offset, int count) - { - if (!CanRead) - { - throw new NotSupportedException(); - } - - if (_remaining == 0) - { - return 0; - } - - if (count < _data.Length) - { - throw new InvalidOperationException(); - } - - int multiple = count / _data.Length; - - if (multiple > _remaining) - { - multiple = _remaining; - } - - int localOffset = offset; - - for (int i = 0; i < multiple; i++) - { - Buffer.BlockCopy(_data, 0, buffer, localOffset, _data.Length); - localOffset += _data.Length; - } - - _remaining -= multiple; - return _data.Length * multiple; - } - - protected override void Dispose(bool disposing) - { - if (disposing) - { - _data = null; - } - } - - public override void Flush() - { - } - - public override long Seek(long offset, SeekOrigin origin) - { - throw new NotSupportedException(); - } - - public override void SetLength(long value) - { - throw new NotSupportedException(); - } - - public override void Write(byte[] buffer, int offset, int count) - { - throw new NotSupportedException(); - } - - public override bool CanRead { get { return _data != null; } } - public override bool CanSeek { get { return false; } } - public override bool CanWrite { get { return false; } } - public override long Length { get { throw new NotSupportedException(); } } - - public override long Position - { - get { throw new NotSupportedException(); } - set { throw new NotSupportedException(); } - } - } } } diff --git a/src/libraries/System.Security.Cryptography/tests/HmacMD5Tests.cs b/src/libraries/System.Security.Cryptography/tests/HmacMD5Tests.cs index 99ad3814d0a371..d658411811826a 100644 --- a/src/libraries/System.Security.Cryptography/tests/HmacMD5Tests.cs +++ b/src/libraries/System.Security.Cryptography/tests/HmacMD5Tests.cs @@ -1,6 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.IO; +using System.Threading; +using System.Threading.Tasks; using Test.Cryptography; using Xunit; @@ -55,6 +58,31 @@ protected override int HashDataOneShot(ReadOnlySpan key, ReadOnlySpan key, ReadOnlySpan source, Span destination, out int written) => HMACMD5.TryHashData(key, source, destination, out written); + protected override byte[] HashDataOneShot(ReadOnlySpan key, Stream source) => + HMACMD5.HashData(key, source); + + protected override byte[] HashDataOneShot(byte[] key, Stream source) => + HMACMD5.HashData(key, source); + + protected override int HashDataOneShot(ReadOnlySpan key, Stream source, Span destination) => + HMACMD5.HashData(key, source, destination); + + protected override ValueTask HashDataOneShotAsync( + ReadOnlyMemory key, + Stream source, + Memory destination, + CancellationToken cancellationToken) => HMACMD5.HashDataAsync(key, source, destination, cancellationToken); + + protected override ValueTask HashDataOneShotAsync( + ReadOnlyMemory key, + Stream source, + CancellationToken cancellationToken) => HMACMD5.HashDataAsync(key, source, cancellationToken); + + protected override ValueTask HashDataOneShotAsync( + byte[] key, + Stream source, + CancellationToken cancellationToken) => HMACMD5.HashDataAsync(key, source, cancellationToken); + [Fact] public void HmacMD5_Rfc2202_1() { @@ -108,5 +136,77 @@ public void HMacMD5_ThrowsArgumentNullForNullConstructorKey() { AssertExtensions.Throws("key", () => new HMACMD5(null)); } + + [Fact] + public void HmacMD5_Stream_MultipleOf4096() + { + // Verfied with: + // for _ in {1..1024}; do echo -n "0102030405060708"; done | openssl md5 -hex -mac HMAC -macopt hexkey:000102030405060708090A0B0C0D0E0F + VerifyRepeating( + input: "0102030405060708", + 1024, + hexKey: "000102030405060708090A0B0C0D0E0F", + output: "1287EF250C2026A0C0CBA832C599AE50"); + } + + [Fact] + public void HmacMD5_Stream_NotMultipleOf4096() + { + // Verfied with: + // for _ in {1..1025}; do echo -n "0102030405060708"; done | openssl md5 -hex -mac HMAC -macopt hexkey:000102030405060708090A0B0C0D0E0F + VerifyRepeating( + input: "0102030405060708", + 1025, + hexKey: "000102030405060708090A0B0C0D0E0F", + output: "D10B835D95FCC9EECDF1D4BCDAB81897"); + } + + [Fact] + public void HmacMD5_Stream_Empty() + { + // Verfied with: + // echo -n "" | openssl md5 -hex -mac HMAC -macopt hexkey:000102030405060708090A0B0C0D0E0F + VerifyRepeating( + input: "", + 0, + hexKey: "000102030405060708090A0B0C0D0E0F", + output: "C91E40247251F39BDFE6A7B72A5857F9"); + } + + [Fact] + public async Task HmacMD5_Stream_MultipleOf4096_Async() + { + // Verfied with: + // for _ in {1..1024}; do echo -n "0102030405060708"; done | openssl md5 -hex -mac HMAC -macopt hexkey:000102030405060708090A0B0C0D0E0F + await VerifyRepeatingAsync( + input: "0102030405060708", + 1024, + hexKey: "000102030405060708090A0B0C0D0E0F", + output: "1287EF250C2026A0C0CBA832C599AE50"); + } + + [Fact] + public async Task HmacMD5_Stream_NotMultipleOf4096_Async() + { + // Verfied with: + // for _ in {1..1025}; do echo -n "0102030405060708"; done | openssl md5 -hex -mac HMAC -macopt hexkey:000102030405060708090A0B0C0D0E0F + await VerifyRepeatingAsync( + input: "0102030405060708", + 1025, + hexKey: "000102030405060708090A0B0C0D0E0F", + output: "D10B835D95FCC9EECDF1D4BCDAB81897"); + } + + [Fact] + public async Task HmacMD5_Stream_Empty_Async() + { + // Verfied with: + // echo -n "" | openssl md5 -hex -mac HMAC -macopt hexkey:000102030405060708090A0B0C0D0E0F + await VerifyRepeatingAsync( + input: "", + 0, + hexKey: "000102030405060708090A0B0C0D0E0F", + output: "C91E40247251F39BDFE6A7B72A5857F9"); + } } } diff --git a/src/libraries/System.Security.Cryptography/tests/HmacSha1Tests.cs b/src/libraries/System.Security.Cryptography/tests/HmacSha1Tests.cs index 61b395d572535c..d618b7122a32d3 100644 --- a/src/libraries/System.Security.Cryptography/tests/HmacSha1Tests.cs +++ b/src/libraries/System.Security.Cryptography/tests/HmacSha1Tests.cs @@ -1,6 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.IO; +using System.Threading; +using System.Threading.Tasks; using Test.Cryptography; using Xunit; @@ -55,6 +58,31 @@ protected override int HashDataOneShot(ReadOnlySpan key, ReadOnlySpan key, ReadOnlySpan source, Span destination, out int written) => HMACSHA1.TryHashData(key, source, destination, out written); + protected override byte[] HashDataOneShot(ReadOnlySpan key, Stream source) => + HMACSHA1.HashData(key, source); + + protected override byte[] HashDataOneShot(byte[] key, Stream source) => + HMACSHA1.HashData(key, source); + + protected override int HashDataOneShot(ReadOnlySpan key, Stream source, Span destination) => + HMACSHA1.HashData(key, source, destination); + + protected override ValueTask HashDataOneShotAsync( + ReadOnlyMemory key, + Stream source, + Memory destination, + CancellationToken cancellationToken) => HMACSHA1.HashDataAsync(key, source, destination, cancellationToken); + + protected override ValueTask HashDataOneShotAsync( + ReadOnlyMemory key, + Stream source, + CancellationToken cancellationToken) => HMACSHA1.HashDataAsync(key, source, cancellationToken); + + protected override ValueTask HashDataOneShotAsync( + byte[] key, + Stream source, + CancellationToken cancellationToken) => HMACSHA1.HashDataAsync(key, source, cancellationToken); + [Fact] public void HmacSha1_Byte_Constructors() { @@ -128,9 +156,81 @@ public void HmacSha1_Rfc2202_7() } [Fact] - public void HMacSha1_Rfc2104_2() + public void HmacSha1_Rfc2104_2() { VerifyHmacRfc2104_2(); } + + [Fact] + public void HmacSha1_Stream_MultipleOf4096() + { + // Verfied with: + // for _ in {1..1024}; do echo -n "0102030405060708"; done | openssl sha1 -hex -mac HMAC -macopt hexkey:000102030405060708090A0B0C0D0E0F + VerifyRepeating( + input: "0102030405060708", + 1024, + hexKey: "000102030405060708090A0B0C0D0E0F", + output: "3CE5AE476733905861F031DDC2DEDF8CBB1FAA0B"); + } + + [Fact] + public void HmacSha1_Stream_NotMultipleOf4096() + { + // Verfied with: + // for _ in {1..1025}; do echo -n "0102030405060708"; done | openssl sha1 -hex -mac HMAC -macopt hexkey:000102030405060708090A0B0C0D0E0F + VerifyRepeating( + input: "0102030405060708", + 1025, + hexKey: "000102030405060708090A0B0C0D0E0F", + output: "E18D7FB16A83CA17DB6CB0F1C083AA7A7094F627"); + } + + [Fact] + public void HmacSha1_Stream_Empty() + { + // Verfied with: + // echo -n "" | openssl sha1 -hex -mac HMAC -macopt hexkey:000102030405060708090A0B0C0D0E0F + VerifyRepeating( + input: "", + 0, + hexKey: "000102030405060708090A0B0C0D0E0F", + output: "5433122F77BCF8A4D9B874B4149823EF5B7C207E"); + } + + [Fact] + public async Task HmacSha1_Stream_MultipleOf4096_Async() + { + // Verfied with: + // for _ in {1..1024}; do echo -n "0102030405060708"; done | openssl sha1 -hex -mac HMAC -macopt hexkey:000102030405060708090A0B0C0D0E0F + await VerifyRepeatingAsync( + input: "0102030405060708", + 1024, + hexKey: "000102030405060708090A0B0C0D0E0F", + output: "3CE5AE476733905861F031DDC2DEDF8CBB1FAA0B"); + } + + [Fact] + public async Task HmacSha1_Stream_NotMultipleOf4096_Async() + { + // Verfied with: + // for _ in {1..1025}; do echo -n "0102030405060708"; done | openssl sha1 -hex -mac HMAC -macopt hexkey:000102030405060708090A0B0C0D0E0F + await VerifyRepeatingAsync( + input: "0102030405060708", + 1025, + hexKey: "000102030405060708090A0B0C0D0E0F", + output: "E18D7FB16A83CA17DB6CB0F1C083AA7A7094F627"); + } + + [Fact] + public async Task HmacSha1_Stream_Empty_Async() + { + // Verfied with: + // echo -n "" | openssl sha1 -hex -mac HMAC -macopt hexkey:000102030405060708090A0B0C0D0E0F + await VerifyRepeatingAsync( + input: "", + 0, + hexKey: "000102030405060708090A0B0C0D0E0F", + output: "5433122F77BCF8A4D9B874B4149823EF5B7C207E"); + } } } diff --git a/src/libraries/System.Security.Cryptography/tests/HmacSha256Tests.cs b/src/libraries/System.Security.Cryptography/tests/HmacSha256Tests.cs index f2f17844046756..587711a920ad27 100644 --- a/src/libraries/System.Security.Cryptography/tests/HmacSha256Tests.cs +++ b/src/libraries/System.Security.Cryptography/tests/HmacSha256Tests.cs @@ -1,6 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.IO; +using System.Threading; +using System.Threading.Tasks; using Test.Cryptography; using Xunit; @@ -26,6 +29,31 @@ protected override int HashDataOneShot(ReadOnlySpan key, ReadOnlySpan key, ReadOnlySpan source, Span destination, out int written) => HMACSHA256.TryHashData(key, source, destination, out written); + protected override byte[] HashDataOneShot(ReadOnlySpan key, Stream source) => + HMACSHA256.HashData(key, source); + + protected override byte[] HashDataOneShot(byte[] key, Stream source) => + HMACSHA256.HashData(key, source); + + protected override int HashDataOneShot(ReadOnlySpan key, Stream source, Span destination) => + HMACSHA256.HashData(key, source, destination); + + protected override ValueTask HashDataOneShotAsync( + ReadOnlyMemory key, + Stream source, + Memory destination, + CancellationToken cancellationToken) => HMACSHA256.HashDataAsync(key, source, destination, cancellationToken); + + protected override ValueTask HashDataOneShotAsync( + ReadOnlyMemory key, + Stream source, + CancellationToken cancellationToken) => HMACSHA256.HashDataAsync(key, source, cancellationToken); + + protected override ValueTask HashDataOneShotAsync( + byte[] key, + Stream source, + CancellationToken cancellationToken) => HMACSHA256.HashDataAsync(key, source, cancellationToken); + private static byte[][] s_testMacs4231 = { null, @@ -86,7 +114,7 @@ public void HmacSha256_Rfc4231_7() } [Fact] - public void HMacSha256_Rfc2104_2() + public void HmacSha256_Rfc2104_2() { VerifyHmacRfc2104_2(); } @@ -96,5 +124,77 @@ public void HmacSha256_ThrowsArgumentNullForNullConstructorKey() { AssertExtensions.Throws("key", () => new HMACSHA256(null)); } + + [Fact] + public void HmacSha256_Stream_MultipleOf4096() + { + // Verfied with: + // for _ in {1..1024}; do echo -n "0102030405060708"; done | openssl sha256 -hex -mac HMAC -macopt hexkey:000102030405060708090A0B0C0D0E0F + VerifyRepeating( + input: "0102030405060708", + 1024, + hexKey: "000102030405060708090A0B0C0D0E0F", + output: "A47B9F5BD5C2DEF403A0279D4C6C407A2D34561E7D1F006D7FE8BDC2C78227D5"); + } + + [Fact] + public void HmacSha256_Stream_NotMultipleOf4096() + { + // Verfied with: + // for _ in {1..1025}; do echo -n "0102030405060708"; done | openssl sha256 -hex -mac HMAC -macopt hexkey:000102030405060708090A0B0C0D0E0F + VerifyRepeating( + input: "0102030405060708", + 1025, + hexKey: "000102030405060708090A0B0C0D0E0F", + output: "1CF6661B6EFD25D8B6DE734AA39D5D3D44C9A56BB9377A6388EB0FC5E48A108B"); + } + + [Fact] + public void HmacSha256_Stream_Empty() + { + // Verfied with: + // echo -n "" | openssl sha256 -hex -mac HMAC -macopt hexkey:000102030405060708090A0B0C0D0E0F + VerifyRepeating( + input: "", + 0, + hexKey: "000102030405060708090A0B0C0D0E0F", + output: "07EFF8B326B7798C9CCFCBDBE579489AC785A7995A04618B1A2813C26744777D"); + } + + [Fact] + public async Task HmacSha256_Stream_MultipleOf4096_Async() + { + // Verfied with: + // for _ in {1..1024}; do echo -n "0102030405060708"; done | openssl sha256 -hex -mac HMAC -macopt hexkey:000102030405060708090A0B0C0D0E0F + await VerifyRepeatingAsync( + input: "0102030405060708", + 1024, + hexKey: "000102030405060708090A0B0C0D0E0F", + output: "A47B9F5BD5C2DEF403A0279D4C6C407A2D34561E7D1F006D7FE8BDC2C78227D5"); + } + + [Fact] + public async Task HmacSha256_Stream_NotMultipleOf4096_Async() + { + // Verfied with: + // for _ in {1..1025}; do echo -n "0102030405060708"; done | openssl sha256 -hex -mac HMAC -macopt hexkey:000102030405060708090A0B0C0D0E0F + await VerifyRepeatingAsync( + input: "0102030405060708", + 1025, + hexKey: "000102030405060708090A0B0C0D0E0F", + output: "1CF6661B6EFD25D8B6DE734AA39D5D3D44C9A56BB9377A6388EB0FC5E48A108B"); + } + + [Fact] + public async Task HmacSha256_Stream_Empty_Async() + { + // Verfied with: + // echo -n "" | openssl sha256 -hex -mac HMAC -macopt hexkey:000102030405060708090A0B0C0D0E0F + await VerifyRepeatingAsync( + input: "", + 0, + hexKey: "000102030405060708090A0B0C0D0E0F", + output: "07EFF8B326B7798C9CCFCBDBE579489AC785A7995A04618B1A2813C26744777D"); + } } } diff --git a/src/libraries/System.Security.Cryptography/tests/HmacSha384Tests.cs b/src/libraries/System.Security.Cryptography/tests/HmacSha384Tests.cs index dbff8c26c50bcd..eb3bbf5681e8b8 100644 --- a/src/libraries/System.Security.Cryptography/tests/HmacSha384Tests.cs +++ b/src/libraries/System.Security.Cryptography/tests/HmacSha384Tests.cs @@ -1,6 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.IO; +using System.Threading; +using System.Threading.Tasks; using Test.Cryptography; using Xunit; @@ -26,6 +29,31 @@ protected override int HashDataOneShot(ReadOnlySpan key, ReadOnlySpan key, ReadOnlySpan source, Span destination, out int written) => HMACSHA384.TryHashData(key, source, destination, out written); + protected override byte[] HashDataOneShot(ReadOnlySpan key, Stream source) => + HMACSHA384.HashData(key, source); + + protected override byte[] HashDataOneShot(byte[] key, Stream source) => + HMACSHA384.HashData(key, source); + + protected override int HashDataOneShot(ReadOnlySpan key, Stream source, Span destination) => + HMACSHA384.HashData(key, source, destination); + + protected override ValueTask HashDataOneShotAsync( + ReadOnlyMemory key, + Stream source, + Memory destination, + CancellationToken cancellationToken) => HMACSHA384.HashDataAsync(key, source, destination, cancellationToken); + + protected override ValueTask HashDataOneShotAsync( + ReadOnlyMemory key, + Stream source, + CancellationToken cancellationToken) => HMACSHA384.HashDataAsync(key, source, cancellationToken); + + protected override ValueTask HashDataOneShotAsync( + byte[] key, + Stream source, + CancellationToken cancellationToken) => HMACSHA384.HashDataAsync(key, source, cancellationToken); + private static byte[][] s_testMacs4231 = { null, @@ -99,7 +127,7 @@ public void HmacSha384_Rfc4231_7() } [Fact] - public void HMacSha384_Rfc2104_2() + public void HmacSha384_Rfc2104_2() { VerifyHmacRfc2104_2(); } @@ -109,5 +137,77 @@ public void HmacSha384_ThrowsArgumentNullForNullConstructorKey() { AssertExtensions.Throws("key", () => new HMACSHA384(null)); } + + [Fact] + public void HmacSha384_Stream_MultipleOf4096() + { + // Verfied with: + // for _ in {1..1024}; do echo -n "0102030405060708"; done | openssl sha384 -hex -mac HMAC -macopt hexkey:000102030405060708090A0B0C0D0E0F + VerifyRepeating( + input: "0102030405060708", + 1024, + hexKey: "000102030405060708090A0B0C0D0E0F", + output: "6C4977B00CCE179ADCC06EB35E48ABDE9B5604FC9E8B6B25F65E0234EE6394DE40F0C6C6B727B58B19ADFC1E5BB2E84D"); + } + + [Fact] + public void HmacSha384_Stream_NotMultipleOf4096() + { + // Verfied with: + // for _ in {1..1025}; do echo -n "0102030405060708"; done | openssl sha384 -hex -mac HMAC -macopt hexkey:000102030405060708090A0B0C0D0E0F + VerifyRepeating( + input: "0102030405060708", + 1025, + hexKey: "000102030405060708090A0B0C0D0E0F", + output: "45303A3B5F02C8462D6FA438893DAA05EFFA850B853DF614D45F343D20AFE6D6DBAC6D0656788C4398EDF0AEC01488D4"); + } + + [Fact] + public void HmacSha384_Stream_Empty() + { + // Verfied with: + // echo -n "" | openssl sha384 -hex -mac HMAC -macopt hexkey:000102030405060708090A0B0C0D0E0F + VerifyRepeating( + input: "", + 0, + hexKey: "000102030405060708090A0B0C0D0E0F", + output: "6A0FDC1C54C664AD91C7C157D2670C5D44E4D44EBAD2359A0206974C7088B1A867F76971E6C240C33B33A66BA295BB56"); + } + + [Fact] + public async Task HmacSha384_Stream_MultipleOf4096_Async() + { + // Verfied with: + // for _ in {1..1024}; do echo -n "0102030405060708"; done | openssl sha384 -hex -mac HMAC -macopt hexkey:000102030405060708090A0B0C0D0E0F + await VerifyRepeatingAsync( + input: "0102030405060708", + 1024, + hexKey: "000102030405060708090A0B0C0D0E0F", + output: "6C4977B00CCE179ADCC06EB35E48ABDE9B5604FC9E8B6B25F65E0234EE6394DE40F0C6C6B727B58B19ADFC1E5BB2E84D"); + } + + [Fact] + public async Task HmacSha384_Stream_NotMultipleOf4096_Async() + { + // Verfied with: + // for _ in {1..1025}; do echo -n "0102030405060708"; done | openssl sha384 -hex -mac HMAC -macopt hexkey:000102030405060708090A0B0C0D0E0F + await VerifyRepeatingAsync( + input: "0102030405060708", + 1025, + hexKey: "000102030405060708090A0B0C0D0E0F", + output: "45303A3B5F02C8462D6FA438893DAA05EFFA850B853DF614D45F343D20AFE6D6DBAC6D0656788C4398EDF0AEC01488D4"); + } + + [Fact] + public async Task HmacSha384_Stream_Empty_Async() + { + // Verfied with: + // echo -n "" | openssl sha384 -hex -mac HMAC -macopt hexkey:000102030405060708090A0B0C0D0E0F + await VerifyRepeatingAsync( + input: "", + 0, + hexKey: "000102030405060708090A0B0C0D0E0F", + output: "6A0FDC1C54C664AD91C7C157D2670C5D44E4D44EBAD2359A0206974C7088B1A867F76971E6C240C33B33A66BA295BB56"); + } } } diff --git a/src/libraries/System.Security.Cryptography/tests/HmacSha512Tests.cs b/src/libraries/System.Security.Cryptography/tests/HmacSha512Tests.cs index 7bf5ed66528733..7172d68d43dfe7 100644 --- a/src/libraries/System.Security.Cryptography/tests/HmacSha512Tests.cs +++ b/src/libraries/System.Security.Cryptography/tests/HmacSha512Tests.cs @@ -1,6 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.IO; +using System.Threading; +using System.Threading.Tasks; using Test.Cryptography; using Xunit; @@ -26,6 +29,31 @@ protected override int HashDataOneShot(ReadOnlySpan key, ReadOnlySpan key, ReadOnlySpan source, Span destination, out int written) => HMACSHA512.TryHashData(key, source, destination, out written); + protected override byte[] HashDataOneShot(ReadOnlySpan key, Stream source) => + HMACSHA512.HashData(key, source); + + protected override byte[] HashDataOneShot(byte[] key, Stream source) => + HMACSHA512.HashData(key, source); + + protected override int HashDataOneShot(ReadOnlySpan key, Stream source, Span destination) => + HMACSHA512.HashData(key, source, destination); + + protected override ValueTask HashDataOneShotAsync( + ReadOnlyMemory key, + Stream source, + Memory destination, + CancellationToken cancellationToken) => HMACSHA512.HashDataAsync(key, source, destination, cancellationToken); + + protected override ValueTask HashDataOneShotAsync( + ReadOnlyMemory key, + Stream source, + CancellationToken cancellationToken) => HMACSHA512.HashDataAsync(key, source, cancellationToken); + + protected override ValueTask HashDataOneShotAsync( + byte[] key, + Stream source, + CancellationToken cancellationToken) => HMACSHA512.HashDataAsync(key, source, cancellationToken); + private static byte[][] s_testMacs4231 = { null, @@ -99,7 +127,7 @@ public void HmacSha512_Rfc4231_7() } [Fact] - public void HMacSha512_Rfc2104_2() + public void HmacSha512_Rfc2104_2() { VerifyHmacRfc2104_2(); } @@ -109,5 +137,77 @@ public void HmacSha512_ThrowsArgumentNullForNullConstructorKey() { AssertExtensions.Throws("key", () => new HMACSHA512(null)); } + + [Fact] + public void HmacSha512_Stream_MultipleOf4096() + { + // Verfied with: + // for _ in {1..1024}; do echo -n "0102030405060708"; done | openssl sha512 -hex -mac HMAC -macopt hexkey:000102030405060708090A0B0C0D0E0F + VerifyRepeating( + input: "0102030405060708", + 1024, + hexKey: "000102030405060708090A0B0C0D0E0F", + output: "05A7BB210D374B0CC36FFFA561045F1C1EB8E71905A50308B108D4677CCB0452A99B26EE41DD8E1D87D53A4F3E07B1231E5D3FFFCE7FD0C5C5A8B8F5E0206A11"); + } + + [Fact] + public void HmacSha512_Stream_NotMultipleOf4096() + { + // Verfied with: + // for _ in {1..1025}; do echo -n "0102030405060708"; done | openssl sha512 -hex -mac HMAC -macopt hexkey:000102030405060708090A0B0C0D0E0F + VerifyRepeating( + input: "0102030405060708", + 1025, + hexKey: "000102030405060708090A0B0C0D0E0F", + output: "9040E87E9CC546C507C3DEE90D278975B0C2049F28E71CC6FEEA0F3690EC9D0B736F885FFAA611156DA0C2904FC2EEEAA9562B53EB50F590902B2AE38056C874"); + } + + [Fact] + public void HmacSha512_Stream_Empty() + { + // Verfied with: + // echo -n "" | openssl sha512 -hex -mac HMAC -macopt hexkey:000102030405060708090A0B0C0D0E0F + VerifyRepeating( + input: "", + 0, + hexKey: "000102030405060708090A0B0C0D0E0F", + output: "2FEC800CA276C44985A35AEC92067E5E53A1BB80A6FDAB1D9C97D54068118F30AD4C33717466D372EA00BBF126E5B79C6F7143DD36C31F72028330E92AE3A359"); + } + + [Fact] + public async Task HmacSha512_Stream_MultipleOf4096_Async() + { + // Verfied with: + // for _ in {1..1024}; do echo -n "0102030405060708"; done | openssl sha512 -hex -mac HMAC -macopt hexkey:000102030405060708090A0B0C0D0E0F + await VerifyRepeatingAsync( + input: "0102030405060708", + 1024, + hexKey: "000102030405060708090A0B0C0D0E0F", + output: "05A7BB210D374B0CC36FFFA561045F1C1EB8E71905A50308B108D4677CCB0452A99B26EE41DD8E1D87D53A4F3E07B1231E5D3FFFCE7FD0C5C5A8B8F5E0206A11"); + } + + [Fact] + public async Task HmacSha512_Stream_NotMultipleOf4096_Async() + { + // Verfied with: + // for _ in {1..1025}; do echo -n "0102030405060708"; done | openssl sha512 -hex -mac HMAC -macopt hexkey:000102030405060708090A0B0C0D0E0F + await VerifyRepeatingAsync( + input: "0102030405060708", + 1025, + hexKey: "000102030405060708090A0B0C0D0E0F", + output: "9040E87E9CC546C507C3DEE90D278975B0C2049F28E71CC6FEEA0F3690EC9D0B736F885FFAA611156DA0C2904FC2EEEAA9562B53EB50F590902B2AE38056C874"); + } + + [Fact] + public async Task HmacSha512_Stream_Empty_Async() + { + // Verfied with: + // echo -n "" | openssl sha512 -hex -mac HMAC -macopt hexkey:000102030405060708090A0B0C0D0E0F + await VerifyRepeatingAsync( + input: "", + 0, + hexKey: "000102030405060708090A0B0C0D0E0F", + output: "2FEC800CA276C44985A35AEC92067E5E53A1BB80A6FDAB1D9C97D54068118F30AD4C33717466D372EA00BBF126E5B79C6F7143DD36C31F72028330E92AE3A359"); + } } } diff --git a/src/libraries/System.Security.Cryptography/tests/HmacTests.cs b/src/libraries/System.Security.Cryptography/tests/HmacTests.cs index ca266b43921fe4..9083a9fd15e7b5 100644 --- a/src/libraries/System.Security.Cryptography/tests/HmacTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/HmacTests.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.IO; +using System.Threading; +using System.Threading.Tasks; using Test.Cryptography; using Xunit; @@ -31,10 +33,123 @@ protected HmacTests(byte[][] testKeys, byte[][] testData, byte[][] testMacs) protected abstract byte[] HashDataOneShot(ReadOnlySpan key, ReadOnlySpan source); protected abstract int HashDataOneShot(ReadOnlySpan key, ReadOnlySpan source, Span destination); protected abstract bool TryHashDataOneShot(ReadOnlySpan key, ReadOnlySpan source, Span destination, out int written); + protected abstract byte[] HashDataOneShot(ReadOnlySpan key, Stream source); + protected abstract byte[] HashDataOneShot(byte[] key, Stream source); + protected abstract int HashDataOneShot(ReadOnlySpan key, Stream source, Span destination); + + protected abstract ValueTask HashDataOneShotAsync( + ReadOnlyMemory key, + Stream source, + Memory destination, + CancellationToken cancellationToken); + + protected abstract ValueTask HashDataOneShotAsync( + ReadOnlyMemory key, + Stream source, + CancellationToken cancellationToken); + + protected abstract ValueTask HashDataOneShotAsync( + byte[] key, + Stream source, + CancellationToken cancellationToken); protected abstract int BlockSize { get; } protected abstract int MacSize { get; } + protected void VerifyRepeating(string input, int repeatCount, string hexKey, string output) + { + byte[] key = ByteUtils.HexToByteArray(hexKey); + + using (Stream stream = new DataRepeatingStream(input, repeatCount)) + { + VerifyHashDataStreamAllocating(key, stream, output, spanKey: true); + } + + using (Stream stream = new DataRepeatingStream(input, repeatCount)) + { + VerifyHashDataStreamAllocating(key, stream, output, spanKey: false); + } + + using (Stream stream = new DataRepeatingStream(input, repeatCount)) + { + VerifyHashDataStream(key, stream, output); + } + } + + protected async Task VerifyRepeatingAsync(string input, int repeatCount, string hexKey, string output) + { + byte[] key = ByteUtils.HexToByteArray(hexKey); + + using (Stream stream = new DataRepeatingStream(input, repeatCount)) + { + await VerifyHashDataStreamAllocatingAsync(key, stream, output, memoryKey: true); + } + + using (Stream stream = new DataRepeatingStream(input, repeatCount)) + { + await VerifyHashDataStreamAllocatingAsync(key, stream, output, memoryKey: false); + } + + using (Stream stream = new DataRepeatingStream(input, repeatCount)) + { + await VerifyHashDataStreamAsync(key, stream, output); + } + } + + protected void VerifyHashDataStream(ReadOnlySpan key, Stream stream, string output) + { + Span destination = stackalloc byte[MacSize]; + byte[] expected = ByteUtils.HexToByteArray(output); + int written = HashDataOneShot(key, stream, destination); + + Assert.Equal(MacSize, written); + AssertExtensions.SequenceEqual(expected, destination); + } + + protected async Task VerifyHashDataStreamAsync(ReadOnlyMemory key, Stream stream, string output) + { + Memory destination = new byte[MacSize]; + byte[] expected = ByteUtils.HexToByteArray(output); + int written = await HashDataOneShotAsync(key, stream, destination, cancellationToken: default); + + Assert.Equal(MacSize, written); + AssertExtensions.SequenceEqual(expected, destination.Span); + } + + protected void VerifyHashDataStreamAllocating(byte[] key, Stream stream, string output, bool spanKey) + { + byte[] expected = ByteUtils.HexToByteArray(output); + byte[] hmac; + + if (spanKey) + { + hmac = HashDataOneShot(key.AsSpan(), stream); + } + else + { + hmac = HashDataOneShot(key, stream); + } + + Assert.Equal(expected, hmac); + } + + protected async Task VerifyHashDataStreamAllocatingAsync(byte[] key, Stream stream, string output, bool memoryKey) + { + byte[] expected = ByteUtils.HexToByteArray(output); + byte[] hmac; + + if (memoryKey) + { + hmac = await HashDataOneShotAsync(new ReadOnlyMemory(key), stream, cancellationToken: default); + } + else + { + hmac = await HashDataOneShotAsync(key, stream, cancellationToken: default); + } + + Assert.Equal(expected, hmac); + } + protected void VerifyHmac(int testCaseId, byte[] digestBytes) { byte[] data = _testData[testCaseId]; @@ -386,5 +501,111 @@ public void OneShot_Empty_Matches_Instances(byte[] key, byte[] source) Assert.Equal(mac, oneShot); } } + + [Fact] + public void HashData_Stream_Source_Null() + { + AssertExtensions.Throws( + "source", + () => HashDataOneShot(ReadOnlySpan.Empty, (Stream)null)); + + AssertExtensions.Throws( + "source", + () => HashDataOneShot(Array.Empty(), (Stream)null)); + } + + [Fact] + public void HashData_Stream_Source_Null_Async() + { + AssertExtensions.Throws( + "source", + () => HashDataOneShotAsync(ReadOnlyMemory.Empty, (Stream)null, default)); + + AssertExtensions.Throws( + "source", + () => HashDataOneShotAsync(Array.Empty(), (Stream)null, default)); + } + + [Fact] + public void HashData_Stream_ByteKey_Null() + { + AssertExtensions.Throws( + "key", + () => HashDataOneShot((byte[])null, Stream.Null)); + } + + [Fact] + public void HashData_Stream_ByteKey_Null_Async() + { + AssertExtensions.Throws( + "key", + () => HashDataOneShotAsync((byte[])null, Stream.Null, default)); + } + + [Fact] + public void HashData_Stream_DestinationTooSmall() + { + byte[] destination = new byte[MacSize - 1]; + + AssertExtensions.Throws( + "destination", + () => HashDataOneShot(Array.Empty(), Stream.Null, destination)); + AssertExtensions.FilledWith(0, destination); + + AssertExtensions.Throws( + "destination", + () => HashDataOneShot(ReadOnlySpan.Empty, Stream.Null, destination)); + AssertExtensions.FilledWith(0, destination); + } + + [Fact] + public void HashData_Stream_DestinationTooSmall_Async() + { + byte[] destination = new byte[MacSize - 1]; + + AssertExtensions.Throws( + "destination", + () => HashDataOneShotAsync(Array.Empty(), Stream.Null, destination, default)); + AssertExtensions.FilledWith(0, destination); + + AssertExtensions.Throws( + "destination", + () => HashDataOneShotAsync(ReadOnlyMemory.Empty, Stream.Null, destination, default)); + AssertExtensions.FilledWith(0, destination); + } + + [Fact] + public void HashData_Stream_NotReadable() + { + AssertExtensions.Throws( + "source", + () => HashDataOneShot(Array.Empty(), UntouchableStream.Instance)); + + AssertExtensions.Throws( + "source", + () => HashDataOneShot(ReadOnlySpan.Empty, UntouchableStream.Instance)); + } + + [Fact] + public void HashData_Stream_Cancelled() + { + Memory buffer = new byte[512 / 8]; + CancellationToken cancelledToken = new CancellationToken(canceled: true); + ValueTask waitable = HashDataOneShotAsync(ReadOnlyMemory.Empty, Stream.Null, buffer, cancelledToken); + Assert.True(waitable.IsCanceled, nameof(waitable.IsCanceled)); + AssertExtensions.FilledWith(0, buffer.Span); + + waitable = HashDataOneShotAsync(Array.Empty(), Stream.Null, buffer, cancelledToken); + Assert.True(waitable.IsCanceled, nameof(waitable.IsCanceled)); + AssertExtensions.FilledWith(0, buffer.Span); + } + + [Fact] + public void HashData_Stream_Allocating_Cancelled() + { + CancellationToken cancelledToken = new CancellationToken(canceled: true); + ValueTask waitable = HashDataOneShotAsync(ReadOnlyMemory.Empty, Stream.Null, cancelledToken); + Assert.True(waitable.IsCanceled, nameof(waitable.IsCanceled)); + } } } diff --git a/src/libraries/System.Security.Cryptography/tests/MD5Tests.cs b/src/libraries/System.Security.Cryptography/tests/MD5Tests.cs index e301eae2fc3001..26ab965bf4799f 100644 --- a/src/libraries/System.Security.Cryptography/tests/MD5Tests.cs +++ b/src/libraries/System.Security.Cryptography/tests/MD5Tests.cs @@ -1,6 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.IO; +using System.Threading; +using System.Threading.Tasks; using Xunit; namespace System.Security.Cryptography.Tests @@ -25,6 +28,49 @@ protected override bool TryHashData(ReadOnlySpan source, Span destin protected override int HashData(ReadOnlySpan source, Span destination) => MD5.HashData(source, destination); + protected override int HashData(Stream source, Span destination) => + MD5.HashData(source, destination); + + protected override byte[] HashData(Stream source) => MD5.HashData(source); + + protected override ValueTask HashDataAsync(Stream source, Memory destination, CancellationToken cancellationToken) => + MD5.HashDataAsync(source, destination, cancellationToken); + + protected override ValueTask HashDataAsync(Stream source, CancellationToken cancellationToken) => + MD5.HashDataAsync(source, cancellationToken); + + [Fact] + public void MD5_VerifyLargeStream_MultipleOf4096() + { + // Verfied with: + // for _ in {1..1024}; do echo -n "0102030405060708"; done | openssl dgst -md5 + VerifyRepeating("0102030405060708", 1024, "5fc6366852074da6e4795a014574282c"); + } + + [Fact] + public void MD5_VerifyLargeStream_NotMultipleOf4096() + { + // Verfied with: + // for _ in {1..1025}; do echo -n "0102030405060708"; done | openssl dgst -md5 + VerifyRepeating("0102030405060708", 1025, "c5f6181a24446a583b14282f32786513"); + } + + [Fact] + public async Task MD5_VerifyLargeStream_NotMultipleOf4096_Async() + { + // Verfied with: + // for _ in {1..1025}; do echo -n "0102030405060708"; done | openssl dgst -md5 + await VerifyRepeatingAsync("0102030405060708", 1025, "c5f6181a24446a583b14282f32786513"); + } + + [Fact] + public async Task MD5_VerifyLargeStream_MultipleOf4096_Async() + { + // Verfied with: + // for _ in {1..1024}; do echo -n "0102030405060708"; done | openssl dgst -md5 + await VerifyRepeatingAsync("0102030405060708", 1024, "5fc6366852074da6e4795a014574282c"); + } + // Test cases are defined in RFC 1321, section A.5 [Fact] @@ -79,10 +125,28 @@ public void MD5_Rfc1321_7() Verify("12345678901234567890123456789012345678901234567890123456789012345678901234567890", "57edf4a22be3c955ac49da2e2107b67a"); } + [Fact] + public void MD5_Rfc1321_1_AsStream() + { + VerifyRepeating(string.Empty, 0, "d41d8cd98f00b204e9800998ecf8427e"); + } + [Fact] public void MD5_Rfc1321_7_AsStream() { VerifyRepeating("1234567890", 8, "57edf4a22be3c955ac49da2e2107b67a"); } + + [Fact] + public async Task MD5_Rfc1321_1_AsStream_Async() + { + await VerifyRepeatingAsync(string.Empty, 0, "d41d8cd98f00b204e9800998ecf8427e"); + } + + [Fact] + public async Task MD5_Rfc1321_7_AsStream_Async() + { + await VerifyRepeatingAsync("1234567890", 8, "57edf4a22be3c955ac49da2e2107b67a"); + } } } diff --git a/src/libraries/System.Security.Cryptography/tests/Sha1Tests.cs b/src/libraries/System.Security.Cryptography/tests/Sha1Tests.cs index 45d0315852cbe5..46f0f24534348f 100644 --- a/src/libraries/System.Security.Cryptography/tests/Sha1Tests.cs +++ b/src/libraries/System.Security.Cryptography/tests/Sha1Tests.cs @@ -1,6 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.IO; +using System.Threading; +using System.Threading.Tasks; using Xunit; namespace System.Security.Cryptography.Tests @@ -24,12 +27,67 @@ protected override bool TryHashData(ReadOnlySpan source, Span destin protected override int HashData(ReadOnlySpan source, Span destination) => SHA1.HashData(source, destination); + protected override int HashData(Stream source, Span destination) => + SHA1.HashData(source, destination); + + protected override byte[] HashData(Stream source) => SHA1.HashData(source); + + protected override ValueTask HashDataAsync(Stream source, Memory destination, CancellationToken cancellationToken) => + SHA1.HashDataAsync(source, destination, cancellationToken); + + protected override ValueTask HashDataAsync(Stream source, CancellationToken cancellationToken) => + SHA1.HashDataAsync(source, cancellationToken); + [Fact] public void Sha1_Empty() { Verify(Array.Empty(), "DA39A3EE5E6B4B0D3255BFEF95601890AFD80709"); } + [Fact] + public void Sha1_Empty_Stream() + { + VerifyRepeating("", 0, "DA39A3EE5E6B4B0D3255BFEF95601890AFD80709"); + } + + [Fact] + public async Task Sha1_Empty_Stream_Async() + { + await VerifyRepeatingAsync("", 0, "DA39A3EE5E6B4B0D3255BFEF95601890AFD80709"); + } + + [Fact] + public void Sha1_VerifyLargeStream_MultipleOf4096() + { + // Verfied with: + // for _ in {1..1024}; do echo -n "0102030405060708"; done | openssl dgst -sha1 + VerifyRepeating("0102030405060708", 1024, "fc8053215c935a5e9cdc51b94bb40b3e66128d41"); + } + + [Fact] + public void Sha1_VerifyLargeStream_NotMultipleOf4096() + { + // Verfied with: + // for _ in {1..1025}; do echo -n "0102030405060708"; done | openssl dgst -sha1 + VerifyRepeating("0102030405060708", 1025, "18c6aa8d255c47941958729faaae9614c9793bb2"); + } + + [Fact] + public async Task Sha1_VerifyLargeStream_NotMultipleOf4096_Async() + { + // Verfied with: + // for _ in {1..1025}; do echo -n "0102030405060708"; done | openssl dgst -sha1 + await VerifyRepeatingAsync("0102030405060708", 1025, "18c6aa8d255c47941958729faaae9614c9793bb2"); + } + + [Fact] + public async Task Sha1_VerifyLargeStream_MultipleOf4096_Async() + { + // Verfied with: + // for _ in {1..1024}; do echo -n "0102030405060708"; done | openssl dgst -sha1 + await VerifyRepeatingAsync("0102030405060708", 1024, "fc8053215c935a5e9cdc51b94bb40b3e66128d41"); + } + // SHA1 tests are defined somewhat obliquely within RFC 3174, section 7.3 // The same tests appear in http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf Appendix A [Fact] @@ -61,5 +119,17 @@ public void Sha1_Rfc3174_4() { VerifyRepeating("0123456701234567012345670123456701234567012345670123456701234567", 10, "DEA356A2CDDD90C7A7ECEDC5EBB563934F460452"); } + + [Fact] + public async Task Sha1_Rfc3174_3_Async() + { + await VerifyRepeatingAsync("a", 1000000, "34AA973CD4C4DAA4F61EEB2BDBAD27316534016F"); + } + + [Fact] + public async Task Sha1_Rfc3174_4_Async() + { + await VerifyRepeatingAsync("0123456701234567012345670123456701234567012345670123456701234567", 10, "DEA356A2CDDD90C7A7ECEDC5EBB563934F460452"); + } } } diff --git a/src/libraries/System.Security.Cryptography/tests/Sha256Tests.cs b/src/libraries/System.Security.Cryptography/tests/Sha256Tests.cs index e85dddc08d7971..4abad52b940941 100644 --- a/src/libraries/System.Security.Cryptography/tests/Sha256Tests.cs +++ b/src/libraries/System.Security.Cryptography/tests/Sha256Tests.cs @@ -1,6 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.IO; +using System.Threading; +using System.Threading.Tasks; using Xunit; namespace System.Security.Cryptography.Tests @@ -24,6 +27,17 @@ protected override bool TryHashData(ReadOnlySpan source, Span destin protected override int HashData(ReadOnlySpan source, Span destination) => SHA256.HashData(source, destination); + protected override int HashData(Stream source, Span destination) => + SHA256.HashData(source, destination); + + protected override byte[] HashData(Stream source) => SHA256.HashData(source); + + protected override ValueTask HashDataAsync(Stream source, Memory destination, CancellationToken cancellationToken) => + SHA256.HashDataAsync(source, destination, cancellationToken); + + protected override ValueTask HashDataAsync(Stream source, CancellationToken cancellationToken) => + SHA256.HashDataAsync(source, cancellationToken); + [Fact] public void Sha256_Empty() { @@ -32,6 +46,62 @@ public void Sha256_Empty() "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"); } + [Fact] + public void Sha256_Empty_Stream() + { + VerifyRepeating("", 0, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"); + } + + [Fact] + public async Task Sha256_Empty_Stream_Async() + { + await VerifyRepeatingAsync("", 0, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"); + } + + [Fact] + public void Sha256_VerifyLargeStream_MultipleOf4096() + { + // Verfied with: + // for _ in {1..1024}; do echo -n "0102030405060708"; done | openssl dgst -sha256 + VerifyRepeating( + "0102030405060708", + 1024, + "cedca4ad2cce0d0b399931708684800cd16be396ffa5af51297a091650aa3610"); + } + + [Fact] + public void Sha256_VerifyLargeStream_NotMultipleOf4096() + { + // Verfied with: + // for _ in {1..1025}; do echo -n "0102030405060708"; done | openssl dgst -sha256 + VerifyRepeating( + "0102030405060708", + 1025, + "9e2e99445f5349c379ceb4c995dde401f63012422183a411d02eb251b1e02e65"); + } + + [Fact] + public async Task Sha256_VerifyLargeStream_NotMultipleOf4096_Async() + { + // Verfied with: + // for _ in {1..1025}; do echo -n "0102030405060708"; done | openssl dgst -sha256 + await VerifyRepeatingAsync( + "0102030405060708", + 1025, + "9e2e99445f5349c379ceb4c995dde401f63012422183a411d02eb251b1e02e65"); + } + + [Fact] + public async Task Sha256_VerifyLargeStream_MultipleOf4096_Async() + { + // Verfied with: + // for _ in {1..1024}; do echo -n "0102030405060708"; done | openssl dgst -sha256 + await VerifyRepeatingAsync( + "0102030405060708", + 1024, + "cedca4ad2cce0d0b399931708684800cd16be396ffa5af51297a091650aa3610"); + } + // These test cases are from http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf Appendix B [Fact] public void Sha256_Fips180_1() @@ -67,5 +137,14 @@ public void Sha256_Fips180_3() 1000000, "cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0"); } + + [Fact] + public async Task Sha256_Fips180_3_Async() + { + await VerifyRepeatingAsync( + "a", + 1000000, + "cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0"); + } } } diff --git a/src/libraries/System.Security.Cryptography/tests/Sha384Tests.cs b/src/libraries/System.Security.Cryptography/tests/Sha384Tests.cs index 5ef3ebcb4e039e..c7cfea805683c7 100644 --- a/src/libraries/System.Security.Cryptography/tests/Sha384Tests.cs +++ b/src/libraries/System.Security.Cryptography/tests/Sha384Tests.cs @@ -1,6 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.IO; +using System.Threading; +using System.Threading.Tasks; using Xunit; namespace System.Security.Cryptography.Tests @@ -24,6 +27,17 @@ protected override bool TryHashData(ReadOnlySpan source, Span destin protected override int HashData(ReadOnlySpan source, Span destination) => SHA384.HashData(source, destination); + protected override int HashData(Stream source, Span destination) => + SHA384.HashData(source, destination); + + protected override byte[] HashData(Stream source) => SHA384.HashData(source); + + protected override ValueTask HashDataAsync(Stream source, Memory destination, CancellationToken cancellationToken) => + SHA384.HashDataAsync(source, destination, cancellationToken); + + protected override ValueTask HashDataAsync(Stream source, CancellationToken cancellationToken) => + SHA384.HashDataAsync(source, cancellationToken); + [Fact] public void Sha384_Empty() { @@ -32,6 +46,68 @@ public void Sha384_Empty() "38B060A751AC96384CD9327EB1B1E36A21FDB71114BE07434C0CC7BF63F6E1DA274EDEBFE76F65FBD51AD2F14898B95B"); } + [Fact] + public void Sha384_Empty_Stream() + { + VerifyRepeating( + "", + 0, + "38B060A751AC96384CD9327EB1B1E36A21FDB71114BE07434C0CC7BF63F6E1DA274EDEBFE76F65FBD51AD2F14898B95B"); + } + + [Fact] + public async Task Sha384_Empty_Stream_Async() + { + await VerifyRepeatingAsync( + "", + 0, + "38B060A751AC96384CD9327EB1B1E36A21FDB71114BE07434C0CC7BF63F6E1DA274EDEBFE76F65FBD51AD2F14898B95B"); + } + + [Fact] + public void Sha384_VerifyLargeStream_MultipleOf4096() + { + // Verfied with: + // for _ in {1..1024}; do echo -n "0102030405060708"; done | openssl dgst -sha384 + VerifyRepeating( + "0102030405060708", + 1024, + "d9deec18b8ec0d31270eaeaaf3bcb1de55f1d81482a55d2c023bad873175f1694d8c28e8138d9147dc180e679cd79c58"); + } + + [Fact] + public void Sha384_VerifyLargeStream_NotMultipleOf4096() + { + // Verfied with: + // for _ in {1..1025}; do echo -n "0102030405060708"; done | openssl dgst -sha384 + VerifyRepeating( + "0102030405060708", + 1025, + "35cf18493364379093c7def8477330f817f9045d2e311d721730b24d98c9d9e9761c7f27821742e0c236509627aea7fa"); + } + + [Fact] + public async Task Sha384_VerifyLargeStream_NotMultipleOf4096_Async() + { + // Verfied with: + // for _ in {1..1025}; do echo -n "0102030405060708"; done | openssl dgst -sha384 + await VerifyRepeatingAsync( + "0102030405060708", + 1025, + "35cf18493364379093c7def8477330f817f9045d2e311d721730b24d98c9d9e9761c7f27821742e0c236509627aea7fa"); + } + + [Fact] + public async Task Sha384_VerifyLargeStream_MultipleOf4096_Async() + { + // Verfied with: + // for _ in {1..1024}; do echo -n "0102030405060708"; done | openssl dgst -sha384 + await VerifyRepeatingAsync( + "0102030405060708", + 1024, + "d9deec18b8ec0d31270eaeaaf3bcb1de55f1d81482a55d2c023bad873175f1694d8c28e8138d9147dc180e679cd79c58"); + } + // These test cases are from http://csrc.nist.gov/groups/ST/toolkit/documents/Examples/SHA_All.pdf [Fact] public void Sha384_NistShaAll_1() @@ -42,7 +118,7 @@ public void Sha384_NistShaAll_1() } [Fact] - public void Sha256_Fips180_MultiBlock() + public void Sha384_Fips180_MultiBlock() { VerifyMultiBlock( "a", diff --git a/src/libraries/System.Security.Cryptography/tests/Sha512Tests.cs b/src/libraries/System.Security.Cryptography/tests/Sha512Tests.cs index 4586a08d846b07..465f41c15fdf69 100644 --- a/src/libraries/System.Security.Cryptography/tests/Sha512Tests.cs +++ b/src/libraries/System.Security.Cryptography/tests/Sha512Tests.cs @@ -1,6 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.IO; +using System.Threading; +using System.Threading.Tasks; using Xunit; namespace System.Security.Cryptography.Tests @@ -24,6 +27,17 @@ protected override bool TryHashData(ReadOnlySpan source, Span destin protected override int HashData(ReadOnlySpan source, Span destination) => SHA512.HashData(source, destination); + protected override int HashData(Stream source, Span destination) => + SHA512.HashData(source, destination); + + protected override byte[] HashData(Stream source) => SHA512.HashData(source); + + protected override ValueTask HashDataAsync(Stream source, Memory destination, CancellationToken cancellationToken) => + SHA512.HashDataAsync(source, destination, cancellationToken); + + protected override ValueTask HashDataAsync(Stream source, CancellationToken cancellationToken) => + SHA512.HashDataAsync(source, cancellationToken); + [Fact] public void Sha512_Empty() { @@ -32,6 +46,68 @@ public void Sha512_Empty() "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e"); } + [Fact] + public void Sha512_Empty_Stream() + { + VerifyRepeating( + "", + 0, + "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e"); + } + + [Fact] + public async Task Sha512_Empty_Stream_Async() + { + await VerifyRepeatingAsync( + "", + 0, + "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e"); + } + + [Fact] + public void Sha512_VerifyLargeStream_MultipleOf4096() + { + // Verfied with: + // for _ in {1..1024}; do echo -n "0102030405060708"; done | openssl dgst -sha512 + VerifyRepeating( + "0102030405060708", + 1024, + "da1bdf4632ea5ee0724a57a9bc6fd409d7f8f7417373356281ce36f82b510da95c7dff7d64a43b3cf4854894e124f56b349749a3f76b41611c01fee739f4d923"); + } + + [Fact] + public void Sha512_VerifyLargeStream_NotMultipleOf4096() + { + // Verfied with: + // for _ in {1..1025}; do echo -n "0102030405060708"; done | openssl dgst -sha512 + VerifyRepeating( + "0102030405060708", + 1025, + "65de1e49167977ade93d12115d0f5915a988b7e0ab73f2b554bd6d87c17155e865ba434a88271fb2dbaf5f9b0cf71d627eaea6b0efce5ec95e4c6017bfbfb34b"); + } + + [Fact] + public async Task Sha512_VerifyLargeStream_NotMultipleOf4096_Async() + { + // Verfied with: + // for _ in {1..1025}; do echo -n "0102030405060708"; done | openssl dgst -sha512 + await VerifyRepeatingAsync( + "0102030405060708", + 1025, + "65de1e49167977ade93d12115d0f5915a988b7e0ab73f2b554bd6d87c17155e865ba434a88271fb2dbaf5f9b0cf71d627eaea6b0efce5ec95e4c6017bfbfb34b"); + } + + [Fact] + public async Task Sha512_VerifyLargeStream_MultipleOf4096_Async() + { + // Verfied with: + // for _ in {1..1024}; do echo -n "0102030405060708"; done | openssl dgst -sha512 + await VerifyRepeatingAsync( + "0102030405060708", + 1024, + "da1bdf4632ea5ee0724a57a9bc6fd409d7f8f7417373356281ce36f82b510da95c7dff7d64a43b3cf4854894e124f56b349749a3f76b41611c01fee739f4d923"); + } + // These test cases are from http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf Appendix C [Fact] public void Sha512_Fips180_1() @@ -67,5 +143,14 @@ public void Sha512_Fips180_3() 1000000, "e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973ebde0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b"); } + + [Fact] + public async Task Sha512_Fips180_3_Async() + { + await VerifyRepeatingAsync( + "a", + 1000000, + "e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973ebde0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b"); + } } } diff --git a/src/libraries/System.Security.Cryptography/tests/StreamHelpers.cs b/src/libraries/System.Security.Cryptography/tests/StreamHelpers.cs new file mode 100644 index 00000000000000..022084779355c8 --- /dev/null +++ b/src/libraries/System.Security.Cryptography/tests/StreamHelpers.cs @@ -0,0 +1,147 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.IO; +using Test.Cryptography; + +namespace System.Security.Cryptography.Tests +{ + internal class DataRepeatingStream : Stream + { + private int _remaining; + private byte[] _data; + + public DataRepeatingStream(string data, int repeatCount) + { + _remaining = repeatCount; + _data = ByteUtils.AsciiBytes(data); + } + + public override int Read(byte[] buffer, int offset, int count) + { + if (!CanRead) + { + throw new NotSupportedException(); + } + + if (_remaining == 0) + { + return 0; + } + + if (count < _data.Length) + { + throw new InvalidOperationException(); + } + + // For (about) half of the reads, we'll read one less byte + // than was asked for. This is to make sure stream readers + // conform to the expectation that Read MAY return less than + // was asked for. + if (count > 1 && Random.Shared.Next(2) == 0) + { + count--; + } + + int multiple = count / _data.Length; + + if (multiple > _remaining) + { + multiple = _remaining; + } + + int localOffset = offset; + + for (int i = 0; i < multiple; i++) + { + Buffer.BlockCopy(_data, 0, buffer, localOffset, _data.Length); + localOffset += _data.Length; + } + + _remaining -= multiple; + return _data.Length * multiple; + } + + protected override void Dispose(bool disposing) + { + if (disposing) + { + _data = null; + } + } + + public override void Flush() + { + } + + public override long Seek(long offset, SeekOrigin origin) + { + throw new NotSupportedException(); + } + + public override void SetLength(long value) + { + throw new NotSupportedException(); + } + + public override void Write(byte[] buffer, int offset, int count) + { + throw new NotSupportedException(); + } + + public override bool CanRead { get { return _data != null; } } + public override bool CanSeek { get { return false; } } + public override bool CanWrite { get { return false; } } + public override long Length { get { throw new NotSupportedException(); } } + + public override long Position + { + get { throw new NotSupportedException(); } + set { throw new NotSupportedException(); } + } + } + + internal class UntouchableStream : Stream + { + public static Stream Instance { get; } = new UntouchableStream(); + + public override bool CanRead => false; + + public override bool CanSeek => false; + + public override bool CanWrite => false; + + public override long Length => throw new NotSupportedException(); + + public override long Position + { + get => throw new NotSupportedException(); + set => throw new NotSupportedException(); + } + + public override void Flush() + { + throw new NotSupportedException(); + } + + public override int Read(byte[] buffer, int offset, int count) + { + throw new NotSupportedException(); + } + + public override long Seek(long offset, SeekOrigin origin) + { + throw new NotSupportedException(); + } + + public override void SetLength(long value) + { + throw new NotSupportedException(); + } + + public override void Write(byte[] buffer, int offset, int count) + { + throw new NotSupportedException(); + } + } +} diff --git a/src/libraries/System.Security.Cryptography/tests/System.Security.Cryptography.Tests.csproj b/src/libraries/System.Security.Cryptography/tests/System.Security.Cryptography.Tests.csproj index 8621f98748bd14..dafa4adb4bff23 100644 --- a/src/libraries/System.Security.Cryptography/tests/System.Security.Cryptography.Tests.csproj +++ b/src/libraries/System.Security.Cryptography/tests/System.Security.Cryptography.Tests.csproj @@ -265,6 +265,7 @@ + From 85413211c0c915dd1a3b25b88171e2a500e24bb0 Mon Sep 17 00:00:00 2001 From: Tlakaelel Axayakatl Ceja Date: Sun, 23 Jan 2022 18:09:41 -0800 Subject: [PATCH 015/161] Title and message resources should be enforced to exist to prevent printing empty messages (#64151) Sync ILLink.Shared folder with the latest version in dotnet/linker main branch List of changes include: - Enforce title and message resources to exist to prevent printing empty messages - All diagnostics produced by linker now have a DiagnosticId, a title and a message - Schema for xml link attributes file - Added a readme file to the ILLink.Shared project to keep track of the commit is being used from dotnet/linker --- src/coreclr/tools/Common/Compiler/Logger.cs | 8 +- .../Compiler/Logging/MessageContainer.cs | 2 + .../Compiler/Dataflow/FlowAnnotations.cs | 2 + .../Dataflow/ReflectionMethodBodyScanner.cs | 16 +- .../Dataflow/ReflectionPatternContext.cs | 2 + .../Compiler/LazyGenerics/ModuleCycleInfo.cs | 2 + .../Compiler/UsageBasedMetadataManager.cs | 1 + .../ILCompiler.ReadyToRun.csproj | 1 + .../Compiler/RyuJitCompilation.cs | 1 + .../tools/aot/ILCompiler/ILCompiler.csproj | 8 +- .../tools/aot/ILLink.Shared/DiagnosticId.cs | 156 ++- .../aot/ILLink.Shared/DiagnosticString.cs | 10 +- .../ILLink.Shared/ILLink.LinkAttributes.xsd | 124 +++ .../aot/ILLink.Shared/ILLink.Shared.projitems | 8 +- .../aot/ILLink.Shared/MessageSubCategory.cs | 13 + src/coreclr/tools/aot/ILLink.Shared/README.md | 1 + .../aot/ILLink.Shared/SharedStrings.resx | 999 +++++++++++++++++- 17 files changed, 1278 insertions(+), 76 deletions(-) create mode 100644 src/coreclr/tools/aot/ILLink.Shared/ILLink.LinkAttributes.xsd create mode 100644 src/coreclr/tools/aot/ILLink.Shared/MessageSubCategory.cs create mode 100644 src/coreclr/tools/aot/ILLink.Shared/README.md diff --git a/src/coreclr/tools/Common/Compiler/Logger.cs b/src/coreclr/tools/Common/Compiler/Logger.cs index eb77c7cd681e12..26f763b815595f 100644 --- a/src/coreclr/tools/Common/Compiler/Logger.cs +++ b/src/coreclr/tools/Common/Compiler/Logger.cs @@ -10,6 +10,7 @@ using Internal.TypeSystem.Ecma; using ILCompiler.Logging; +using ILLink.Shared; using ILSequencePoint = Internal.IL.ILSequencePoint; using MethodIL = Internal.IL.MethodIL; @@ -198,11 +199,4 @@ private static string GetModuleFileName(ModuleDesc module) return assemblyName; } } - - public static class MessageSubCategory - { - public const string None = ""; - public const string TrimAnalysis = "Trim analysis"; - public const string AotAnalysis = "AOT analysis"; - } } diff --git a/src/coreclr/tools/Common/Compiler/Logging/MessageContainer.cs b/src/coreclr/tools/Common/Compiler/Logging/MessageContainer.cs index 95ed5bf04fa0cf..ebe08a14870ed2 100644 --- a/src/coreclr/tools/Common/Compiler/Logging/MessageContainer.cs +++ b/src/coreclr/tools/Common/Compiler/Logging/MessageContainer.cs @@ -6,6 +6,8 @@ using Internal.TypeSystem; using Internal.TypeSystem.Ecma; +using ILLink.Shared; + using Debug = System.Diagnostics.Debug; namespace ILCompiler.Logging diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/FlowAnnotations.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/FlowAnnotations.cs index f3585e0e098f06..64ce9a5ba1218c 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/FlowAnnotations.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/FlowAnnotations.cs @@ -10,6 +10,8 @@ using Internal.TypeSystem; using Internal.TypeSystem.Ecma; +using ILLink.Shared; + using Debug = System.Diagnostics.Debug; namespace ILCompiler.Dataflow diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReflectionMethodBodyScanner.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReflectionMethodBodyScanner.cs index 06d371cd17aea0..1f198fbc155e7a 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReflectionMethodBodyScanner.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReflectionMethodBodyScanner.cs @@ -1029,8 +1029,8 @@ public override bool HandleCall(MethodIL callingMethodBody, MethodDesc calledMet // We don't know what method the `MakeGenericMethod` was called on, so we have to assume // that the method may have requirements which we can't fullfil -> warn. reflectionContext.RecordUnrecognizedPattern( - (int)DiagnosticId.MakeGenericMethodCannotBeStaticallyAnalyzed, - new DiagnosticString(DiagnosticId.MakeGenericMethodCannotBeStaticallyAnalyzed).GetMessage(DiagnosticUtilities.GetMethodSignatureDisplayName(calledMethod))); + (int)DiagnosticId.MakeGenericMethod, + new DiagnosticString(DiagnosticId.MakeGenericMethod).GetMessage(DiagnosticUtilities.GetMethodSignatureDisplayName(calledMethod))); } RequireDynamicallyAccessedMembers( @@ -1048,8 +1048,8 @@ public override bool HandleCall(MethodIL callingMethodBody, MethodDesc calledMet // We don't know what method the `MakeGenericMethod` was called on, so we have to assume // that the method may have requirements which we can't fullfil -> warn. reflectionContext.RecordUnrecognizedPattern( - (int)DiagnosticId.MakeGenericMethodCannotBeStaticallyAnalyzed, - new DiagnosticString(DiagnosticId.MakeGenericMethodCannotBeStaticallyAnalyzed).GetMessage(DiagnosticUtilities.GetMethodSignatureDisplayName(calledMethod))); + (int)DiagnosticId.MakeGenericMethod, + new DiagnosticString(DiagnosticId.MakeGenericMethod).GetMessage(DiagnosticUtilities.GetMethodSignatureDisplayName(calledMethod))); } RequireDynamicallyAccessedMembers( @@ -2162,8 +2162,8 @@ public override bool HandleCall(MethodIL callingMethodBody, MethodDesc calledMet // We don't know what method the `MakeGenericMethod` was called on, so we have to assume // that the method may have requirements which we can't fullfil -> warn. reflectionContext.RecordUnrecognizedPattern( - (int)DiagnosticId.MakeGenericMethodCannotBeStaticallyAnalyzed, - new DiagnosticString(DiagnosticId.MakeGenericMethodCannotBeStaticallyAnalyzed).GetMessage( + (int)DiagnosticId.MakeGenericMethod, + new DiagnosticString(DiagnosticId.MakeGenericMethod).GetMessage( DiagnosticUtilities.GetMethodSignatureDisplayName(calledMethod))); } } @@ -3066,8 +3066,8 @@ void ValidateGenericMethodInstantiation( if (!AnalyzeGenericInstantiationTypeArray(genericParametersArray, ref reflectionContext, reflectionMethod, genericMethod.GetMethodDefinition().Instantiation)) { reflectionContext.RecordUnrecognizedPattern( - (int)DiagnosticId.MakeGenericMethodCannotBeStaticallyAnalyzed, - new DiagnosticString(DiagnosticId.MakeGenericMethodCannotBeStaticallyAnalyzed).GetMessage(DiagnosticUtilities.GetMethodSignatureDisplayName(reflectionMethod))); + (int)DiagnosticId.MakeGenericMethod, + new DiagnosticString(DiagnosticId.MakeGenericMethod).GetMessage(DiagnosticUtilities.GetMethodSignatureDisplayName(reflectionMethod))); } else { diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReflectionPatternContext.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReflectionPatternContext.cs index 99d97784e78119..61a48fe965a0c4 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReflectionPatternContext.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReflectionPatternContext.cs @@ -7,6 +7,8 @@ using Internal.IL; using Internal.TypeSystem; +using ILLink.Shared; + namespace ILCompiler.Dataflow { /// diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/LazyGenerics/ModuleCycleInfo.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/LazyGenerics/ModuleCycleInfo.cs index 378af488af0208..07e2768797cabe 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/LazyGenerics/ModuleCycleInfo.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/LazyGenerics/ModuleCycleInfo.cs @@ -8,6 +8,8 @@ using Internal.TypeSystem; using Internal.TypeSystem.Ecma; +using ILLink.Shared; + using Debug = System.Diagnostics.Debug; namespace ILCompiler diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/UsageBasedMetadataManager.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/UsageBasedMetadataManager.cs index 439d4e014e6db3..971d932be8c10c 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/UsageBasedMetadataManager.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/UsageBasedMetadataManager.cs @@ -15,6 +15,7 @@ using ILCompiler.Metadata; using ILCompiler.DependencyAnalysis; using ILCompiler.DependencyAnalysisFramework; +using ILLink.Shared; using FlowAnnotations = ILCompiler.Dataflow.FlowAnnotations; using DependencyList = ILCompiler.DependencyAnalysisFramework.DependencyNodeCore.DependencyList; diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ILCompiler.ReadyToRun.csproj b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ILCompiler.ReadyToRun.csproj index 5154db358a8b8e..6c7d67517a9ee1 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ILCompiler.ReadyToRun.csproj +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ILCompiler.ReadyToRun.csproj @@ -283,4 +283,5 @@ + diff --git a/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs b/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs index 0d8b11c51f82e2..b27f7db8ec7d8e 100644 --- a/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs +++ b/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs @@ -9,6 +9,7 @@ using ILCompiler.DependencyAnalysis; using ILCompiler.DependencyAnalysisFramework; +using ILLink.Shared; using Internal.IL; using Internal.IL.Stubs; diff --git a/src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj b/src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj index 6c559924f405c6..6c5a4a6d377d85 100644 --- a/src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj +++ b/src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj @@ -1,4 +1,4 @@ - + ilc true @@ -121,10 +121,6 @@ On Linux renaming the library makes it difficult to debug it. --> - + diff --git a/src/coreclr/tools/aot/ILLink.Shared/DiagnosticId.cs b/src/coreclr/tools/aot/ILLink.Shared/DiagnosticId.cs index 8bffef3ab0e5b5..e25b16f8ef8447 100644 --- a/src/coreclr/tools/aot/ILLink.Shared/DiagnosticId.cs +++ b/src/coreclr/tools/aot/ILLink.Shared/DiagnosticId.cs @@ -5,17 +5,123 @@ namespace ILLink.Shared { public enum DiagnosticId { + // Linker error ids. + XmlFeatureDoesNotSpecifyFeatureValue = 1001, + XmlUnsupportedNonBooleanValueForFeature = 1002, + XmlException = 1003, + _unused_FailedToProcessDescriptorFile = 1004, + CouldNotFindMethodInAssembly = 1005, + CannotStubConstructorWhenBaseTypeDoesNotHaveConstructor = 1006, + CouldNotFindType = 1007, + CouldNotFindConstructor = 1008, + CouldNotFindAssemblyReference = 1009, + CouldNotLoadAssembly = 1010, + FailedToWriteOutput = 1011, + LinkerUnexpectedError = 1012, + ErrorProcessingXmlLocation = 1013, + XmlDocumentLocationHasInvalidFeatureDefault = 1014, + UnrecognizedCommandLineOption = 1015, + InvalidWarningVersion = 1016, + InvalidGenerateWarningSuppressionsValue = 1017, + MissingArgumentForCommanLineOptionName = 1018, + CustomDataFormatIsInvalid = 1019, + NoFilesToLinkSpecified = 1020, + NewMvidAndDeterministicCannotBeUsedAtSameTime = 1021, + AssemblyInCustomStepOptionCouldNotBeFound = 1022, + AssemblyPathInCustomStepMustBeFullyQualified = 1023, + InvalidArgForCustomStep = 1024, + ExpectedSignToControlNewStepInsertion = 1025, + PipelineStepCouldNotBeFound = 1026, + CustomStepTypeCouldNotBeFound = 1027, + CustomStepTypeIsIncompatibleWithLinkerVersion = 1028, + InvalidOptimizationValue = 1029, + InvalidArgumentForTokenOption = 1030, + InvalidAssemblyAction = 1031, + RootAssemblyCouldNotBeFound = 1032, + XmlDescriptorCouldNotBeFound = 1033, + RootAssemblyDoesNotHaveEntryPoint = 1034, + RootAssemblyCannotUseAction = 1035, + InvalidAssemblyName = 1036, + InvalidAssemblyRootMode = 1037, + ExportedTypeCannotBeResolved = 1038, + ReferenceAssemblyCouldNotBeLoaded = 1039, + FailedToResolveMetadataElement = 1040, + TypeUsedWithAttributeValueCouldNotBeFound = 1041, + CannotConverValueToType = 1042, + CustomAttributeArgumentForTypeRequiresNestedNode = 1043, + CouldNotResolveCustomAttributeTypeValue = 1044, + UnexpectedAttributeArgumentType = 1045, + InvalidMetadataOption = 1046, + // Linker diagnostic ids. + TypeHasNoFieldsToPreserve = 2001, + TypeHasNoMethodsToPreserve = 2002, + CouldNotResolveDependencyAssembly = 2003, + CouldNotResolveDependencyType = 2004, + CouldNotResolveDependencyMember = 2005, + _unused_UnrecognizedReflectionPattern = 2006, + XmlCouldNotResolveAssembly = 2007, + XmlCouldNotResolveType = 2008, + XmlCouldNotFindMethodOnType = 2009, + XmlInvalidValueForStub = 2010, + XmlUnkownBodyModification = 2011, + XmlCouldNotFindFieldOnType = 2012, + XmlSubstitutedFieldNeedsToBeStatic = 2013, + XmlMissingSubstitutionValueForField = 2014, + XmlInvalidSubstitutionValueForField = 2015, + XmlCouldNotFindEventOnType = 2016, + XmlCouldNotFindPropertyOnType = 2017, + XmlCouldNotFindGetAccesorOfPropertyOnType = 2018, + XmlCouldNotFindSetAccesorOfPropertyOnType = 2019, + _unused_RearrangedXmlWarning1 = 2020, + _unused_RearrangedXmlWarning2 = 2021, + XmlCouldNotFindMatchingConstructorForCustomAttribute = 2022, + XmlMoreThanOneReturnElementForMethod = 2023, + XmlMoreThanOneValyForParameterOfMethod = 2024, + XmlDuplicatePreserveMember = 2025, RequiresUnreferencedCode = 2026, + AttributeShouldOnlyBeUsedOnceOnMember = 2027, + AttributeDoesntHaveTheRequiredNumberOfParameters = 2028, + XmlElementDoesNotContainRequiredAttributeFullname = 2029, + XmlCouldNotResolveAssemblyForAttribute = 2030, + XmlAttributeTypeCouldNotBeFound = 2031, + UnrecognizedParameterInMethodCreateInstance = 2032, + DeprecatedPreserveDependencyAttribute = 2033, + DynamicDependencyAttributeCouldNotBeAnalyzed = 2034, + UnresolvedAssemblyInDynamicDependencyAttribute = 2035, + UnresolvedTypeInDynamicDependencyAttribute = 2036, + NoMembersResolvedForMemberSignatureOrType = 2037, + XmlMissingNameAttributeInResource = 2038, + XmlInvalidValueForAttributeActionForResource = 2039, + XmlCouldNotFindResourceToRemoveInAssembly = 2040, + DynamicallyAccessedMembersIsNotAllowedOnMethods = 2041, + DynamicallyAccessedMembersCouldNotFindBackingField = 2042, + DynamicallyAccessedMembersConflictsBetweenPropertyAndAccessor = 2043, + XmlCouldNotFindAnyTypeInNamespace = 2044, + AttributeIsReferencedButTrimmerRemoveAllInstances = 2045, RequiresUnreferencedCodeAttributeMismatch = 2046, + _unused_DynamicallyAccessedMembersMismatchBetweenOverrides = 2047, + XmlRemoveAttributeInstancesCanOnlyBeUsedOnType = 2048, + _unused_UnrecognizedInternalAttribute = 2049, CorrectnessOfCOMCannotBeGuaranteed = 2050, + XmlPropertyDoesNotContainAttributeName = 2051, + XmlCouldNotFindProperty = 2052, + _unused_XmlInvalidPropertyValueForProperty = 2053, + _unused_XmlInvalidArgumentForParameterOfType = 2054, MakeGenericType = 2055, + DynamicallyAccessedMembersOnPropertyConflictsWithBackingField = 2056, + UnrecognizedTypeNameInTypeGetType = 2057, + ParametersOfAssemblyCreateInstanceCannotBeAnalyzed = 2058, + UnrecognizedTypeInRuntimeHelpersRunClassConstructor = 2059, MakeGenericMethod = 2060, - RequiresOnBaseClass = 2109, - RequiresUnreferencedCodeOnStaticConstructor = 2116, + UnresolvedAssemblyInCreateInstance = 2061, + MethodParameterCannotBeStaticallyDetermined = 2062, + MethodReturnValueCannotBeStaticallyDetermined = 2063, + FieldValueCannotBeStaticallyDetermined = 2064, + ImplicitThisCannotBeStaticallyDetermined = 2065, + TypePassedToGenericParameterCannotBeStaticallyDetermined = 2066, // Dynamically Accessed Members attribute mismatch. - MakeGenericMethodCannotBeStaticallyAnalyzed = 2060, DynamicallyAccessedMembersMismatchParameterTargetsParameter = 2067, DynamicallyAccessedMembersMismatchParameterTargetsMethodReturnType = 2068, DynamicallyAccessedMembersMismatchParameterTargetsField = 2069, @@ -41,7 +147,32 @@ public enum DiagnosticId DynamicallyAccessedMembersMismatchTypeArgumentTargetsField = 2089, DynamicallyAccessedMembersMismatchTypeArgumentTargetsThisParameter = 2090, DynamicallyAccessedMembersMismatchTypeArgumentTargetsGenericParameter = 2091, + DynamicallyAccessedMembersMismatchOnMethodParameterBetweenOverrides = 2092, + DynamicallyAccessedMembersMismatchOnMethodReturnValueBetweenOverrides = 2093, + DynamicallyAccessedMembersMismatchOnImplicitThisBetweenOverrides = 2094, + DynamicallyAccessedMembersMismatchOnGenericParameterBetweenOverrides = 2095, + + CaseInsensitiveTypeGetTypeCallIsNotSupported = 2096, + DynamicallyAccessedMembersOnFieldCanOnlyApplyToTypesOrStrings = 2097, + DynamicallyAccessedMembersOnMethodParameterCanOnlyApplyToTypesOrStrings = 2098, + DynamicallyAccessedMembersOnPropertyCanOnlyApplyToTypesOrStrings = 2099, + XmlUnsuportedWildcard = 2100, + AssemblyWithEmbeddedXmlApplyToAnotherAssembly = 2101, + InvalidIsTrimmableValue = 2102, PropertyAccessorParameterInLinqExpressionsCannotBeStaticallyDetermined = 2103, + AssemblyProducedTrimWarnings = 2104, + TypeWasNotFoundInAssemblyNorBaseLibrary = 2105, + DynamicallyAccessedMembersOnMethodReturnValueCanOnlyApplyToTypesOrStrings = 2106, + MethodsAreAssociatedWithStateMachine = 2107, + InvalidScopeInUnconditionalSuppressMessage = 2108, + RequiresUnreferencedCodeOnBaseClass = 2109, + DynamicallyAccessedMembersFieldAccessedViaReflection = 2110, + DynamicallyAccessedMembersMethodAccessedViaReflection = 2111, + DynamicallyAccessedMembersOnTypeReferencesMemberWithRequiresUnreferencedCode = 2112, + DynamicallyAccessedMembersOnTypeReferencesMemberOnBaseWithRequiresUnreferencedCode = 2113, + DynamicallyAccessedMembersOnTypeReferencesMemberWithDynamicallyAccessedMembers = 2114, + DynamicallyAccessedMembersOnTypeReferencesMemberOnBaseWithDynamicallyAccessedMembers = 2115, + RequiresUnreferencedCodeOnStaticConstructor = 2116, // Single-file diagnostic ids. AvoidAssemblyLocationInSingleFile = 3000, @@ -62,5 +193,24 @@ public enum DiagnosticId public static class DiagnosticIdExtensions { public static string AsString(this DiagnosticId diagnosticId) => $"IL{(int)diagnosticId}"; + + public static string GetDiagnosticSubcategory(this DiagnosticId diagnosticId) => + (int)diagnosticId switch + { + 2026 => MessageSubCategory.TrimAnalysis, + 2032 => MessageSubCategory.TrimAnalysis, + 2041 => MessageSubCategory.TrimAnalysis, + 2042 => MessageSubCategory.TrimAnalysis, + 2043 => MessageSubCategory.TrimAnalysis, + 2045 => MessageSubCategory.TrimAnalysis, + 2046 => MessageSubCategory.TrimAnalysis, + 2050 => MessageSubCategory.TrimAnalysis, + var x when x >= 2055 && x <= 2099 => MessageSubCategory.TrimAnalysis, + 2103 => MessageSubCategory.TrimAnalysis, + 2106 => MessageSubCategory.TrimAnalysis, + 2107 => MessageSubCategory.TrimAnalysis, + var x when x >= 2109 && x <= 2116 => MessageSubCategory.TrimAnalysis, + _ => MessageSubCategory.None, + }; } } diff --git a/src/coreclr/tools/aot/ILLink.Shared/DiagnosticString.cs b/src/coreclr/tools/aot/ILLink.Shared/DiagnosticString.cs index 103b93ed28bb01..f14b58b0600830 100644 --- a/src/coreclr/tools/aot/ILLink.Shared/DiagnosticString.cs +++ b/src/coreclr/tools/aot/ILLink.Shared/DiagnosticString.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System; + namespace ILLink.Shared { public readonly struct DiagnosticString @@ -11,15 +13,15 @@ public readonly struct DiagnosticString public DiagnosticString(DiagnosticId diagnosticId) { var resourceManager = SharedStrings.ResourceManager; - _titleFormat = resourceManager.GetString($"{diagnosticId}Title") ?? string.Empty; - _messageFormat = resourceManager.GetString($"{diagnosticId}Message") ?? string.Empty; + _titleFormat = resourceManager.GetString($"{diagnosticId}Title") ?? throw new InvalidOperationException($"{diagnosticId} does not have a matching resource called {diagnosticId}Title"); + _messageFormat = resourceManager.GetString($"{diagnosticId}Message") ?? throw new InvalidOperationException($"{diagnosticId} does not have a matching resource called {diagnosticId}Message"); } public DiagnosticString(string diagnosticResourceStringName) { var resourceManager = SharedStrings.ResourceManager; - _titleFormat = resourceManager.GetString($"{diagnosticResourceStringName}Title") ?? string.Empty; - _messageFormat = resourceManager.GetString($"{diagnosticResourceStringName}Message") ?? string.Empty; + _titleFormat = resourceManager.GetString($"{diagnosticResourceStringName}Title") ?? throw new InvalidOperationException($"{diagnosticResourceStringName} does not have a matching resource called {diagnosticResourceStringName}Title"); + _messageFormat = resourceManager.GetString($"{diagnosticResourceStringName}Message") ?? throw new InvalidOperationException($"{diagnosticResourceStringName} does not have a matching resource called {diagnosticResourceStringName}Message"); } public string GetMessage(params string[] args) => diff --git a/src/coreclr/tools/aot/ILLink.Shared/ILLink.LinkAttributes.xsd b/src/coreclr/tools/aot/ILLink.Shared/ILLink.LinkAttributes.xsd new file mode 100644 index 00000000000000..f1156b0a4d6902 --- /dev/null +++ b/src/coreclr/tools/aot/ILLink.Shared/ILLink.LinkAttributes.xsd @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/coreclr/tools/aot/ILLink.Shared/ILLink.Shared.projitems b/src/coreclr/tools/aot/ILLink.Shared/ILLink.Shared.projitems index 0a61390d8d025e..ffbfab3b98417f 100644 --- a/src/coreclr/tools/aot/ILLink.Shared/ILLink.Shared.projitems +++ b/src/coreclr/tools/aot/ILLink.Shared/ILLink.Shared.projitems @@ -13,6 +13,7 @@ + @@ -21,4 +22,9 @@ Designer - \ No newline at end of file + + + Designer + + + diff --git a/src/coreclr/tools/aot/ILLink.Shared/MessageSubCategory.cs b/src/coreclr/tools/aot/ILLink.Shared/MessageSubCategory.cs new file mode 100644 index 00000000000000..92c1077b14baf3 --- /dev/null +++ b/src/coreclr/tools/aot/ILLink.Shared/MessageSubCategory.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace ILLink.Shared +{ + public static class MessageSubCategory + { + public const string None = ""; + public const string TrimAnalysis = "Trim analysis"; + public const string UnresolvedAssembly = "Unresolved assembly"; + public const string AotAnalysis = "AOT analysis"; + } +} diff --git a/src/coreclr/tools/aot/ILLink.Shared/README.md b/src/coreclr/tools/aot/ILLink.Shared/README.md new file mode 100644 index 00000000000000..229b67e492bf0b --- /dev/null +++ b/src/coreclr/tools/aot/ILLink.Shared/README.md @@ -0,0 +1 @@ +Sources taken from https://github.com/dotnet/linker/tree/890591b13da936d2c38a52afdaeac0db69858d4f/src/ILLink.Shared. diff --git a/src/coreclr/tools/aot/ILLink.Shared/SharedStrings.resx b/src/coreclr/tools/aot/ILLink.Shared/SharedStrings.resx index 0d53dff7e254e0..e2db35e7073313 100644 --- a/src/coreclr/tools/aot/ILLink.Shared/SharedStrings.resx +++ b/src/coreclr/tools/aot/ILLink.Shared/SharedStrings.resx @@ -53,7 +53,6 @@ value : The object must be serialized with : System.Runtime.Serialization.Formatters.Soap.SoapFormatter : and then encoded with base64 encoding. - mimetype: application/x-microsoft.net.object.bytearray.base64 value : The object must be serialized into a byte array : using a System.ComponentModel.TypeConverter @@ -117,12 +116,954 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + An Xml Feature does not specify a 'featurevalue' attribute. + + + Failed to process '{0}'. Feature '{1}' does not specify a 'featurevalue' attribute. + + + Feature definition has to be a boolean. + + + Failed to process '{0}'. Unsupported non-boolean feature definition '{1}'. + + + An exception was thrown while processing the xml file. + + + Error processing '{0}': {1}. + + + An error ocurred while processing a method in assembly. + + + Error processing method '{0}' in assembly '{1}'. + + + Cannot stub constructor of a type when base type does not have default constructor. Constructors of derived types marked for substitution require to have a default constructor in its base type. + + + Cannot stub constructor on '{0}' when base type does not have default constructor. + + + Could not find predefined type". + + + Missing predefined '{0}' type". + + + Could not find constructor. + + + Could not find constructor on '{0}'. + + + Assembly reference could not be resolved. + + + Assembly reference '{0}' could not be resolved. + + + Assembly cannot be loaded due to failure in processing the reference assembly. + + + Assembly '{0}' cannot be loaded due to failure in processing '{1}' reference + + + There was an error writing the linked assembly 'output'. + + + Failed to write '{0}'. + + + There was an unexpected error while trimming. An exception with more details is printed to the MSBuild log. Please share this stack trace with the IL Linker team to further investigate the cause and possible solution. + + + IL Trimmer has encountered an unexpected error. Please report the issue at https://github.com/dotnet/linker/issues + + + There was an error processing 'XML document location' xml file. The most likely reason for this is that the XML file has syntactical errors. + + + Error processing '{0}'. + + + Element in XML document contains a 'featuredefault' attribute with an invalid value. + + + Failed to process '{0}'. Unsupported value for featuredefault attribute. + + + The string passed to the command-line does not correspond to a valid command-line option. + + + Unrecognized command-line option: '{0}'. + + + The value given for the --warn argument was not a valid warning version. + + + Invalid warning version '{0}'. + + + Invalid value 'value' was used for command-line option '--generate-warning-suppressions'; must be 'cs' or 'xml'. + + + Invalid value '{0}' for '--generate-warning-suppressions' option. + + + The command-line option 'optionName' was specified but no argument was given. + + + Missing argument for '{0}' option. + + + The command-line option --custom-data receives a key-value pair using the format KEY=VALUE. + + + Value used with '--custom-data' has to be in the KEY=VALUE format. + + + No input files were specified. Use one of the resolver options. + + + No input files were specified. Use one of '{0}' options. + + + Options '--new-mvid' and '--deterministic' cannot be used at the same time. + + + Options '--new-mvid' and '--deterministic' cannot be used at the same time. + + + The assembly argument specified for '--custom-step' option could not be found. + + + The assembly '{0}' specified for '--custom-step' option could not be found. + + + The path to the assembly specified for '--custom-step' must be fully qualified. + + + The path to the assembly '{0}' specified for '--custom-step' must be fully qualified. + + + An invalid value was specified for '--custom-step' option. + + + Invalid value '{0}' specified for '--custom-step' option. + + + A custom step that is inserted relative to an existing step in the pipeline must specify whether to be added before (-) or after (+) the step it's relative to. + + + Expected '+' or '-' to control new step insertion. + + + A custom step was specified for insertion relative to a non existent step. + + + Pipeline step '{0}' could not be found. + + + The custom step could not be found in the given assembly. + + + Custom step '{0}' could not be found. + + + Custom step is incompatible with this trimmer version. + + + Custom step '{0}' is incompatible with this trimmer version. + + + The optimization 'text' is invalid. Optimization values can either be 'beforefieldinit', 'overrideremoval', 'unreachablebodies', 'unusedinterfaces', 'ipconstprop', or 'sealer'. + + + Invalid optimization value '{0}'. + + + Invalid argument for 'token' option. + + + Invalid argument for '{0}' option. + + + Invalid assembly action. + + + Invalid assembly action '{0}'. + + + Root assembly could not be found. + + + Root assembly '{0}' could not be found. + + + XML descriptor file could not be found'. + + + XML descriptor file '{0}' could not be found'. + + + Root assembly does not have entry point. + + + Root assembly '{0}' does not have entry point. + + + Referenced root assembly cannot use the specified action. + + + Root assembly '{0}' cannot use action '{1}'. + + + Invalid assembly name. + + + Invalid assembly name '{0}'. + + + Invalid assembly root mode. + + + Invalid assembly root mode '{0}'. + + + Exported type cannot be resolved. + + + Exported type '{0}' cannot be resolved. + + + A reference assembly input passed via -reference could not be loaded. + + + Reference assembly '{0}' could not be loaded. + + + Metadata element cannot be resolved. This usually means there is a version mismatch between dependencies. + + + {0}. + + + Field element cannot be resolved. This usually means there is a version mismatch between dependencies. + + + Field '{0}' reference could not be resolved. + + + Method element cannot be resolved. This usually means there is a version mismatch between dependencies. + + + Method '{0}' reference could not be resolved. + + + Type element cannot be resolved. This usually means there is a version mismatch between dependencies. + + + Type '{0}' reference could not be resolved. + + + The type name used to define custom attribute value could not be resolved. + + + The type '{0}' used with attribute value '{1}' could not be found. + + + The 'value' specified for the custom attribute value cannot be converted to specified argument type 'typeName'. + + + Cannot convert value '{0}' to type '{1}'. + + + The syntax for custom attribute value for 'type' requires to also specify the underlying attribute type. + + + Custom attribute argument for '{0}' requires nested '{1}' node. + + + The value specified for the custom attribute of System.Type type could not be resolved. + + + Could not resolve custom attribute type value '{0}'. + + + The type name used with attribute type is not one of the supported types. + + + Unexpected attribute argument type '{0}'. + + + Invalid metadata value. + + + Invalid metadata value '{0}'. + + + The XML descriptor preserves fields on type, but this type has no fields. + + + Type '{0}' has no fields to preserve. + + + The XML descriptor preserves methods on type, but this type has no methods. + + + Type '{0}' has no methods to preserve. + + + The assembly in PreserveDependency attribute could not be resolved. + + + Could not resolve dependency assembly '{0}' specified in a 'PreserveDependency' attribute. + + + The type in PreserveDependency attribute could not be resolved. + + + Could not resolve dependency type '{0}' specified in a 'PreserveDependency' attribute. + + + The member in PreserveDependency attribute could not be resolved. + + + Could not resolve dependency member '{0}' declared in type '{1}' specified in a 'PreserveDependency' attribute. + + + The assembly in the XML could not be resolved. + + + Could not resolve assembly '{0}'. + + + The type in the XML could not be resolved. + + + Could not resolve type '{0}'. + + + The XML defined a method on a type, but the method was not found. + + + Could not find method '{0}' on type '{1}'. + + + Invalid value for 'signature' stub in the substitution XML. + + + Invalid value for '{0}' stub. + + + The value of the body attribute used in the substitution XML is invalid (the only supported options are remove and stub). + + + Unknown body modification '{0}' for '{1}'. + + + The XML defined a field on a type, but the field was not found. + + + Could not find field '{0}' on type '{1}'. + + + The substituted field 'field' was non-static or constant. Only static non-constant fields are supported. + + + Substituted field '{0}' needs to be static field. + + + A field was specified for substitution but no value to be substituted was given. + + + Missing 'value' attribute for field '{0}'. + + + The value used in the substitution XML for field is not a built-in type, or does not match the type of the field. + + + Invalid value '{0}' for '{1}'. + + + The XML defined a event on a type, but the event was not found. + + + Could not find event '{0}' on type '{1}'. + + + The XML defined a property on a type, but the property was not found. + + + Could not find property '{0}' on type '{1}'. + + + The XML defined the get accessor of property on a type, but the accessor was not found. + + + Could not find the get accessor of property '{0}' on type '{1}'. + + + The XML defined the set accessor of property on a type, but the accessor was not found. + + + Could not find the set accessor of property '{0}' in type '{1}'. + + + The XML attribute arguments use values or types which don't match to any constructor + + + Could not find matching constructor for custom attribute '{0}' arguments. + + + Method 'method' has more than one return element specified. There can only be one return element. + + + There is more than one 'return' child element specified for method '{0}'. + + + Method has more than one parameter for the XML element 'parameter'. There can only be one value specified for each parameter. + + + More than one value specified for parameter '{0}' of method '{1}'. + + + The XML descriptor marks for preservation the member more than once. + + + Duplicate preserve of '{0}'. + Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code Using member '{0}' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code.{1}{2} + + Using dynamic types might cause types or members to be removed by trimmer. + + + Invoking members on dynamic types is not trimming-compatible. Types or members might have been removed by the trimmer. + + + The linker found multiple instances of attribute on a member. This attribute is only allowed to have one instance. + + + Attribute '{0}' should only be used once on '{1} + + + Attribute doesn't have the required number of parameters specified. + + + Attribute '{0}' doesn't have the required number of parameters specified. + + + 'attribute' element does not contain attribute 'fullname' or it's empty. + + + 'attribute' element does not contain attribute 'fullname' or it's empty. + + + The assembly name specified for attribute could not be resolved. + + + Could not resolve assembly '{0}' for attribute '{1}'. + + + The described attribute type could not be found in the assemblies. + + + Attribute type '{0}' could not be found. + + + The value passed as the assembly name or type name to the CreateInstance method can't be statically analyzed. + + + Unrecognized value passed to the parameter '{0}' of method '{1}'. It's not possible to guarantee the availability of the target type. + + + 'PreserveDependencyAttribute' is deprecated. Use 'DynamicDependencyAttribute' instead. + + + 'PreserveDependencyAttribute' is deprecated. Use 'DynamicDependencyAttribute' instead. + + + The input contains an invalid use of DynamicDependencyAttribute. + + + The 'DynamicDependencyAttribute' could not be analyzed. + + + The assembly string given in a DynamicDependencyAttribute constructor could not be resolved. + + + Unresolved assembly '{0}' in 'DynamicDependencyAttribute'. + + + The type in a DynamicDependencyAttribute constructor could not be resolved. + + + Unresolved type '{0}' in 'DynamicDependencyAttribute'. + + + The member signature or DynamicallyAccessedMemberTypes in a DynamicDependencyAttribute constructor did not resolve to any members on the type. + + + No members were resolved for '{0}'. + + + The resource element in a substitution file did not have a 'name' attribute. + + + Missing 'name' attribute for resource. + + + The resource element in a substitution file did not have a valid 'action' attribute. + + + Invalid value '{0}' for attribute 'action' for resource '{1}'. + + + The resource name in a substitution file could not be found in the specified assembly. + + + Could not find embedded resource '{0}' to remove in assembly '{1}'. + + + The 'DynamicallyAccessedMembersAttribute' is not allowed on methods. It is allowed on method return value or method parameters. + + + The 'DynamicallyAccessedMembersAttribute' is not allowed on methods. It is allowed on method return value or method parameters though. + + + Could not find a unique backing field for property to propagate 'DynamicallyAccessedMembersAttribute'. + + + Could not find a unique backing field for property '{0}' to propagate 'DynamicallyAccessedMembersAttribute'. + + + 'DynamicallyAccessedMembersAttribute' on property conflicts with the same attribute on its accessor. + + + 'DynamicallyAccessedMembersAttribute' on property '{0}' conflicts with the same attribute on its accessor '{1}'. + + + The XML descriptor specifies a namespace but there are no types found in such namespace. + + + Could not find any type in namespace '{0}'. + + + An attribute is being referenced in the code but the attribute instances have been removed using the 'RemoveAttributeInstances' internal attribute. + + + Attribute '{0}' is being referenced in code but the trimmer was instructed to remove all instances of this attribute. If the attribute instances are necessary make sure to either remove the trimmer attribute XML portion which removes the attribute instances, or override the removal by using the trimmer XML descriptor to keep the attribute type (which in turn keeps all of its instances). + + + 'RequiresUnreferencedCodeAttribute' annotations must match across all interface implementations or overrides. + + + {0}. 'RequiresUnreferencedCodeAttribute' annotations must match across all interface implementations or overrides. + + + Internal attribute 'RemoveAttributeInstances' can only be used on attribute types. + + + Internal attribute '{0}' can only be used on attribute types. + + + Correctness of COM interop cannot be guaranteed after trimming. Interfaces and interface members might be removed. + + + P/invoke method '{0}' declares a parameter with COM marshalling. Correctness of COM interop cannot be guaranteed after trimming. Interfaces and interface members might be removed. + + + An attribute element has property but this could not be found. + + + Property element does not contain attribute 'name'. + + + An attribute element has property but this could not be found. + + + Property '{0}' could not be found. + + + Either the type on which the MakeGenericType is called can't be statically determined, or the type parameters to be used for generic arguments can't be statically determined. + + + Call to '{0}' can not be statically analyzed. It's not possible to guarantee the availability of requirements of the generic type. + + + 'DynamicallyAccessedMemberAttribute' on property conflicts with the same attribute on its backing field. + + + 'DynamicallyAccessedMemberAttribute' on property '{0}' conflicts with the same attribute on its backing field '{1}'. + + + Unrecognized value passed to the parameter of method. It's not possible to guarantee the availability of the target type. + + + Unrecognized value passed to the parameter 'typeName' of method '{0}'. It's not possible to guarantee the availability of the target type. + + + Parameters passed to method cannot be analyzed. Consider using methods 'System.Type.GetType' and `System.Activator.CreateInstance` instead. + + + Parameters passed to method '{0}' cannot be analyzed. Consider using methods 'System.Type.GetType' and `System.Activator.CreateInstance` instead. + + + The type passed to the RunClassConstructor is not statically known, Trimmer can't make sure that its static constructor is available. + + + Unrecognized value passed to the parameter 'type' of method '{0}'. It's not possible to guarantee the availability of the target static constructor. + + + Call to 'System.Reflection.MethodInfo.MakeGenericMethod' can not be statically analyzed. It's not possible to guarantee the availability of requirements of the generic method. + + + Call to '{0}' can not be statically analyzed. It's not possible to guarantee the availability of requirements of the generic method. + + + Calling CreateInstance with assembly name which can't be resolved. + + + The assembly name '{0}' passed to method '{1}' references assembly which is not available. + + + The parameter of method has a DynamicallyAccessedMembersAttribute, but the value passed to it can not be statically analyzed. + + + Value passed to parameter '{0}' of method '{1}' can not be statically determined and may not meet 'DynamicallyAccessedMembersAttribute' requirements. + + + The return value of method has a DynamicallyAccessedMembersAttribute, but the value returned from the method can not be statically analyzed. + + + Value returned from method '{0}' can not be statically determined and may not meet 'DynamicallyAccessedMembersAttribute' requirements. + + + The field has a DynamicallyAccessedMembersAttribute, but the value assigned to it can not be statically analyzed. + + + Value assigned to {0} can not be statically determined and may not meet 'DynamicallyAccessedMembersAttribute' requirements. + + + The method has a DynamicallyAccessedMembersAttribute (which applies to the implicit 'this' parameter), but the value used for the 'this' parameter can not be statically analyzed. + + + Value passed to implicit 'this' parameter of method '{0}' can not be statically determined and may not meet 'DynamicallyAccessedMembersAttribute' requirements. + + + The generic parameter of type or method has a DynamicallyAccessedMembersAttribute, but the value used for it can not be statically analyzed. + + + Type passed to generic parameter '{0}' of '{1}' can not be statically determined and may not meet 'DynamicallyAccessedMembersAttribute' requirements. + + + Target parameter argument does not satisfy 'DynamicallyAccessedMembersAttribute' in call to target method. The parameter of method does not have matching annotations. + + + '{0}' argument does not satisfy {4} in call to '{1}'. The parameter '{2}' of method '{3}' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. + + + Target method return value does not satisfy 'DynamicallyAccessedMembersAttribute' requirements. The parameter of method does not have matching annotations. + + + '{0}' method return value does not satisfy {3} requirements. The parameter '{1}' of method '{2}' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. + + + Value stored in field does not satisfy 'DynamicallyAccessedMembersAttribute' requirements. The parameter of method does not have matching annotations. + + + value stored in field '{0}' does not satisfy {3} requirements. The parameter '{1}' of method '{2}' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. + + + 'this' argument does not satisfy 'DynamicallyAccessedMembersAttribute' in call to target method. The parameter of method does not have matching annotations. + + + 'this' argument does not satisfy {3} in call to '{0}'. The parameter '{1}' of method '{2}' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. + + + Generic argument does not satisfy 'DynamicallyAccessedMembersAttribute' in target method or type. The parameter of method does not have matching annotations. + + + '{0}' generic argument does not satisfy {4} in '{1}'. The parameter '{2}' of method '{3}' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. + + + Target parameter argument does not satisfy 'DynamicallyAccessedMembersAttribute' in call to target method. The return value of the source method does not have matching annotations. + + + '{0}' argument does not satisfy {3} in call to '{1}'. The return value of method '{2}' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. + + + Target method return value does not satisfy 'DynamicallyAccessedMembersAttribute' requirements. The return value of the source method does not have matching annotations. + + + '{0}' method return value does not satisfy {2} requirements. The return value of method '{1}' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. + + + Value stored in field does not satisfy 'DynamicallyAccessedMembersAttribute' requirements. The return value of the source method does not have matching annotations. + + + value stored in field '{0}' does not satisfy {2} requirements. The return value of method '{1}' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. + + + 'this' argument does not satisfy 'DynamicallyAccessedMembersAttribute' in call to target method. The return value of the source method does not have matching annotations. + + + 'this' argument does not satisfy {2} in call to '{0}'. The return value of method '{1}' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. + + + Target generic argument does not satisfy 'DynamicallyAccessedMembersAttribute' in target method or type. The return value of the source method does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. + + + '{0}' generic argument does not satisfy {3} in '{1}'. The return value of method '{2}' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. + + + Target parameter argument does not satisfy 'DynamicallyAccessedMembersAttribute' in call to target method. The source field does not have matching annotations. + + + '{0}' argument does not satisfy {3} in call to '{1}'. The field '{2}' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. + + + Target method return value does not satisfy 'DynamicallyAccessedMembersAttribute' requirements. The source field does not have matching annotations. + + + '{0}' method return value does not satisfy {2} requirements. The field '{1}' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. + + + Value stored in target field does not satisfy 'DynamicallyAccessedMembersAttribute' requirements. The source field does not have matching annotations. + + + value stored in field '{0}' does not satisfy {2} requirements. The field '{1}' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. + + + 'this' argument does not satisfy 'DynamicallyAccessedMembersAttribute' in call to target method. The source field does not have matching annotations. + + + 'this' argument does not satisfy {2} in call to '{0}'. The field '{1}' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. + + + Target generic argument does not satisfy 'DynamicallyAccessedMembersAttribute' in target method or type. The source field does not have matching annotations. + + + '{0}' generic argument does not satisfy {3} in '{1}'. The field '{2}' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. + + + Target parameter argument does not satisfy 'DynamicallyAccessedMembersAttribute' in call to target method. The implicit 'this' argument of source method does not have matching annotations. + + + '{0}' argument does not satisfy {3} in call to '{1}'. The implicit 'this' argument of method '{2}' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. + + + Target method return value does not satisfy 'DynamicallyAccessedMembersAttribute' requirements. The implicit 'this' argument of source method does not have matching annotations. + + + '{0}' method return value does not satisfy {2} requirements. The implicit 'this' argument of method '{1}' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. + + + Value stored in target field does not satisfy 'DynamicallyAccessedMembersAttribute' requirements. The implicit 'this' argument of source method does not have matching annotations. + + + value stored in field '{0}' does not satisfy {2} requirements. The implicit 'this' argument of method '{1}' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. + + + 'this' argument does not satisfy 'DynamicallyAccessedMembersAttribute' in call to target method. The implicit 'this' argument of source method does not have matching annotations. + + + 'this' argument does not satisfy {2} in call to '{0}'. The implicit 'this' argument of method '{1}' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. + + + Target generic argument does not satisfy 'DynamicallyAccessedMembersAttribute' in target method or type. The implicit 'this' argument of source method does not have matching annotations. + + + '{0}' generic argument does not satisfy {3} in '{1}'. The implicit 'this' argument of method '{2}' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. + + + Target parameter argument does not satisfy 'DynamicallyAccessedMembersAttribute' in call to target method. The generic parameter of the source method or type does not have matching annotations. + + + '{0}' argument does not satisfy {4} in call to '{1}'. The generic parameter '{2}' of '{3}' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. + + + Target method return value does not satisfy 'DynamicallyAccessedMembersAttribute' requirements. The generic parameter of the source method or type does not have matching annotations. + + + '{0}' method return value does not satisfy {3} requirements. The generic parameter '{1}' of '{2}' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. + + + Value stored in target field does not satisfy 'DynamicallyAccessedMembersAttribute' requirements. The generic parameter of the source method or type does not have matching annotations. + + + value stored in field '{0}' does not satisfy {3} requirements. The generic parameter '{1}' of '{2}' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. + + + 'this' argument does not satisfy 'DynamicallyAccessedMembersAttribute' in call to target method. The generic parameter of the source method or type does not have matching annotations. + + + 'this' argument does not satisfy {3} in call to '{0}'. The generic parameter '{1}' of '{2}' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. + + + Target generic argument does not satisfy 'DynamicallyAccessedMembersAttribute' in target method or type. The generic parameter of the source method or type does not have matching annotations. + + + '{0}' generic argument does not satisfy {4} in '{1}'. The generic parameter '{2}' of '{3}' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. + + + 'DynamicallyAccessedMemberTypes' on the parameter of method don't match overridden parameter of method. All overridden members must have the same 'DynamicallyAccessedMembersAttribute' usage. + + + 'DynamicallyAccessedMemberTypes' in 'DynamicallyAccessedMembersAttribute' on the parameter '{0}' of method '{1}' don't match overridden parameter '{2}' of method '{3}'. All overridden members must have the same 'DynamicallyAccessedMembersAttribute' usage. + + + 'DynamicallyAccessedMemberTypes' on the return value of method don't match overridden return value of method. All overridden members must have the same 'DynamicallyAccessedMembersAttribute' usage. + + + 'DynamicallyAccessedMemberTypes' in 'DynamicallyAccessedMembersAttribute' on the return value of method '{0}' don't match overridden return value of method '{1}'. All overridden members must have the same 'DynamicallyAccessedMembersAttribute' usage. + + + 'DynamicallyAccessedMemberTypes' on the implicit 'this' parameter of method don't match overridden implicit 'this' parameter of method. All overridden members must have the same 'DynamicallyAccessedMembersAttribute' usage. + + + 'DynamicallyAccessedMemberTypes' in 'DynamicallyAccessedMembersAttribute' on the implicit 'this' parameter of method '{0}' don't match overridden implicit 'this' parameter of method '{1}'. All overridden members must have the same 'DynamicallyAccessedMembersAttribute' usage. + + + 'DynamicallyAccessedMemberTypes' on the generic parameter of method or type don't match overridden generic parameter method or type. All overridden members must have the same 'DynamicallyAccessedMembersAttribute' usage. + + + 'DynamicallyAccessedMemberTypes' in 'DynamicallyAccessedMembersAttribute' on the generic parameter '{0}' of '{1}' don't match overridden generic parameter '{2}' of '{3}'. All overridden members must have the same 'DynamicallyAccessedMembersAttribute' usage. + + + Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently ILLink can not guarantee presence of all the matching types. + + + Call to '{0}' can perform case insensitive lookup of the type, currently ILLink can not guarantee presence of all the matching types. + + + Field has 'DynamicallyAccessedMembersAttribute', but that attribute can only be applied to fields of type 'System.Type' or 'System.String'. + + + Field '{0}' has 'DynamicallyAccessedMembersAttribute', but that attribute can only be applied to fields of type 'System.Type' or 'System.String'. + + + Parameter of method has 'DynamicallyAccessedMembersAttribute', but that attribute can only be applied to parameters of type 'System.Type' or 'System.String'. + + + Parameter '{0}' of method '{1}' has 'DynamicallyAccessedMembersAttribute', but that attribute can only be applied to parameters of type 'System.Type' or 'System.String'. + + + Property has 'DynamicallyAccessedMembersAttribute', but that attribute can only be applied to properties of type 'System.Type' or 'System.String'. + + + Property '{0}' has 'DynamicallyAccessedMembersAttribute', but that attribute can only be applied to properties of type 'System.Type' or 'System.String'. + + + XML contains unsupported wildcard for assembly 'fullname' attribute. + + + XML contains unsupported wildcard for assembly 'fullname' attribute. + + + Embedded XML in assembly contains assembly "fullname" attribute for another assembly + + + Embedded XML in assembly '{0}' contains assembly "fullname" attribute for another assembly '{1}' + + + Invalid AssemblyMetadata 'IsTrimmable' attribute in assembly. Value must be "True". + + + Invalid AssemblyMetadata("IsTrimmable", "{0}") attribute in assembly '{1}'. Value must be "True". + + + Value passed to the parameter of method cannot be statically determined as a property accessor. + + + Value passed to the '{0}' parameter of method '{1}' cannot be statically determined as a property accessor. + + + Assembly produced trim warnings. + + + Assembly '{0}' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries + + + Type was not found in the caller assembly nor in the base library. Type name strings used for dynamically accessing a type should be assembly qualified. + + + Type '{0}' was not found in the caller assembly nor in the base library. Type name strings used for dynamically accessing a type should be assembly qualified. + + + Return type of method has 'DynamicallyAccessedMembersAttribute', but that attribute can only be applied to properties of type 'System.Type' or 'System.String'. + + + Return type of method '{0}' has 'DynamicallyAccessedMembersAttribute', but that attribute can only be applied to properties of type 'System.Type' or 'System.String'. + + + Trimmer currently can't correctly handle if the same compiler generated state machine type is associated (via the state machine attributes) with two different methods. + + + Methods '{0}' and '{1}' are both associated with state machine type '{2}'. This is currently unsupported and may lead to incorrectly reported warnings. + + + Invalid scope used in 'UnconditionalSuppressMessageAttribute'. The only scopes supported on global unconditional suppressions are 'module', 'type' and 'member'. + + + Invalid scope '{0}' used in 'UnconditionalSuppressMessageAttribute' on module '{1}' with target '{2}'. + + + Types that derive from a base class with 'RequiresUnreferencedCodeAttribute' need to explicitly use the 'RequiresUnreferencedCodeAttribute' or suppress this warning + + + Type '{0}' derives from '{1}' which has 'RequiresUnreferencedCodeAttribute'. {2}{3} + + + Field with 'DynamicallyAccessedMembersAttribute' is accessed via reflection. Trimmer can't guarantee availability of the requirements of the field. + + + Field '{0}' with 'DynamicallyAccessedMembersAttribute' is accessed via reflection. Trimmer can't guarantee availability of the requirements of the field. + + + Method with parameters or return value with `DynamicallyAccessedMembersAttribute` is accessed via reflection. Trimmer can't guarantee availability of the requirements of the method. + + + Method '{0}' with parameters or return value with `DynamicallyAccessedMembersAttribute` is accessed via reflection. Trimmer can't guarantee availability of the requirements of the method. + + + 'DynamicallyAccessedMembersAttribute' on a type or one of its base types references a member which requires unreferenced code. + + + 'DynamicallyAccessedMembersAttribute' on '{0}' or one of its base types references '{1}' which requires unreferenced code.{2}{3} + + + 'DynamicallyAccessedMembersAttribute' on a type or one of its base types references a member which requires unreferenced code. + + + 'DynamicallyAccessedMembersAttribute' on '{0}' or one of its base types references '{1}' which requires unreferenced code.{2}{3} + + + 'DynamicallyAccessedMembersAttribute' on a type or one of its base types references a member which has 'DynamicallyAccessedMembersAttribute' requirements. + + + 'DynamicallyAccessedMembersAttribute' on '{0}' or one of its base types references '{1}' which has 'DynamicallyAccessedMembersAttribute' requirements. + + + 'DynamicallyAccessedMembersAttribute' on a type or one of its base types references a member which has 'DynamicallyAccessedMembersAttribute' requirements. + + + 'DynamicallyAccessedMembersAttribute' on '{0}' or one of its base types references '{1}' which has 'DynamicallyAccessedMembersAttribute' requirements. + + + The use of 'RequiresUnreferencedCodeAttribute' on static constructors is disallowed since is a method not callable by the user, is only called by the runtime. Placing the attribute directly on the static constructor will have no effect, instead use 'RequiresUnreferencedCodeAttribute' on the type which will handle warning and silencing from the static constructor. + + + 'RequiresUnreferencedCodeAttribute' cannot be placed directly on static constructor '{0}', consider placing 'RequiresUnreferencedCodeAttribute' on the type declaration instead. + Avoid accessing Assembly file path when publishing as a single file @@ -141,29 +1082,23 @@ Using member '{0}' which has 'RequiresAssemblyFilesAttribute' can break functionality when embedded in a single-file app.{1}{2} + + 'RequiresAssemblyFilesAttribute' annotations must match across all interface implementations or overrides. + + + {0}. 'RequiresAssemblyFilesAttribute' annotations must match across all interface implementations or overrides. + Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling. Using member '{0}' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling.{1}{2} - - {0}. 'RequiresUnreferencedCodeAttribute' annotations must match across all interface implementations or overrides. - - - 'RequiresUnreferencedCodeAttribute' annotations must match across all interface implementations or overrides. - - - {0}. 'RequiresDynamicCodeAttribute' annotations must match across all interface implementations or overrides. - 'RequiresDynamicCodeAttribute' annotations must match across all interface implementations or overrides. - - {0}. 'RequiresAssemblyFilesAttribute' annotations must match across all interface implementations or overrides. - - - 'RequiresAssemblyFilesAttribute' annotations must match across all interface implementations or overrides. + + {0}. 'RequiresDynamicCodeAttribute' annotations must match across all interface implementations or overrides. Base member '{2}' with '{0}' has a derived member '{1}' without '{0}' @@ -177,38 +1112,8 @@ Interface member '{2}' with '{0}' has an implementation member '{1}' without '{0}' - - Type '{0}' derives from '{1}' which has 'RequiresUnreferencedCodeAttribute'. {2}{3} - - - Types that derive from a base class with 'RequiresUnreferencedCodeAttribute' need to explicitly use the 'RequiresUnreferencedCodeAttribute' or suppress this warning - - - Invoking members on dynamic types is not trimming-compatible. Types or members might have been removed by the trimmer. - - - Using dynamic types might cause types or members to be removed by trimmer. - - - Call to '{0}' can not be statically analyzed. It's not possible to guarantee the availability of requirements of the generic method. - - - Call to '{0}' can not be statically analyzed. It's not possible to guarantee the availability of requirements of the generic type. - - - 'RequiresUnreferencedCodeAttribute' cannot be placed directly on static constructor '{0}', consider placing 'RequiresUnreferencedCodeAttribute' on the type declaration instead. - - - The use of 'RequiresUnreferencedCodeAttribute' on static constructors is disallowed since is a method not callable by the user, is only called by the runtime. Placing the attribute directly on the static constructor will have no effect, instead use 'RequiresUnreferencedCodeAttribute' on the type which will handle warning and silencing from the static constructor. - - - Call to '{0}' can not be statically analyzed. It's not possible to guarantee the availability of requirements of the generic method. - - - Value passed to the '{0}' parameter of method '{1}' cannot be statically determined as a property accessor. - - - P/invoke method '{0}' declares a parameter with COM marshalling. Correctness of COM interop cannot be guaranteed after trimming. Interfaces and interface members might be removed. + + P/invoke method declares a parameter with an abstract delegate. Correctness of interop for abstract delegates cannot be guaranteed after native compilation. P/invoke method '{0}' declares a parameter with an abstract delegate. Correctness of interop for abstract delegates cannot be guaranteed after native compilation: the marshalling code for the delegate might not be available. Use a non-abstract delegate type or ensure any delegate instance passed as parameter is marked with `UnmanagedFunctionPointerAttribute`. From 09ff1acdad2e7789908b5db9bb89896144c13042 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Strehovsk=C3=BD?= Date: Mon, 24 Jan 2022 14:39:27 +0900 Subject: [PATCH 016/161] Allow generating Dwarf version 5 (#63988) Contributes to https://github.com/dotnet/runtimelab/issues/1738. --- .../BuildIntegration/Microsoft.NETCore.Native.targets | 1 + .../Compiler/CompilationBuilder.Aot.cs | 7 +++++++ .../Compiler/DependencyAnalysis/ObjectWriter.cs | 9 +++++++++ .../aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs | 4 ++++ .../Compiler/RyuJitCompilationBuilder.cs | 3 +++ src/coreclr/tools/aot/ILCompiler/Program.cs | 5 ++++- 6 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets index 1a3b4a2f740b41..365afaa6ce4687 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets @@ -247,6 +247,7 @@ The .NET Foundation licenses this file to you under the MIT license. + diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilationBuilder.Aot.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilationBuilder.Aot.cs index fb4ad5ce51b7f6..232df5cd22d4e2 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilationBuilder.Aot.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilationBuilder.Aot.cs @@ -24,6 +24,7 @@ partial class CompilationBuilder protected bool _methodBodyFolding; protected InstructionSetSupport _instructionSetSupport; protected SecurityMitigationOptions _mitigationOptions; + protected bool _useDwarf5; partial void InitializePartial() { @@ -103,6 +104,12 @@ public CompilationBuilder UseMethodImportationErrorProvider(MethodImportationErr return this; } + public CompilationBuilder UseDwarf5(bool value) + { + _useDwarf5 = value; + return this; + } + protected PreinitializationManager GetPreinitializationManager() { if (_preinitializationManager == null) diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ObjectWriter.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ObjectWriter.cs index e690b5d420078e..5462b8fedc11ba 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ObjectWriter.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ObjectWriter.cs @@ -85,6 +85,9 @@ public class ObjectWriter : IDisposable, ITypesDebugInfoWriter [DllImport(NativeObjectWriterFileName)] private static extern void FinishObjWriter(IntPtr objWriter); + [DllImport(NativeObjectWriterFileName)] + private static extern void SetDwarfVersion(IntPtr objWriter, ushort v); + [DllImport(NativeObjectWriterFileName)] private static extern void SwitchSection(IntPtr objWriter, string sectionName, CustomSectionAttributes attributes = 0, string comdatName = null); @@ -884,6 +887,11 @@ public ObjectWriter(string objectFilePath, NodeFactory factory, ObjectWritingOpt _isSingleFileCompilation = _nodeFactory.CompilationModuleGroup.IsSingleFileCompilation; _userDefinedTypeDescriptor = new UserDefinedTypeDescriptor(this, factory); _options = options; + + if ((_options & ObjectWritingOptions.UseDwarf5) != 0) + { + SetDwarfVersion(_nativeObjectWriter, 5); + } } public void Dispose() @@ -1319,5 +1327,6 @@ public enum ObjectWritingOptions { GenerateDebugInfo = 0x01, ControlFlowGuard = 0x02, + UseDwarf5 = 0x4, } } diff --git a/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs b/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs index b27f7db8ec7d8e..f05301ce6367e7 100644 --- a/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs +++ b/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs @@ -93,6 +93,9 @@ protected override void CompileInternal(string outputFile, ObjectDumper dumper) NodeFactory.SetMarkingComplete(); ObjectWritingOptions options = default; + if ((_compilationOptions & RyuJitCompilationOptions.UseDwarf5) != 0) + options |= ObjectWritingOptions.UseDwarf5; + if (_debugInformationProvider is not NullDebugInformationProvider) options |= ObjectWritingOptions.GenerateDebugInfo; @@ -243,5 +246,6 @@ public enum RyuJitCompilationOptions { MethodBodyFolding = 0x1, ControlFlowGuardAnnotations = 0x2, + UseDwarf5 = 0x4, } } diff --git a/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilationBuilder.cs b/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilationBuilder.cs index 8b753c71039942..628277d75e6f5c 100644 --- a/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilationBuilder.cs +++ b/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilationBuilder.cs @@ -110,6 +110,9 @@ public override ICompilation ToCompilation() if ((_mitigationOptions & SecurityMitigationOptions.ControlFlowGuardAnnotations) != 0) options |= RyuJitCompilationOptions.ControlFlowGuardAnnotations; + if (_useDwarf5) + options |= RyuJitCompilationOptions.UseDwarf5; + var factory = new RyuJitNodeFactory(_context, _compilationGroup, _metadataManager, _interopStubManager, _nameMangler, _vtableSliceProvider, _dictionaryLayoutProvider, GetPreinitializationManager()); JitConfigProvider.Initialize(_context.Target, jitFlagBuilder.ToArray(), _ryujitOptions); diff --git a/src/coreclr/tools/aot/ILCompiler/Program.cs b/src/coreclr/tools/aot/ILCompiler/Program.cs index e973c05b08c2c6..6cfa82c81b2b0b 100644 --- a/src/coreclr/tools/aot/ILCompiler/Program.cs +++ b/src/coreclr/tools/aot/ILCompiler/Program.cs @@ -61,6 +61,7 @@ internal class Program private string _instructionSet; private string _guard; private int _maxGenericCycle = CompilerTypeSystemContext.DefaultGenericCycleCutoffPoint; + private bool _useDwarf5; private string _singleMethodTypeName; private string _singleMethodName; @@ -178,6 +179,7 @@ private ArgumentSyntax ParseCommandLine(string[] args) syntax.DefineOption("Ot", ref optimizeTime, "Enable optimizations, favor code speed"); syntax.DefineOptionList("m|mibc", ref _mibcFilePaths, "Mibc file(s) for profile guided optimization"); ; syntax.DefineOption("g", ref _enableDebugInfo, "Emit debugging information"); + syntax.DefineOption("gdwarf-5", ref _useDwarf5, "Generate source-level debug information with dwarf version 5"); syntax.DefineOption("nativelib", ref _nativeLib, "Compile as static or shared library"); syntax.DefineOption("exportsfile", ref _exportsFile, "File to write exported method definitions"); syntax.DefineOption("dgmllog", ref _dgmlLogFileName, "Save result of dependency analysis as DGML"); @@ -769,7 +771,8 @@ static string ILLinkify(string rootedAssembly) .UseCompilationRoots(compilationRoots) .UseOptimizationMode(_optimizationMode) .UseSecurityMitigationOptions(securityMitigationOptions) - .UseDebugInfoProvider(debugInfoProvider); + .UseDebugInfoProvider(debugInfoProvider) + .UseDwarf5(_useDwarf5); if (scanResults != null) { From 8cee8faa5becff0a1afc0d8d149fe5f43d675399 Mon Sep 17 00:00:00 2001 From: Dan Moseley Date: Mon, 24 Jan 2022 00:54:36 -0700 Subject: [PATCH 017/161] Re-enable failing long path test (#64113) --- .../System.IO.FileSystem/tests/Directory/CreateDirectory.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.IO.FileSystem/tests/Directory/CreateDirectory.cs b/src/libraries/System.IO.FileSystem/tests/Directory/CreateDirectory.cs index ae0f89d32da08d..4e53a93a4e03a9 100644 --- a/src/libraries/System.IO.FileSystem/tests/Directory/CreateDirectory.cs +++ b/src/libraries/System.IO.FileSystem/tests/Directory/CreateDirectory.cs @@ -264,15 +264,16 @@ public void DirectoryLongerThanMaxLongPath_ThrowsPathTooLongException() }); } - [ActiveIssue("https://github.com/dotnet/runtime/issues/64019")] [ConditionalFact(nameof(LongPathsAreNotBlocked), nameof(UsingNewNormalization))] [PlatformSpecific(TestPlatforms.Windows)] public void DirectoryLongerThanMaxLongPathWithExtendedSyntax_ThrowsException() { var paths = IOInputs.GetPathsLongerThanMaxLongPath(GetTestFilePath(), useExtendedSyntax: true); + // Ideally this should be PathTooLongException or DirectoryNotFoundException but on some machines + // windows gives us ERROR_INVALID_NAME, producing IOException. Assert.All(paths, path => - AssertExtensions.ThrowsAny(() => Create(path))); + AssertExtensions.ThrowsAny(() => Create(path))); } [ConditionalFact(nameof(LongPathsAreNotBlocked), nameof(UsingNewNormalization))] From f4bfd05ecea3e00b725a71a211501f60a4e863ba Mon Sep 17 00:00:00 2001 From: Maxim Lipnin Date: Mon, 24 Jan 2022 11:04:22 +0300 Subject: [PATCH 018/161] Port MD4 managed implementation from mono/mono (#62074) Porting MD4 managed implementation from mono/mono (MD4.cs and MD4Managed.cs). It adds: - an internal class in the System.Net.Security with a single HashData method for now; - a set of related MD 4 unit tests to System.Net.Security.Unit.Tests project. --- .../src/System.Net.Security.csproj | 1 + .../src/System/Net/Security/MD4.cs | 256 ++++++++++++++++++ .../tests/UnitTests/MD4Tests.cs | 158 +++++++++++ .../System.Net.Security.Unit.Tests.csproj | 6 +- 4 files changed, 420 insertions(+), 1 deletion(-) create mode 100644 src/libraries/System.Net.Security/src/System/Net/Security/MD4.cs create mode 100644 src/libraries/System.Net.Security/tests/UnitTests/MD4Tests.cs diff --git a/src/libraries/System.Net.Security/src/System.Net.Security.csproj b/src/libraries/System.Net.Security/src/System.Net.Security.csproj index 9f90dbd3951f05..047cbdcc98aea9 100644 --- a/src/libraries/System.Net.Security/src/System.Net.Security.csproj +++ b/src/libraries/System.Net.Security/src/System.Net.Security.csproj @@ -363,6 +363,7 @@ + diff --git a/src/libraries/System.Net.Security/src/System/Net/Security/MD4.cs b/src/libraries/System.Net.Security/src/System/Net/Security/MD4.cs new file mode 100644 index 00000000000000..bdf3547912c911 --- /dev/null +++ b/src/libraries/System.Net.Security/src/System/Net/Security/MD4.cs @@ -0,0 +1,256 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// +// MD4.cs - Message Digest 4 Abstract class +// +// Author: +// Sebastien Pouliot (sebastien@xamarin.com) +// +// (C) 2003 Motus Technologies Inc. (http://www.motus.com) +// Copyright 2013 Xamarin Inc. (http://www.xamarin.com) +// + +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System.Buffers.Binary; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; +using System.Numerics; + +// +// This class is a port of the Mono managed implementation of the MD4 algorithm +// and required to support NTLM in Android only. +// It's an implementation detail and is not intended to be a public API. +// Assuming that NTLM would be System.Net.Security, it makes sense to put MD4 here as well. +// +namespace System.Net.Security +{ + internal sealed class MD4 + { + private const int S11 = 3; + private const int S12 = 7; + private const int S13 = 11; + private const int S14 = 19; + private const int S21 = 3; + private const int S22 = 5; + private const int S23 = 9; + private const int S24 = 13; + private const int S31 = 3; + private const int S32 = 9; + private const int S33 = 11; + private const int S34 = 15; + + internal static void HashData(ReadOnlySpan source, Span destination) + { + Debug.Assert(destination.Length == 128 >> 3); + + Span buffer = stackalloc byte[64]; + buffer.Clear(); + // Initialize the context + Span state = stackalloc uint[4] { 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476 }; + Span count = stackalloc uint[2] { 0, 0 }; + + HashCore(source, state, count, buffer); + + // Save number of bits + Span bits = stackalloc byte[8]; + Encode(bits, count); + + // Pad out to 56 mod 64 + uint index = ((count[0] >> 3) & 0x3f); + int padLen = (int)((index < 56) ? (56 - index) : (120 - index)); + Span padding = stackalloc byte[padLen]; + padding.Clear(); + padding[0] = 0x80; + HashCore(padding, state, count, buffer); + + // Append length (before padding) + HashCore(bits, state, count, buffer); + + // Write state to destination + Encode(destination, state); + } + + private static void HashCore(ReadOnlySpan input, Span state, Span count, Span buffer) + { + // Compute number of bytes mod 64 + int index = (int)((count[0] >> 3) & 0x3F); + // Update number of bits + count[0] += (uint)(input.Length << 3); + if (count[0] < (input.Length << 3)) + { + count[1]++; + } + + count[1] += (uint)(input.Length >> 29); + + int partLen = 64 - index; + int i = 0; + // Transform as many times as possible. + if (input.Length >= partLen) + { + if (index != 0) + { + input.Slice(0, partLen).CopyTo(buffer.Slice(index)); + MD4Transform(state, buffer); + index = 0; + } + else + { + partLen = 0; + } + + for (i = partLen; i + 63 < input.Length; i += 64) + { + MD4Transform(state, input.Slice(i)); + } + } + + // Buffer remaining input + input.Slice(i).CopyTo(buffer.Slice(index)); + } + + //--- private methods --------------------------------------------------- + + // F, G and H are basic MD4 functions. + private static uint F(uint x, uint y, uint z) + { + return (uint)(((x) & (y)) | ((~x) & (z))); + } + + private static uint G(uint x, uint y, uint z) + { + return (uint)(((x) & (y)) | ((x) & (z)) | ((y) & (z))); + } + + private static uint H(uint x, uint y, uint z) + { + return (uint)((x) ^ (y) ^ (z)); + } + + // FF, GG and HH are transformations for rounds 1, 2 and 3. + // Rotation is separate from addition to prevent recomputation. + private static void FF(ref uint a, uint b, uint c, uint d, uint x, byte s) + { + a += F(b, c, d) + x; + a = BitOperations.RotateLeft(a, s); + } + + private static void GG(ref uint a, uint b, uint c, uint d, uint x, byte s) + { + a += G(b, c, d) + x + 0x5a827999; + a = BitOperations.RotateLeft(a, s); + } + + private static void HH(ref uint a, uint b, uint c, uint d, uint x, byte s) + { + a += H(b, c, d) + x + 0x6ed9eba1; + a = BitOperations.RotateLeft(a, s); + } + + private static void Encode(Span output, Span input) + { + for (int i = 0, j = 0; j < output.Length; i++, j += 4) + { + BinaryPrimitives.WriteUInt32LittleEndian(output.Slice(j), input[i]); + } + } + + private static void Decode(Span output, ReadOnlySpan input) + { + for (int i = 0, j = 0; i < output.Length; i++, j += 4) + { + output[i] = BinaryPrimitives.ReadUInt32LittleEndian(input.Slice(j)); + } + } + + private static void MD4Transform(Span state, ReadOnlySpan block) + { + uint a = state[0]; + uint b = state[1]; + uint c = state[2]; + uint d = state[3]; + Span x = stackalloc uint[16]; + + Decode(x, block); + + // Round 1 + FF(ref a, b, c, d, x[0], S11); // 1 + FF(ref d, a, b, c, x[1], S12); // 2 + FF(ref c, d, a, b, x[2], S13); // 3 + FF(ref b, c, d, a, x[3], S14); // 4 + FF(ref a, b, c, d, x[4], S11); // 5 + FF(ref d, a, b, c, x[5], S12); // 6 + FF(ref c, d, a, b, x[6], S13); // 7 + FF(ref b, c, d, a, x[7], S14); // 8 + FF(ref a, b, c, d, x[8], S11); // 9 + FF(ref d, a, b, c, x[9], S12); // 10 + FF(ref c, d, a, b, x[10], S13); // 11 + FF(ref b, c, d, a, x[11], S14); // 12 + FF(ref a, b, c, d, x[12], S11); // 13 + FF(ref d, a, b, c, x[13], S12); // 14 + FF(ref c, d, a, b, x[14], S13); // 15 + FF(ref b, c, d, a, x[15], S14); // 16 + + // Round 2 + GG(ref a, b, c, d, x[0], S21); // 17 + GG(ref d, a, b, c, x[4], S22); // 18 + GG(ref c, d, a, b, x[8], S23); // 19 + GG(ref b, c, d, a, x[12], S24); // 20 + GG(ref a, b, c, d, x[1], S21); // 21 + GG(ref d, a, b, c, x[5], S22); // 22 + GG(ref c, d, a, b, x[9], S23); // 23 + GG(ref b, c, d, a, x[13], S24); // 24 + GG(ref a, b, c, d, x[2], S21); // 25 + GG(ref d, a, b, c, x[6], S22); // 26 + GG(ref c, d, a, b, x[10], S23); // 27 + GG(ref b, c, d, a, x[14], S24); // 28 + GG(ref a, b, c, d, x[3], S21); // 29 + GG(ref d, a, b, c, x[7], S22); // 30 + GG(ref c, d, a, b, x[11], S23); // 31 + GG(ref b, c, d, a, x[15], S24); // 32 + + HH(ref a, b, c, d, x[0], S31); // 33 + HH(ref d, a, b, c, x[8], S32); // 34 + HH(ref c, d, a, b, x[4], S33); // 35 + HH(ref b, c, d, a, x[12], S34); // 36 + HH(ref a, b, c, d, x[2], S31); // 37 + HH(ref d, a, b, c, x[10], S32); // 38 + HH(ref c, d, a, b, x[6], S33); // 39 + HH(ref b, c, d, a, x[14], S34); // 40 + HH(ref a, b, c, d, x[1], S31); // 41 + HH(ref d, a, b, c, x[9], S32); // 42 + HH(ref c, d, a, b, x[5], S33); // 43 + HH(ref b, c, d, a, x[13], S34); // 44 + HH(ref a, b, c, d, x[3], S31); // 45 + HH(ref d, a, b, c, x[11], S32); // 46 + HH(ref c, d, a, b, x[7], S33); // 47 + HH(ref b, c, d, a, x[15], S34); // 48 + + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + } + } +} diff --git a/src/libraries/System.Net.Security/tests/UnitTests/MD4Tests.cs b/src/libraries/System.Net.Security/tests/UnitTests/MD4Tests.cs new file mode 100644 index 00000000000000..a3667ebb896e54 --- /dev/null +++ b/src/libraries/System.Net.Security/tests/UnitTests/MD4Tests.cs @@ -0,0 +1,158 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.IO; +using System.Net.Security; +using System.Text; +using System.Threading.Tasks; +using Xunit; + +namespace System.Net.Security.Tests +{ + public class MD4Tests + { + // MD4("") = 31d6cfe0d16ae931b73c59d7e0c089c0 + [Fact] + public void TryEncrypt_Empty() + { + ReadOnlySpan input = new byte[0]; + ReadOnlySpan expected = new byte[] { 0x31, 0xd6, 0xcf, 0xe0, 0xd1, 0x6a, 0xe9, 0x31, 0xb7, 0x3c, 0x59, 0xd7, 0xe0, 0xc0, 0x89, 0xc0 }; + Verify(input, expected); + } + + // // MD4("a") = bde52cb31de33e46245e05fbdbd6fb24 + [Fact] + public void TryEncrypt_SingleLetter() + { + ReadOnlySpan input = new ReadOnlySpan(Encoding.Default.GetBytes("a")); + ReadOnlySpan expected = new byte[] { 0xbd, 0xe5, 0x2c, 0xb3, 0x1d, 0xe3, 0x3e, 0x46, 0x24, 0x5e, 0x05, 0xfb, 0xdb, 0xd6, 0xfb, 0x24 }; + Verify(input, expected); + } + + // MD4("abc") = a448017aaf21d8525fc10ae87aa6729d + [Fact] + public void TryEncrypt_ThreeLetters() + { + ReadOnlySpan input = new ReadOnlySpan(Encoding.Default.GetBytes("abc")); + ReadOnlySpan expected = new byte[] { 0xa4, 0x48, 0x01, 0x7a, 0xaf, 0x21, 0xd8, 0x52, 0x5f, 0xc1, 0x0a, 0xe8, 0x7a, 0xa6, 0x72, 0x9d }; + Verify(input, expected); + } + + // MD4("message digest") = d9130a8164549fe818874806e1c7014b + [Fact] + public void TryEncrypt_Phrase() + { + ReadOnlySpan input = new ReadOnlySpan(Encoding.Default.GetBytes("message digest")); + ReadOnlySpan expected = new byte[] { 0xd9, 0x13, 0x0a, 0x81, 0x64, 0x54, 0x9f, 0xe8, 0x18, 0x87, 0x48, 0x06, 0xe1, 0xc7, 0x01, 0x4b }; + Verify(input, expected); + } + + // MD4("abcdefghijklmnopqrstuvwxyz") = d79e1c308aa5bbcdeea8ed63df412da9 + [Fact] + public void TryEncrypt_AlphabetInLowercase() + { + ReadOnlySpan input = new ReadOnlySpan(Encoding.Default.GetBytes("abcdefghijklmnopqrstuvwxyz")); + ReadOnlySpan expected = new byte[] { 0xd7, 0x9e, 0x1c, 0x30, 0x8a, 0xa5, 0xbb, 0xcd, 0xee, 0xa8, 0xed, 0x63, 0xdf, 0x41, 0x2d, 0xa9 }; + Verify(input, expected); + } + + // MD4("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = 043f8582f241db351ce627e153e7f0e4 + [Fact] + public void TryEncrypt_AlphabetInUpperLowerCasesAndNumbers() + { + ReadOnlySpan input = new ReadOnlySpan((Encoding.Default.GetBytes("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"))); + ReadOnlySpan expected = new byte[] { 0x04, 0x3f, 0x85, 0x82, 0xf2, 0x41, 0xdb, 0x35, 0x1c, 0xe6, 0x27, 0xe1, 0x53, 0xe7, 0xf0, 0xe4 }; + Verify(input, expected); + } + + // MD4("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = e33b4ddc9c38f2199c3e7b164fcc0536 + [Fact] + public void TryEncrypt_RepeatedSequenceOfNumbers() + { + ReadOnlySpan input = new ReadOnlySpan(Encoding.Default.GetBytes("12345678901234567890123456789012345678901234567890123456789012345678901234567890")); + ReadOnlySpan expected = new byte[] { 0xe3, 0x3b, 0x4d, 0xdc, 0x9c, 0x38, 0xf2, 0x19, 0x9c, 0x3e, 0x7b, 0x16, 0x4f, 0xcc, 0x05, 0x36 }; + Verify(input, expected); + } + + // MD4("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012") = 14fdf2056bf88b3491c385d8ac4f48e6 + // 55 bytes (padLen == 56 - 55 => 1) + [Fact] + public void TryEncrypt_55bytes_HitsEdgeCaseForPaddingLength() + { + ReadOnlySpan input = new ReadOnlySpan(Encoding.Default.GetBytes("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012")); + ReadOnlySpan expected = new byte[] { 0x14, 0xfd, 0xf2, 0x05, 0x6b, 0xf8, 0x8b, 0x34, 0x91, 0xc3, 0x85, 0xd8, 0xac, 0x4f, 0x48, 0xe6 }; + Verify(input, expected); + } + + // MD4("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123") = db837dbb6098a50a2d3974bc1cc76133 + // 56 bytes (padLen == 120 - 56 => 64) + [Fact] + public void TryEncrypt_56bytes_HitsEdgeCaseForPaddingLength() + { + ReadOnlySpan input = new ReadOnlySpan(Encoding.Default.GetBytes("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123")); + ReadOnlySpan expected = new byte[] { 0xdb, 0x83, 0x7d, 0xbb, 0x60, 0x98, 0xa5, 0x0a, 0x2d, 0x39, 0x74, 0xbc, 0x1c, 0xc7, 0x61, 0x33 }; + Verify(input, expected); + } + + // MD4("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890") = ce64c40ecfbe896462f3c1a925884624 + [Fact] + public void TryEncrypt_63bytes_HitsEdgeCase() + { + ReadOnlySpan input = new ReadOnlySpan(Encoding.Default.GetBytes("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890")); + ReadOnlySpan expected = new byte[] { 0xce, 0x64, 0xc4, 0x0e, 0xcf, 0xbe, 0x89, 0x64, 0x62, 0xf3, 0xc1, 0xa9, 0x25, 0x88, 0x46, 0x24 }; + Verify(input, expected); + } + + // MD4("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345678901") = 4b0e77758d2ede1eb21d267d492ae70b + [Fact] + public void TryEncrypt_64bytes_HitsEdgeCase() + { + ReadOnlySpan input = new ReadOnlySpan(Encoding.Default.GetBytes("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345678901")); + ReadOnlySpan expected = new byte[] { 0x4b, 0x0e, 0x77, 0x75, 0x8d, 0x2e, 0xde, 0x1e, 0xb2, 0x1d, 0x26, 0x7d, 0x49, 0x2a, 0xe7, 0x0b }; + Verify(input, expected); + } + + // MD4("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789012") = 3b46ad159b3fd800d254e3c4cc71fe36 + [Fact] + public void TryEncrypt_65bytes_HitsEdgeCase() + { + ReadOnlySpan input = new ReadOnlySpan(Encoding.Default.GetBytes("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789012")); + ReadOnlySpan expected = new byte[] { 0x3b, 0x46, 0xad, 0x15, 0x9b, 0x3f, 0xd8, 0x00, 0xd2, 0x54, 0xe3, 0xc4, 0xcc, 0x71, 0xfe, 0x36 }; + Verify(input, expected); + } + + // MD4("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345678901ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890") = a3e23048e4ade47a0f00fa8aed2a0248 + [Fact] + public void TryEncrypt_127bytes_HitsEdgeCase() + { + ReadOnlySpan input = new ReadOnlySpan(Encoding.Default.GetBytes("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345678901ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890")); + ReadOnlySpan expected = new byte[] { 0xa3, 0xe2, 0x30, 0x48, 0xe4, 0xad, 0xe4, 0x7a, 0x0f, 0x00, 0xfa, 0x8a, 0xed, 0x2a, 0x02, 0x48 }; + Verify(input, expected); + } + + // MD4("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345678901ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345678901") = de49da96c105be37b242f2bee86c4759 + [Fact] + public void TryEncrypt_128bytes_HitsEdgeCase() + { + ReadOnlySpan input = new ReadOnlySpan(Encoding.Default.GetBytes("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345678901ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345678901")); + ReadOnlySpan expected = new byte[] { 0xde, 0x49, 0xda, 0x96, 0xc1, 0x05, 0xbe, 0x37, 0xb2, 0x42, 0xf2, 0xbe, 0xe8, 0x6c, 0x47, 0x59 }; + Verify(input, expected); + } + + // MD4("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345678901ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789012") = a6c10c320f8827d08248a2d8b124b040 + [Fact] + public void TryEncrypt_129bytes_HitsEdgeCase() + { + ReadOnlySpan input = new ReadOnlySpan(Encoding.Default.GetBytes("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345678901ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789012")); + ReadOnlySpan expected = new byte[] { 0xa6, 0xc1, 0x0c, 0x32, 0x0f, 0x88, 0x27, 0xd0, 0x82, 0x48, 0xa2, 0xd8, 0xb1, 0x24, 0xb0, 0x40 }; + Verify(input, expected); + } + + private void Verify(ReadOnlySpan input, ReadOnlySpan expected) + { + Span output = stackalloc byte[expected.Length]; + MD4.HashData(input, output); + Assert.Equal(expected.ToArray(), output.ToArray()); + } + } +} diff --git a/src/libraries/System.Net.Security/tests/UnitTests/System.Net.Security.Unit.Tests.csproj b/src/libraries/System.Net.Security/tests/UnitTests/System.Net.Security.Unit.Tests.csproj index da4dde4e192b90..28b3f81b02b3d7 100644 --- a/src/libraries/System.Net.Security/tests/UnitTests/System.Net.Security.Unit.Tests.csproj +++ b/src/libraries/System.Net.Security/tests/UnitTests/System.Net.Security.Unit.Tests.csproj @@ -10,13 +10,17 @@ 436 $(NoWarn);3021 - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-Android annotations true + + + + From bb5ca4c9380196bcce4fc62ce5e6c9d52f001b2c Mon Sep 17 00:00:00 2001 From: Peter Sollich Date: Mon, 24 Jan 2022 09:24:38 +0100 Subject: [PATCH 019/161] Fix one source of perf regression in GCHeap::Alloc. This impacts the System.Collections.CtorFromCollectionNonGeneric family of benchmarks. (#64091) These benchmarks manage to make GCHeap::Alloc into a hotspot, so the call to IsHeapPointer() at the end matters for performance. --- src/coreclr/gc/gc.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/coreclr/gc/gc.cpp b/src/coreclr/gc/gc.cpp index e270bcdc91ee47..9ab892a5ad338d 100644 --- a/src/coreclr/gc/gc.cpp +++ b/src/coreclr/gc/gc.cpp @@ -44081,12 +44081,8 @@ GCHeap::Alloc(gc_alloc_context* context, size_t size, uint32_t flags REQD_ALIGN_ } CHECK_ALLOC_AND_POSSIBLY_REGISTER_FOR_FINALIZATION(newAlloc, size, flags & GC_ALLOC_FINALIZE); - #ifdef USE_REGIONS - if (!IsHeapPointer (newAlloc)) - { - GCToOSInterface::DebugBreak(); - } + assert (IsHeapPointer (newAlloc)); #endif //USE_REGIONS return newAlloc; From 73bf54ffa4c7ca3e9ff471456ed57a719b66a847 Mon Sep 17 00:00:00 2001 From: Wraith Date: Mon, 24 Jan 2022 08:53:39 +0000 Subject: [PATCH 020/161] Add blsr (#63545) --- src/coreclr/jit/emitxarch.h | 2 +- src/coreclr/jit/hwintrinsic.h | 19 ++++++ src/coreclr/jit/instrsxarch.h | 2 +- src/coreclr/jit/lower.cpp | 42 +++++++------ src/coreclr/jit/lower.h | 4 +- src/coreclr/jit/lowerarmarch.cpp | 16 +++++ src/coreclr/jit/lowerxarch.cpp | 105 +++++++++++++++++++++++++++++++ 7 files changed, 168 insertions(+), 22 deletions(-) diff --git a/src/coreclr/jit/emitxarch.h b/src/coreclr/jit/emitxarch.h index d6ed324deb242a..5cef7d5aa12f25 100644 --- a/src/coreclr/jit/emitxarch.h +++ b/src/coreclr/jit/emitxarch.h @@ -193,7 +193,7 @@ bool IsDstDstSrcAVXInstruction(instruction ins); bool IsDstSrcSrcAVXInstruction(instruction ins); bool HasRegularWideForm(instruction ins); bool HasRegularWideImmediateForm(instruction ins); -bool DoesWriteZeroFlag(instruction ins); +static bool DoesWriteZeroFlag(instruction ins); bool DoesWriteSignFlag(instruction ins); bool DoesResetOverflowAndCarryFlags(instruction ins); bool IsFlagsAlwaysModified(instrDesc* id); diff --git a/src/coreclr/jit/hwintrinsic.h b/src/coreclr/jit/hwintrinsic.h index 43bd543c599f1d..4551ed9e4e1ce1 100644 --- a/src/coreclr/jit/hwintrinsic.h +++ b/src/coreclr/jit/hwintrinsic.h @@ -577,6 +577,25 @@ struct HWIntrinsicInfo return lookup(id).ins[type - TYP_BYTE]; } + static instruction lookupIns(GenTreeHWIntrinsic* intrinsicNode) + { + assert(intrinsicNode != nullptr); + + NamedIntrinsic intrinsic = intrinsicNode->GetHWIntrinsicId(); + var_types type = TYP_UNKNOWN; + + if (lookupCategory(intrinsic) == HW_Category_Scalar) + { + type = intrinsicNode->TypeGet(); + } + else + { + type = intrinsicNode->GetSimdBaseType(); + } + + return lookupIns(intrinsic, type); + } + static HWIntrinsicCategory lookupCategory(NamedIntrinsic id) { return lookup(id).category; diff --git a/src/coreclr/jit/instrsxarch.h b/src/coreclr/jit/instrsxarch.h index 458f919fe27935..08d4c4a8c8675d 100644 --- a/src/coreclr/jit/instrsxarch.h +++ b/src/coreclr/jit/instrsxarch.h @@ -595,7 +595,7 @@ INST3(FIRST_BMI_INSTRUCTION, "FIRST_BMI_INSTRUCTION", IUM_WR, BAD_CODE, BAD_CODE INST3(andn, "andn", IUM_WR, BAD_CODE, BAD_CODE, SSE38(0xF2), INS_Flags_IsDstDstSrcAVXInstruction) // Logical AND NOT INST3(blsi, "blsi", IUM_WR, BAD_CODE, BAD_CODE, SSE38(0xF3), INS_Flags_IsDstDstSrcAVXInstruction) // Extract Lowest Set Isolated Bit INST3(blsmsk, "blsmsk", IUM_WR, BAD_CODE, BAD_CODE, SSE38(0xF3), INS_Flags_IsDstDstSrcAVXInstruction) // Get Mask Up to Lowest Set Bit -INST3(blsr, "blsr", IUM_WR, BAD_CODE, BAD_CODE, SSE38(0xF3), INS_Flags_IsDstDstSrcAVXInstruction) // Reset Lowest Set Bit +INST3(blsr, "blsr", IUM_WR, BAD_CODE, BAD_CODE, SSE38(0xF3), Resets_OF | Writes_SF | Writes_ZF | Undefined_AF | Undefined_PF | Writes_CF | INS_Flags_IsDstDstSrcAVXInstruction) // Reset Lowest Set Bit INST3(bextr, "bextr", IUM_WR, BAD_CODE, BAD_CODE, SSE38(0xF7), INS_Flags_IsDstDstSrcAVXInstruction) // Bit Field Extract // BMI2 diff --git a/src/coreclr/jit/lower.cpp b/src/coreclr/jit/lower.cpp index f29baa320940d7..d19e1460c4a035 100644 --- a/src/coreclr/jit/lower.cpp +++ b/src/coreclr/jit/lower.cpp @@ -139,7 +139,7 @@ GenTree* Lowering::LowerNode(GenTree* node) case GT_AND: case GT_OR: case GT_XOR: - return LowerBinaryArithmetic(node->AsOp()); + return LowerBinaryArithmeticCommon(node->AsOp()); case GT_MUL: case GT_MULHI: @@ -2708,10 +2708,16 @@ GenTree* Lowering::OptimizeConstCompare(GenTree* cmp) if (op2->IsIntegralConst(0) && (op1->gtNext == op2) && (op2->gtNext == cmp) && #ifdef TARGET_XARCH - op1->OperIs(GT_AND, GT_OR, GT_XOR, GT_ADD, GT_SUB, GT_NEG)) + (op1->OperIs(GT_AND, GT_OR, GT_XOR, GT_ADD, GT_SUB, GT_NEG) +#ifdef FEATURE_HW_INTRINSICS + || (op1->OperIs(GT_HWINTRINSIC) && + emitter::DoesWriteZeroFlag(HWIntrinsicInfo::lookupIns(op1->AsHWIntrinsic()))) +#endif // FEATURE_HW_INTRINSICS + ) #else // TARGET_ARM64 - op1->OperIs(GT_AND, GT_ADD, GT_SUB)) + op1->OperIs(GT_AND, GT_ADD, GT_SUB) #endif + ) { op1->gtFlags |= GTF_SET_FLAGS; op1->SetUnusedValue(); @@ -5117,7 +5123,7 @@ GenTree* Lowering::LowerAdd(GenTreeOp* node) } //------------------------------------------------------------------------ -// LowerBinaryArithmetic: lowers the given binary arithmetic node. +// LowerBinaryArithmeticCommon: lowers the given binary arithmetic node. // // Recognizes opportunities for using target-independent "combined" nodes // (currently AND_NOT on ARMArch). Performs containment checks. @@ -5128,41 +5134,39 @@ GenTree* Lowering::LowerAdd(GenTreeOp* node) // Returns: // The next node to lower. // -GenTree* Lowering::LowerBinaryArithmetic(GenTreeOp* node) +GenTree* Lowering::LowerBinaryArithmeticCommon(GenTreeOp* binOp) { // TODO-CQ-XArch: support BMI2 "andn" in codegen and condition // this logic on the support for the instruction set on XArch. CLANG_FORMAT_COMMENT_ANCHOR; #ifdef TARGET_ARMARCH - if (comp->opts.OptimizationEnabled() && node->OperIs(GT_AND)) + if (comp->opts.OptimizationEnabled() && binOp->OperIs(GT_AND)) { GenTree* opNode = nullptr; GenTree* notNode = nullptr; - if (node->gtGetOp1()->OperIs(GT_NOT)) + if (binOp->gtGetOp1()->OperIs(GT_NOT)) { - notNode = node->gtGetOp1(); - opNode = node->gtGetOp2(); + notNode = binOp->gtGetOp1(); + opNode = binOp->gtGetOp2(); } - else if (node->gtGetOp2()->OperIs(GT_NOT)) + else if (binOp->gtGetOp2()->OperIs(GT_NOT)) { - notNode = node->gtGetOp2(); - opNode = node->gtGetOp1(); + notNode = binOp->gtGetOp2(); + opNode = binOp->gtGetOp1(); } if (notNode != nullptr) { - node->gtOp1 = opNode; - node->gtOp2 = notNode->AsUnOp()->gtGetOp1(); - node->ChangeOper(GT_AND_NOT); + binOp->gtOp1 = opNode; + binOp->gtOp2 = notNode->AsUnOp()->gtGetOp1(); + binOp->ChangeOper(GT_AND_NOT); BlockRange().Remove(notNode); } } -#endif // TARGET_ARMARCH - - ContainCheckBinary(node); +#endif - return node->gtNext; + return LowerBinaryArithmetic(binOp); } //------------------------------------------------------------------------ diff --git a/src/coreclr/jit/lower.h b/src/coreclr/jit/lower.h index 92a4ef43f2370a..624cc1372dc5a9 100644 --- a/src/coreclr/jit/lower.h +++ b/src/coreclr/jit/lower.h @@ -297,7 +297,8 @@ class Lowering final : public Phase void LowerStoreIndir(GenTreeStoreInd* node); GenTree* LowerAdd(GenTreeOp* node); GenTree* LowerMul(GenTreeOp* mul); - GenTree* LowerBinaryArithmetic(GenTreeOp* node); + GenTree* LowerBinaryArithmeticCommon(GenTreeOp* binOp); + GenTree* LowerBinaryArithmetic(GenTreeOp* binOp); bool LowerUnsignedDivOrMod(GenTreeOp* divMod); GenTree* LowerConstIntDivOrMod(GenTree* node); GenTree* LowerSignedDivOrMod(GenTree* node); @@ -343,6 +344,7 @@ class Lowering final : public Phase void LowerHWIntrinsicToScalar(GenTreeHWIntrinsic* node); void LowerHWIntrinsicGetElement(GenTreeHWIntrinsic* node); void LowerHWIntrinsicWithElement(GenTreeHWIntrinsic* node); + GenTree* TryLowerAndOpToResetLowestSetBit(GenTreeOp* binOp); #elif defined(TARGET_ARM64) bool IsValidConstForMovImm(GenTreeHWIntrinsic* node); void LowerHWIntrinsicFusedMultiplyAddScalar(GenTreeHWIntrinsic* node); diff --git a/src/coreclr/jit/lowerarmarch.cpp b/src/coreclr/jit/lowerarmarch.cpp index e1812d7e8df6fa..67e1269dfd429a 100644 --- a/src/coreclr/jit/lowerarmarch.cpp +++ b/src/coreclr/jit/lowerarmarch.cpp @@ -281,6 +281,22 @@ GenTree* Lowering::LowerMul(GenTreeOp* mul) return mul->gtNext; } +//------------------------------------------------------------------------ +// LowerBinaryArithmetic: lowers the given binary arithmetic node. +// +// Arguments: +// node - the arithmetic node to lower +// +// Returns: +// The next node to lower. +// +GenTree* Lowering::LowerBinaryArithmetic(GenTreeOp* binOp) +{ + ContainCheckBinary(binOp); + + return binOp->gtNext; +} + //------------------------------------------------------------------------ // LowerBlockStore: Lower a block store node // diff --git a/src/coreclr/jit/lowerxarch.cpp b/src/coreclr/jit/lowerxarch.cpp index 413e4ba74a6a48..a6b0ceb91ba955 100644 --- a/src/coreclr/jit/lowerxarch.cpp +++ b/src/coreclr/jit/lowerxarch.cpp @@ -159,6 +159,33 @@ GenTree* Lowering::LowerMul(GenTreeOp* mul) return mul->gtNext; } +//------------------------------------------------------------------------ +// LowerBinaryArithmetic: lowers the given binary arithmetic node. +// +// Arguments: +// node - the arithmetic node to lower +// +// Returns: +// The next node to lower. +// +GenTree* Lowering::LowerBinaryArithmetic(GenTreeOp* binOp) +{ +#ifdef FEATURE_HW_INTRINSICS + if (comp->opts.OptimizationEnabled() && binOp->OperIs(GT_AND) && varTypeIsIntegral(binOp)) + { + GenTree* blsrNode = TryLowerAndOpToResetLowestSetBit(binOp); + if (blsrNode != nullptr) + { + return blsrNode->gtNext; + } + } +#endif + + ContainCheckBinary(binOp); + + return binOp->gtNext; +} + //------------------------------------------------------------------------ // LowerBlockStore: Lower a block store node // @@ -3697,6 +3724,84 @@ void Lowering::LowerHWIntrinsicToScalar(GenTreeHWIntrinsic* node) LowerNode(cast); } } + +//---------------------------------------------------------------------------------------------- +// Lowering::TryLowerAndOpToResetLowestSetBit: Lowers a tree AND(X, ADD(X, -1) to HWIntrinsic::ResetLowestSetBit +// +// Arguments: +// andNode - GT_AND node of integral type +// +// Return Value: +// Returns the replacement node if one is created else nullptr indicating no replacement +// +GenTree* Lowering::TryLowerAndOpToResetLowestSetBit(GenTreeOp* andNode) +{ + assert(andNode->OperIs(GT_AND) && varTypeIsIntegral(andNode)); + + GenTree* op1 = andNode->gtGetOp1(); + if (!op1->OperIs(GT_LCL_VAR) || comp->lvaGetDesc(op1->AsLclVar())->IsAddressExposed()) + { + return nullptr; + } + + GenTree* op2 = andNode->gtGetOp2(); + if (!op2->OperIs(GT_ADD)) + { + return nullptr; + } + + GenTree* addOp2 = op2->gtGetOp2(); + if (!addOp2->IsIntegralConst(-1)) + { + return nullptr; + } + + GenTree* addOp1 = op2->gtGetOp1(); + if (!addOp1->OperIs(GT_LCL_VAR) || (addOp1->AsLclVar()->GetLclNum() != op1->AsLclVar()->GetLclNum())) + { + return nullptr; + } + + NamedIntrinsic intrinsic; + if (op1->TypeIs(TYP_LONG) && comp->compOpportunisticallyDependsOn(InstructionSet_BMI1_X64)) + { + intrinsic = NamedIntrinsic::NI_BMI1_X64_ResetLowestSetBit; + } + else if (comp->compOpportunisticallyDependsOn(InstructionSet_BMI1)) + { + intrinsic = NamedIntrinsic::NI_BMI1_ResetLowestSetBit; + } + else + { + return nullptr; + } + + LIR::Use use; + if (!BlockRange().TryGetUse(andNode, &use)) + { + return nullptr; + } + + GenTreeHWIntrinsic* blsrNode = comp->gtNewScalarHWIntrinsicNode(andNode->TypeGet(), op1, intrinsic); + + JITDUMP("Lower: optimize AND(X, ADD(X, -1))\n"); + DISPNODE(andNode); + JITDUMP("to:\n"); + DISPNODE(blsrNode); + + use.ReplaceWith(blsrNode); + + BlockRange().InsertBefore(andNode, blsrNode); + BlockRange().Remove(andNode); + BlockRange().Remove(op2); + BlockRange().Remove(addOp1); + BlockRange().Remove(addOp2); + + ContainCheckHWIntrinsic(blsrNode); + + return blsrNode; +} + #endif // FEATURE_HW_INTRINSICS //---------------------------------------------------------------------------------------------- From 85b144a0317dd1ae2b901205434fae02089723a8 Mon Sep 17 00:00:00 2001 From: Carlos Sanchez <1175054+carlossanlop@users.noreply.github.com> Date: Mon, 24 Jan 2022 00:54:11 -0800 Subject: [PATCH 021/161] Fix FileSystemAclExtensions.Create when passing a null FileSecurity (#61297) * Make FileSecurity parameter nullable. * Add missing ArgumentException message for FileMode.Append. * Refactor tests to ensure FileSecurity is tested with all FileMode and FileSystemRights combinations. Separate special cases. * Remove exception that throws when FileSecurity is null. Ensure we have logic that can create a FileHandle when FileSecurity is null. Fix bug where FileShare.Inheritable causes IOException because it is being unexpectedly passed to the P/Invoke (it should just be saved in the SECURITY_ATTRIBUTES struct). Add documentation to mention this parameter as optional. Ensure all exceptions match exactly what we have in .NET Framework, with simpler logic. * Address suggestions Co-authored-by: carlossanlop --- .../ref/System.IO.FileSystem.AccessControl.cs | 2 +- .../src/Resources/Strings.resx | 3 + .../src/System/IO/FileSystemAclExtensions.cs | 99 ++++- .../tests/FileSystemAclExtensionsTests.cs | 416 +++++++++++------- 4 files changed, 333 insertions(+), 187 deletions(-) diff --git a/src/libraries/System.IO.FileSystem.AccessControl/ref/System.IO.FileSystem.AccessControl.cs b/src/libraries/System.IO.FileSystem.AccessControl/ref/System.IO.FileSystem.AccessControl.cs index 64455bbc92ccb6..ae5a0e9562c7d3 100644 --- a/src/libraries/System.IO.FileSystem.AccessControl/ref/System.IO.FileSystem.AccessControl.cs +++ b/src/libraries/System.IO.FileSystem.AccessControl/ref/System.IO.FileSystem.AccessControl.cs @@ -9,7 +9,7 @@ namespace System.IO public static partial class FileSystemAclExtensions { public static void Create(this System.IO.DirectoryInfo directoryInfo, System.Security.AccessControl.DirectorySecurity directorySecurity) { } - public static System.IO.FileStream Create(this System.IO.FileInfo fileInfo, System.IO.FileMode mode, System.Security.AccessControl.FileSystemRights rights, System.IO.FileShare share, int bufferSize, System.IO.FileOptions options, System.Security.AccessControl.FileSecurity fileSecurity) { throw null; } + public static System.IO.FileStream Create(this System.IO.FileInfo fileInfo, System.IO.FileMode mode, System.Security.AccessControl.FileSystemRights rights, System.IO.FileShare share, int bufferSize, System.IO.FileOptions options, System.Security.AccessControl.FileSecurity? fileSecurity) { throw null; } public static System.IO.DirectoryInfo CreateDirectory(this System.Security.AccessControl.DirectorySecurity directorySecurity, string path) { throw null; } public static System.Security.AccessControl.DirectorySecurity GetAccessControl(this System.IO.DirectoryInfo directoryInfo) { throw null; } public static System.Security.AccessControl.DirectorySecurity GetAccessControl(this System.IO.DirectoryInfo directoryInfo, System.Security.AccessControl.AccessControlSections includeSections) { throw null; } diff --git a/src/libraries/System.IO.FileSystem.AccessControl/src/Resources/Strings.resx b/src/libraries/System.IO.FileSystem.AccessControl/src/Resources/Strings.resx index d71dfd08146e4d..5b24a6296c36d0 100644 --- a/src/libraries/System.IO.FileSystem.AccessControl/src/Resources/Strings.resx +++ b/src/libraries/System.IO.FileSystem.AccessControl/src/Resources/Strings.resx @@ -122,6 +122,9 @@ Type must be an IdentityReference, such as NTAccount or SecurityIdentifier. + + Append access can be requested only in write-only mode. + The value '{0}' is not valid for this usage of the type {1}. diff --git a/src/libraries/System.IO.FileSystem.AccessControl/src/System/IO/FileSystemAclExtensions.cs b/src/libraries/System.IO.FileSystem.AccessControl/src/System/IO/FileSystemAclExtensions.cs index 51b3f926ba5196..c47f9e255dc91c 100644 --- a/src/libraries/System.IO.FileSystem.AccessControl/src/System/IO/FileSystemAclExtensions.cs +++ b/src/libraries/System.IO.FileSystem.AccessControl/src/System/IO/FileSystemAclExtensions.cs @@ -159,10 +159,10 @@ public static void Create(this DirectoryInfo directoryInfo, DirectorySecurity di /// One of the enumeration values for controlling the kind of access other FileStream objects can have to the same file. /// The number of bytes buffered for reads and writes to the file. /// One of the enumeration values that describes how to create or overwrite the file. - /// An object that determines the access control and audit security for the file. + /// An optional object that determines the access control and audit security for the file. /// A file stream for the newly created file. /// The and combination is invalid. - /// or is . + /// is . /// or are out of their legal enum range. ///-or- /// is not a positive number. @@ -170,18 +170,13 @@ public static void Create(this DirectoryInfo directoryInfo, DirectorySecurity di /// An I/O error occurs. /// Access to the path is denied. /// This extension method was added to .NET Core to bring the functionality that was provided by the `System.IO.FileStream.#ctor(System.String,System.IO.FileMode,System.Security.AccessControl.FileSystemRights,System.IO.FileShare,System.Int32,System.IO.FileOptions,System.Security.AccessControl.FileSecurity)` .NET Framework constructor. - public static FileStream Create(this FileInfo fileInfo, FileMode mode, FileSystemRights rights, FileShare share, int bufferSize, FileOptions options, FileSecurity fileSecurity) + public static FileStream Create(this FileInfo fileInfo, FileMode mode, FileSystemRights rights, FileShare share, int bufferSize, FileOptions options, FileSecurity? fileSecurity) { if (fileInfo == null) { throw new ArgumentNullException(nameof(fileInfo)); } - if (fileSecurity == null) - { - throw new ArgumentNullException(nameof(fileSecurity)); - } - // don't include inheritable in our bounds check for share FileShare tempshare = share & ~FileShare.Inheritable; @@ -200,18 +195,33 @@ public static FileStream Create(this FileInfo fileInfo, FileMode mode, FileSyste throw new ArgumentOutOfRangeException(nameof(bufferSize), SR.ArgumentOutOfRange_NeedPosNum); } - // Do not allow using combinations of non-writing file system rights with writing file modes + // Do not combine writing modes with exclusively read rights + // Write contains AppendData, WriteAttributes, WriteData and WriteExtendedAttributes if ((rights & FileSystemRights.Write) == 0 && (mode == FileMode.Truncate || mode == FileMode.CreateNew || mode == FileMode.Create || mode == FileMode.Append)) { throw new ArgumentException(SR.Format(SR.Argument_InvalidFileModeAndFileSystemRightsCombo, mode, rights)); } + // Additionally, append is disallowed if any read rights are provided + // ReadAndExecute contains ExecuteFile, ReadAttributes, ReadData, ReadExtendedAttributes and ReadPermissions + if ((rights & FileSystemRights.ReadAndExecute) != 0 && mode == FileMode.Append) + { + throw new ArgumentException(SR.Argument_InvalidAppendMode); + } + + // Cannot truncate unless all of the write rights are provided + // Write contains AppendData, WriteAttributes, WriteData and WriteExtendedAttributes + if (mode == FileMode.Truncate && (rights & FileSystemRights.Write) != FileSystemRights.Write) + { + throw new ArgumentException(SR.Format(SR.Argument_InvalidFileModeAndFileSystemRightsCombo, mode, rights)); + } + SafeFileHandle handle = CreateFileHandle(fileInfo.FullName, mode, rights, share, options, fileSecurity); try { - return new FileStream(handle, GetFileStreamFileAccess(rights), bufferSize, (options & FileOptions.Asynchronous) != 0); + return new FileStream(handle, GetFileAccessFromRights(rights), bufferSize, (options & FileOptions.Asynchronous) != 0); } catch { @@ -258,23 +268,48 @@ public static DirectoryInfo CreateDirectory(this DirectorySecurity directorySecu // In the context of a FileStream, the only ACCESS_MASK ACE rights we care about are reading/writing data and the generic read/write rights. // See: https://docs.microsoft.com/en-us/windows/win32/secauthz/access-mask - private static FileAccess GetFileStreamFileAccess(FileSystemRights rights) + private static FileAccess GetFileAccessFromRights(FileSystemRights rights) { FileAccess access = 0; - if ((rights & FileSystemRights.ReadData) != 0 || ((int)rights & Interop.Kernel32.GenericOperations.GENERIC_READ) != 0) + + if ((rights & FileSystemRights.FullControl) != 0 || + (rights & FileSystemRights.Modify) != 0) + { + return FileAccess.ReadWrite; + } + + if ((rights & FileSystemRights.ReadData) != 0 || // Same as ListDirectory + (rights & FileSystemRights.ReadExtendedAttributes) != 0 || + (rights & FileSystemRights.ExecuteFile) != 0 || // Same as Traverse + (rights & FileSystemRights.ReadAttributes) != 0 || + (rights & FileSystemRights.ReadPermissions) != 0 || + (rights & FileSystemRights.TakeOwnership) != 0 || + ((int)rights & Interop.Kernel32.GenericOperations.GENERIC_READ) != 0) { access = FileAccess.Read; } - if ((rights & FileSystemRights.WriteData) != 0 || ((int)rights & Interop.Kernel32.GenericOperations.GENERIC_WRITE) != 0) + if ((rights & FileSystemRights.AppendData) != 0 || // Same as CreateDirectories + (rights & FileSystemRights.ChangePermissions) != 0 || + (rights & FileSystemRights.Delete) != 0 || + (rights & FileSystemRights.DeleteSubdirectoriesAndFiles) != 0 || + (rights & FileSystemRights.WriteAttributes) != 0 || + (rights & FileSystemRights.WriteData) != 0 || // Same as CreateFiles + (rights & FileSystemRights.WriteExtendedAttributes) != 0 || + ((int)rights & Interop.Kernel32.GenericOperations.GENERIC_WRITE) != 0) + { + access |= FileAccess.Write; + } + + if (access == 0) { - access = access == FileAccess.Read ? FileAccess.ReadWrite : FileAccess.Write; + throw new ArgumentOutOfRangeException(nameof(rights)); } return access; } - private static unsafe SafeFileHandle CreateFileHandle(string fullPath, FileMode mode, FileSystemRights rights, FileShare share, FileOptions options, FileSecurity security) + private static unsafe SafeFileHandle CreateFileHandle(string fullPath, FileMode mode, FileSystemRights rights, FileShare share, FileOptions options, FileSecurity? security) { Debug.Assert(fullPath != null); @@ -291,23 +326,39 @@ private static unsafe SafeFileHandle CreateFileHandle(string fullPath, FileMode SafeFileHandle handle; - fixed (byte* pSecurityDescriptor = security.GetSecurityDescriptorBinaryForm()) + var secAttrs = new Interop.Kernel32.SECURITY_ATTRIBUTES { - var secAttrs = new Interop.Kernel32.SECURITY_ATTRIBUTES + nLength = (uint)sizeof(Interop.Kernel32.SECURITY_ATTRIBUTES), + bInheritHandle = ((share & FileShare.Inheritable) != 0) ? Interop.BOOL.TRUE : Interop.BOOL.FALSE, + }; + + if (security != null) + { + fixed (byte* pSecurityDescriptor = security.GetSecurityDescriptorBinaryForm()) { - nLength = (uint)sizeof(Interop.Kernel32.SECURITY_ATTRIBUTES), - bInheritHandle = ((share & FileShare.Inheritable) != 0) ? Interop.BOOL.TRUE : Interop.BOOL.FALSE, - lpSecurityDescriptor = (IntPtr)pSecurityDescriptor - }; + secAttrs.lpSecurityDescriptor = (IntPtr)pSecurityDescriptor; + handle = CreateFileHandleInternal(fullPath, mode, rights, share, flagsAndAttributes, &secAttrs); + } + } + else + { + handle = CreateFileHandleInternal(fullPath, mode, rights, share, flagsAndAttributes, &secAttrs); + } + + return handle; + static unsafe SafeFileHandle CreateFileHandleInternal(string fullPath, FileMode mode, FileSystemRights rights, FileShare share, int flagsAndAttributes, Interop.Kernel32.SECURITY_ATTRIBUTES* secAttrs) + { + SafeFileHandle handle; using (DisableMediaInsertionPrompt.Create()) { - handle = Interop.Kernel32.CreateFile(fullPath, (int)rights, share, &secAttrs, mode, flagsAndAttributes, IntPtr.Zero); + // The Inheritable bit is only set in the SECURITY_ATTRIBUTES struct, + // and should not be passed to the CreateFile P/Invoke. + handle = Interop.Kernel32.CreateFile(fullPath, (int)rights, (share & ~FileShare.Inheritable), secAttrs, mode, flagsAndAttributes, IntPtr.Zero); ValidateFileHandle(handle, fullPath); } + return handle; } - - return handle; } private static void ValidateFileHandle(SafeFileHandle handle, string fullPath) diff --git a/src/libraries/System.IO.FileSystem.AccessControl/tests/FileSystemAclExtensionsTests.cs b/src/libraries/System.IO.FileSystem.AccessControl/tests/FileSystemAclExtensionsTests.cs index 22f2e6ffdd09cd..80eb1805310b5b 100644 --- a/src/libraries/System.IO.FileSystem.AccessControl/tests/FileSystemAclExtensionsTests.cs +++ b/src/libraries/System.IO.FileSystem.AccessControl/tests/FileSystemAclExtensionsTests.cs @@ -196,7 +196,7 @@ public void DirectoryInfo_Create_NotFound() var dirInfo = new DirectoryInfo(dirPath); var security = new DirectorySecurity(); // Fails because the DirectorySecurity lacks any rights to create parent folder - Assert.Throws(() => CreateDirectoryWithSecurity(dirInfo, security)); + Assert.Throws(() => CreateDirectoryWithSecurity(dirInfo, security)); } [Fact] @@ -284,156 +284,196 @@ public void FileInfo_Create_NullFileInfo() { FileInfo info = null; var security = new FileSecurity(); - Assert.Throws("fileInfo", () => - CreateFileWithSecurity(info, FileMode.CreateNew, FileSystemRights.WriteData, FileShare.Delete, DefaultBufferSize, FileOptions.None, security)); - } - - [Fact] - public void FileInfo_Create_NullFileSecurity() - { - var info = new FileInfo("path"); - - Assert.Throws("fileSecurity", () => - CreateFileWithSecurity(info, FileMode.CreateNew, FileSystemRights.WriteData, FileShare.Delete, DefaultBufferSize, FileOptions.None, null)); + info.Create(FileMode.CreateNew, FileSystemRights.FullControl, FileShare.None, DefaultBufferSize, FileOptions.None, security)); } [Fact] - public void FileInfo_Create_NotFound() + public void FileInfo_Create_DirectoryNotFound() { using var tempRootDir = new TempAclDirectory(); string path = Path.Combine(tempRootDir.Path, Guid.NewGuid().ToString(), "file.txt"); - var fileInfo = new FileInfo(path); + var info = new FileInfo(path); var security = new FileSecurity(); - Assert.Throws(() => - CreateFileWithSecurity(fileInfo, FileMode.CreateNew, FileSystemRights.WriteData, FileShare.Delete, DefaultBufferSize, FileOptions.None, security)); + info.Create(FileMode.CreateNew, FileSystemRights.FullControl, FileShare.None, DefaultBufferSize, FileOptions.None, security)); } [Theory] [InlineData((FileMode)int.MinValue)] [InlineData((FileMode)0)] [InlineData((FileMode)int.MaxValue)] - public void FileInfo_Create_FileSecurity_InvalidFileMode(FileMode invalidMode) - { - var security = new FileSecurity(); - var info = new FileInfo("path"); - - Assert.Throws("mode", () => - CreateFileWithSecurity(info, invalidMode, FileSystemRights.WriteData, FileShare.Delete, DefaultBufferSize, FileOptions.None, security)); - } + public void FileInfo_Create_FileSecurity_OutOfRange_FileMode(FileMode invalidMode) => + FileInfo_Create_FileSecurity_ArgumentOutOfRangeException("mode", mode: invalidMode); [Theory] [InlineData((FileShare)(-1))] [InlineData((FileShare)int.MaxValue)] - public void FileInfo_Create_FileSecurity_InvalidFileShare(FileShare invalidFileShare) - { - var security = new FileSecurity(); - var info = new FileInfo("path"); - - Assert.Throws("share", () => - CreateFileWithSecurity(info, FileMode.CreateNew, FileSystemRights.WriteData, invalidFileShare, DefaultBufferSize, FileOptions.None, security)); - } + public void FileInfo_Create_FileSecurity_OutOfRange_FileShare(FileShare invalidFileShare) => + FileInfo_Create_FileSecurity_ArgumentOutOfRangeException("share", share: invalidFileShare); [Theory] [InlineData(int.MinValue)] [InlineData(0)] - public void FileInfo_Create_FileSecurity_InvalidBufferSize(int invalidBufferSize) - { - var security = new FileSecurity(); - var info = new FileInfo("path"); + public void FileInfo_Create_FileSecurity_OutOfRange_BufferSize(int invalidBufferSize) => + FileInfo_Create_FileSecurity_ArgumentOutOfRangeException("bufferSize", bufferSize: invalidBufferSize); + + public static IEnumerable WriteModes_ReadRights_ForbiddenCombo_Data() => + from mode in s_writableModes + from rights in s_readableRights + where + // These combinations are allowed, exclude them + !(rights == FileSystemRights.CreateFiles && + (mode == FileMode.Append || mode == FileMode.Create || mode == FileMode.CreateNew)) + select new object[] { mode, rights }; + + // Do not combine writing modes with exclusively read rights + [Theory] + [MemberData(nameof(WriteModes_ReadRights_ForbiddenCombo_Data))] + public void FileInfo_Create_FileSecurity_WriteModes_ReadRights_ForbiddenCombo(FileMode mode, FileSystemRights rights) => + FileInfo_Create_FileSecurity_ArgumentException(mode, rights); - Assert.Throws("bufferSize", () => - CreateFileWithSecurity(info, FileMode.CreateNew, FileSystemRights.WriteData, FileShare.Delete, invalidBufferSize, FileOptions.None, security)); - } + public static IEnumerable OpenOrCreateMode_ReadRights_AllowedCombo_Data() => + from rights in s_readableRights + select new object[] { rights }; + // OpenOrCreate allows using exclusively read rights [Theory] - [InlineData(FileMode.Truncate, FileSystemRights.Read)] - [InlineData(FileMode.Truncate, FileSystemRights.ReadData)] - [InlineData(FileMode.CreateNew, FileSystemRights.Read)] - [InlineData(FileMode.CreateNew, FileSystemRights.ReadData)] - [InlineData(FileMode.Create, FileSystemRights.Read)] - [InlineData(FileMode.Create, FileSystemRights.ReadData)] - [InlineData(FileMode.Append, FileSystemRights.Read)] - [InlineData(FileMode.Append, FileSystemRights.ReadData)] - public void FileInfo_Create_FileSecurity_ForbiddenCombo_FileModeFileSystemSecurity(FileMode mode, FileSystemRights rights) - { - var security = new FileSecurity(); - var info = new FileInfo("path"); + [MemberData(nameof(OpenOrCreateMode_ReadRights_AllowedCombo_Data))] + public void FileInfo_Create_FileSecurity_OpenOrCreateMode_ReadRights_AllowedCombo(FileSystemRights rights) => + FileInfo_Create_FileSecurity_Successful(FileMode.OpenOrCreate, rights); - Assert.Throws(() => - CreateFileWithSecurity(info, mode, rights, FileShare.Delete, DefaultBufferSize, FileOptions.None, security)); - } + // Append, Create and CreateNew allow using CreateFiles rights + // These combinations were excluded from WriteModes_ReadRights_ForbiddenCombo_Data + [Theory] + [InlineData(FileMode.Append)] + [InlineData(FileMode.Create)] + [InlineData(FileMode.CreateNew)] + public void FileInfo_Create_FileSecurity_WriteModes_CreateFilesRights_AllowedCombo(FileMode mode) => + FileInfo_Create_FileSecurity_Successful(mode, FileSystemRights.CreateFiles); + + public static IEnumerable AppendMode_UnexpectedReadRights_Data() => + from writeRights in s_writableRights + from readRights in new[] { + FileSystemRights.ExecuteFile, + FileSystemRights.ReadAttributes, FileSystemRights.ReadData, FileSystemRights.ReadExtendedAttributes, FileSystemRights.ReadPermissions, + FileSystemRights.Read, // Contains ReadAttributes, ReadData, ReadExtendedAttributes, ReadPermissions + FileSystemRights.ReadAndExecute, // Contains Read and ExecuteFile + } + select new object[] { writeRights | readRights }; + + // Append is allowed if at least one write permission is provided + // But append is disallowed if any read rights are provided + [Theory] + [MemberData(nameof(AppendMode_UnexpectedReadRights_Data))] + public void FileInfo_Create_FileSecurity_AppendMode_UnexpectedReadRights(FileSystemRights rights) => + FileInfo_Create_FileSecurity_ArgumentException(FileMode.Append, rights); + + public static IEnumerable AppendMode_OnlyWriteRights_Data() => + from writeRights in s_writableRights + select new object[] { writeRights }; + + // Append succeeds if only write permissions were provided (no read permissions) + [Theory] + [MemberData(nameof(AppendMode_OnlyWriteRights_Data))] + public void FileInfo_Create_FileSecurity_AppendMode_OnlyWriteRights(FileSystemRights rights) => + FileInfo_Create_FileSecurity_Successful(FileMode.Append, rights); + + public static IEnumerable WritableRights_Data() => + from rights in s_writableRights + select new object[] { rights }; + + // Cannot truncate unless all write rights are provided + [Theory] + [MemberData(nameof(WritableRights_Data))] + public void FileInfo_Create_FileSecurity_TruncateMode_IncompleteWriteRights(FileSystemRights rights) => + FileInfo_Create_FileSecurity_ArgumentException(FileMode.Truncate, rights); [Fact] - public void FileInfo_Create_DefaultFileSecurity() + public void FileInfo_Create_FileSecurity_TruncateMode_AllWriteRights_Throws() { + // Truncate, with all write rights, throws with different messages in each framework: + // - In .NET Framework, throws "Could not find file" + // - In .NET, throws IOException: "The parameter is incorrect" + var security = new FileSecurity(); - Verify_FileSecurity_CreateFile(security); + var info = new FileInfo(Guid.NewGuid().ToString()); + Assert.Throws(() => info.Create(FileMode.Truncate, FileSystemRights.Write | FileSystemRights.ReadData, FileShare.None, DefaultBufferSize, FileOptions.None, security)); } - private void CreateFileWithSecurity(FileInfo info, FileMode mode, FileSystemRights rights, FileShare share, int bufferSize, FileOptions options, FileSecurity security) - { - if (PlatformDetection.IsNetFramework) - { - FileSystemAclExtensions.Create(info, mode, rights, share, bufferSize, options, security); - } - else - { - info.Create(mode, rights, share, bufferSize, options, security); - } - } + public static IEnumerable WriteRights_AllArguments_Data() => + from mode in s_writableModes + from rights in s_writableRights + from share in Enum.GetValues() + from options in Enum.GetValues() + where !(rights == FileSystemRights.CreateFiles && + (mode == FileMode.Append || mode == FileMode.Create || mode == FileMode.CreateNew)) && + !(mode == FileMode.Truncate && rights != FileSystemRights.Write) && + options != FileOptions.Encrypted // Using FileOptions.Encrypted throws UnauthorizedAccessException when attempting to read the created file + select new object[] { mode, rights, share, options }; [Theory] - // Must have at least one Read, otherwise the TempAclDirectory will fail to delete that item on dispose - [MemberData(nameof(RightsToAllow))] - public void FileInfo_Create_AllowSpecific_AccessRules(FileSystemRights rights) - { - using var tempRootDir = new TempAclDirectory(); - string path = Path.Combine(tempRootDir.Path, "file.txt"); - var fileInfo = new FileInfo(path); + [MemberData(nameof(WriteRights_AllArguments_Data))] + public void FileInfo_WriteRights_WithSecurity_Null(FileMode mode, FileSystemRights rights, FileShare share, FileOptions options) => + Verify_FileSecurity_CreateFile(mode, rights, share, DefaultBufferSize, options, expectedSecurity: null); // Null security - FileSecurity expectedSecurity = GetFileSecurity(rights); + [Theory] + [MemberData(nameof(WriteRights_AllArguments_Data))] + public void FileInfo_WriteRights_WithSecurity_Default(FileMode mode, FileSystemRights rights, FileShare share, FileOptions options) => + Verify_FileSecurity_CreateFile(mode, rights, share, DefaultBufferSize, options, new FileSecurity()); // Default security - using FileStream stream = fileInfo.Create( - FileMode.Create, - FileSystemRights.FullControl, - FileShare.ReadWrite | FileShare.Delete, - DefaultBufferSize, - FileOptions.None, - expectedSecurity); + [Theory] + [MemberData(nameof(WriteRights_AllArguments_Data))] + public void FileInfo_WriteRights_WithSecurity_Custom(FileMode mode, FileSystemRights rights, FileShare share, FileOptions options) => + Verify_FileSecurity_CreateFile(mode, rights, share, DefaultBufferSize, options, GetFileSecurity(rights)); // Custom security (AccessRule Allow) + + public static IEnumerable ReadRights_AllArguments_Data() => + from mode in new[] { FileMode.Create, FileMode.CreateNew, FileMode.OpenOrCreate } + from rights in s_readableRights + from share in Enum.GetValues() + from options in Enum.GetValues() + where options != FileOptions.Encrypted // Using FileOptions.Encrypted throws UnauthorizedAccessException when attempting to read the created file + select new object[] { mode, rights, share, options }; - Assert.True(fileInfo.Exists); - tempRootDir.CreatedSubfiles.Add(fileInfo); + [Theory] + [MemberData(nameof(ReadRights_AllArguments_Data))] + public void FileInfo_ReadRights_WithSecurity_Null(FileMode mode, FileSystemRights rights, FileShare share, FileOptions options) => + // Writable FileModes require at least one write right + Verify_FileSecurity_CreateFile(mode, rights | FileSystemRights.WriteData, share, DefaultBufferSize, options, expectedSecurity: null); // Null security - var actualInfo = new FileInfo(fileInfo.FullName); - FileSecurity actualSecurity = actualInfo.GetAccessControl(AccessControlSections.Access); - VerifyAccessSecurity(expectedSecurity, actualSecurity); - } + [Theory] + [MemberData(nameof(ReadRights_AllArguments_Data))] + public void FileInfo_ReadRights_WithSecurity_Default(FileMode mode, FileSystemRights rights, FileShare share, FileOptions options) => + // Writable FileModes require at least one write right + Verify_FileSecurity_CreateFile(mode, rights | FileSystemRights.WriteData, share, DefaultBufferSize, options, new FileSecurity()); // Default security + [Theory] + [MemberData(nameof(ReadRights_AllArguments_Data))] + public void FileInfo_ReadRights_WithSecurity_Custom(FileMode mode, FileSystemRights rights, FileShare share, FileOptions options) => + // Writable FileModes require at least one write right + Verify_FileSecurity_CreateFile(mode, rights | FileSystemRights.WriteData, share, DefaultBufferSize, options, GetFileSecurity(rights)); // Custom security (AccessRule Allow) [Theory] [MemberData(nameof(RightsToDeny))] - public void FileInfo_Create_DenySpecific_AccessRules(FileSystemRights rightsToDeny) + public void FileInfo_Create_FileSecurity_DenyAccessRule(FileSystemRights rightsToDeny) { var expectedSecurity = new FileSecurity(); var identity = new SecurityIdentifier(WellKnownSidType.BuiltinUsersSid, null); - var allowAccessRule = new FileSystemAccessRule(identity, FileSystemRights.Read, AccessControlType.Allow); - expectedSecurity.AddAccessRule(allowAccessRule); + // Add write deny rule var denyAccessRule = new FileSystemAccessRule(identity, rightsToDeny, AccessControlType.Deny); expectedSecurity.AddAccessRule(denyAccessRule); using var tempRootDir = new TempAclDirectory(); - string path = Path.Combine(tempRootDir.Path, "file.txt"); + string path = Path.Combine(tempRootDir.Path, Guid.NewGuid().ToString()); var fileInfo = new FileInfo(path); using FileStream stream = fileInfo.Create( - FileMode.Create, - FileSystemRights.FullControl, - FileShare.ReadWrite | FileShare.Delete, + FileMode.CreateNew, + FileSystemRights.Write, // Create expects at least one write right + FileShare.None, DefaultBufferSize, FileOptions.None, expectedSecurity); @@ -451,7 +491,6 @@ public void FileInfo_Create_DenySpecific_AccessRules(FileSystemRights rightsToDe #region DirectorySecurity CreateDirectory [Fact] - [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)] public void DirectorySecurity_CreateDirectory_NullSecurity() { DirectorySecurity security = null; @@ -474,7 +513,7 @@ public void DirectorySecurity_CreateDirectory_InvalidPath() public void DirectorySecurity_CreateDirectory_DirectoryAlreadyExists() { using var tempRootDir = new TempAclDirectory(); - string path = Path.Combine(tempRootDir.Path, "createMe"); + string path = Path.Combine(tempRootDir.Path, Guid.NewGuid().ToString()); DirectorySecurity expectedSecurity = GetDirectorySecurity(FileSystemRights.FullControl); DirectoryInfo dirInfo = expectedSecurity.CreateDirectory(path); @@ -496,84 +535,137 @@ public void DirectorySecurity_CreateDirectory_DirectoryAlreadyExists() #region Helper methods - public static IEnumerable RightsToDeny() - { - yield return new object[] { FileSystemRights.AppendData }; - yield return new object[] { FileSystemRights.ChangePermissions }; - // yield return new object[] { FileSystemRights.CreateDirectories }; // CreateDirectories == AppendData - yield return new object[] { FileSystemRights.CreateFiles }; - yield return new object[] { FileSystemRights.Delete }; - yield return new object[] { FileSystemRights.DeleteSubdirectoriesAndFiles }; - yield return new object[] { FileSystemRights.ExecuteFile }; - // yield return new object[] { FileSystemRights.FullControl }; // Contains ReadData, should not deny that - // yield return new object[] { FileSystemRights.ListDirectory }; ListDirectory == ReadData - // yield return new object[] { FileSystemRights.Modify }; // Contains ReadData, should not deny that - // yield return new object[] { FileSystemRights.Read }; // Contains ReadData, should not deny that - // yield return new object[] { FileSystemRights.ReadAndExecute }; // Contains ReadData, should not deny that - yield return new object[] { FileSystemRights.ReadAttributes }; - // yield return new object[] { FileSystemRights.ReadData }; // Minimum right required to delete a file or directory - yield return new object[] { FileSystemRights.ReadExtendedAttributes }; - yield return new object[] { FileSystemRights.ReadPermissions }; - // yield return new object[] { FileSystemRights.Synchronize }; // CreateFile always requires Synchronize access - yield return new object[] { FileSystemRights.TakeOwnership }; - //yield return new object[] { FileSystemRights.Traverse }; // Traverse == ExecuteFile - yield return new object[] { FileSystemRights.Write }; - yield return new object[] { FileSystemRights.WriteAttributes }; - // yield return new object[] { FileSystemRights.WriteData }; // WriteData == CreateFiles - yield return new object[] { FileSystemRights.WriteExtendedAttributes }; - } - - public static IEnumerable RightsToAllow() - { - yield return new object[] { FileSystemRights.AppendData }; - yield return new object[] { FileSystemRights.ChangePermissions }; - // yield return new object[] { FileSystemRights.CreateDirectories }; // CreateDirectories == AppendData - yield return new object[] { FileSystemRights.CreateFiles }; - yield return new object[] { FileSystemRights.Delete }; - yield return new object[] { FileSystemRights.DeleteSubdirectoriesAndFiles }; - yield return new object[] { FileSystemRights.ExecuteFile }; - yield return new object[] { FileSystemRights.FullControl }; - // yield return new object[] { FileSystemRights.ListDirectory }; ListDirectory == ReadData - yield return new object[] { FileSystemRights.Modify }; - yield return new object[] { FileSystemRights.Read }; - yield return new object[] { FileSystemRights.ReadAndExecute }; - yield return new object[] { FileSystemRights.ReadAttributes }; - // yield return new object[] { FileSystemRights.ReadData }; // Minimum right required to delete a file or directory - yield return new object[] { FileSystemRights.ReadExtendedAttributes }; - yield return new object[] { FileSystemRights.ReadPermissions }; - yield return new object[] { FileSystemRights.Synchronize }; - yield return new object[] { FileSystemRights.TakeOwnership }; - // yield return new object[] { FileSystemRights.Traverse }; // Traverse == ExecuteFile - yield return new object[] { FileSystemRights.Write }; - yield return new object[] { FileSystemRights.WriteAttributes }; - // yield return new object[] { FileSystemRights.WriteData }; // WriteData == CreateFiles - yield return new object[] { FileSystemRights.WriteExtendedAttributes }; - } - - private void Verify_FileSecurity_CreateFile(FileSecurity expectedSecurity) - { - Verify_FileSecurity_CreateFile(FileMode.Create, FileSystemRights.WriteData, FileShare.Read, DefaultBufferSize, FileOptions.None, expectedSecurity); + public static IEnumerable RightsToDeny() => + from rights in new[] { + FileSystemRights.AppendData, // Same as CreateDirectories + FileSystemRights.ChangePermissions, + FileSystemRights.Delete, + FileSystemRights.DeleteSubdirectoriesAndFiles, + FileSystemRights.ExecuteFile, // Same as Traverse + FileSystemRights.ReadAttributes, + FileSystemRights.ReadExtendedAttributes, + FileSystemRights.ReadPermissions, + FileSystemRights.TakeOwnership, + FileSystemRights.Write, // Contains AppendData, WriteData, WriteAttributes, WriteExtendedAttributes + FileSystemRights.WriteAttributes, + FileSystemRights.WriteData, // Same as CreateFiles + FileSystemRights.WriteExtendedAttributes, + // Rights that should not be denied: + // - Synchronize: CreateFile always requires Synchronize access + // - ReadData: Minimum right required to delete a file or directory + // - ListDirectory: Equivalent to ReadData + // - Modify: Contains ReadData + // - Read: Contains ReadData + // - ReadAndExecute: Contains ReadData + // - FullControl: Contains ReadData and Synchronize + } + select new object[] { rights }; + + public static IEnumerable RightsToAllow() => + from rights in new[] { + FileSystemRights.AppendData, // Same as CreateDirectories + FileSystemRights.ChangePermissions, + FileSystemRights.Delete, + FileSystemRights.DeleteSubdirectoriesAndFiles, + FileSystemRights.ExecuteFile, // Same as Traverse + FileSystemRights.Modify, // Contains Read, Write and ReadAndExecute + FileSystemRights.Read, // Contains ReadData, ReadPermissions, ReadAttributes, ReadExtendedAttributes + FileSystemRights.ReadAndExecute, // Contains Read and ExecuteFile + FileSystemRights.ReadAttributes, + FileSystemRights.ReadData, // Minimum right required to delete a file or directory. Equivalent to ListDirectory + FileSystemRights.ReadExtendedAttributes, + FileSystemRights.ReadPermissions, + FileSystemRights.Synchronize, // CreateFile always requires Synchronize access + FileSystemRights.TakeOwnership, + FileSystemRights.Write, // Contains AppendData, WriteData, WriteAttributes, WriteExtendedAttributes + FileSystemRights.WriteAttributes, + FileSystemRights.WriteData, // Same as CreateFiles + FileSystemRights.WriteExtendedAttributes, + FileSystemRights.FullControl, // Contains Modify, DeleteSubdirectoriesAndFiles, Delete, ChangePermissions, TakeOwnership, Synchronize + } + select new object[] { rights }; + + private static readonly FileMode[] s_writableModes = new[] + { + FileMode.Append, + FileMode.Create, + FileMode.CreateNew, + FileMode.Truncate + // Excludes OpenOrCreate because it has a different behavior compared to Create/CreateNew + }; + + private static readonly FileSystemRights[] s_readableRights = new[] + { + // Excludes combined rights + FileSystemRights.ExecuteFile, + FileSystemRights.ReadAttributes, + FileSystemRights.ReadData, + FileSystemRights.ReadExtendedAttributes, + FileSystemRights.ReadPermissions + }; + + private static readonly FileSystemRights[] s_writableRights = new[] + { + // Excludes combined rights + FileSystemRights.AppendData, // Same as CreateDirectories + FileSystemRights.WriteAttributes, + FileSystemRights.WriteData, + FileSystemRights.WriteExtendedAttributes + }; + + private void FileInfo_Create_FileSecurity_ArgumentOutOfRangeException(string paramName, FileMode mode = FileMode.CreateNew, FileShare share = FileShare.None, int bufferSize = DefaultBufferSize) + { + var security = new FileSecurity(); + var info = new FileInfo(Guid.NewGuid().ToString()); + Assert.Throws(paramName, () => + info.Create(mode, FileSystemRights.FullControl, share, bufferSize, FileOptions.None, security)); + } + + private void FileInfo_Create_FileSecurity_ArgumentException(FileMode mode, FileSystemRights rights) + { + var security = new FileSecurity(); + var info = new FileInfo(Guid.NewGuid().ToString()); + Assert.Throws(() => + info.Create(mode, rights, FileShare.None, DefaultBufferSize, FileOptions.None, security)); + } + + private void FileInfo_Create_FileSecurity_Successful(FileMode mode, FileSystemRights rights) + { + var security = new FileSecurity(); + var info = new FileInfo(Guid.NewGuid().ToString()); + info.Create(mode, rights, FileShare.None, DefaultBufferSize, FileOptions.None, security).Dispose(); } private void Verify_FileSecurity_CreateFile(FileMode mode, FileSystemRights rights, FileShare share, int bufferSize, FileOptions options, FileSecurity expectedSecurity) { using var tempRootDir = new TempAclDirectory(); - string path = Path.Combine(tempRootDir.Path, "file.txt"); + string path = Path.Combine(tempRootDir.Path, Guid.NewGuid().ToString()); var fileInfo = new FileInfo(path); - fileInfo.Create(mode, rights, share, bufferSize, options, expectedSecurity).Dispose(); - Assert.True(fileInfo.Exists); - tempRootDir.CreatedSubfiles.Add(fileInfo); + using (FileStream fs = fileInfo.Create(mode, rights, share, bufferSize, options, expectedSecurity)) + { + Assert.True(fileInfo.Exists); + tempRootDir.CreatedSubfiles.Add(fileInfo); - var actualFileInfo = new FileInfo(path); - FileSecurity actualSecurity = actualFileInfo.GetAccessControl(AccessControlSections.Access); - VerifyAccessSecurity(expectedSecurity, actualSecurity); + var actualFileInfo = new FileInfo(path); + FileSecurity actualSecurity = actualFileInfo.GetAccessControl(); + + if (expectedSecurity != null) + { + VerifyAccessSecurity(expectedSecurity, actualSecurity); + } + else + { + int count = actualSecurity.GetAccessRules(includeExplicit: true, includeInherited: false, typeof(SecurityIdentifier)).Count; + Assert.Equal(0, count); + } + } } private void Verify_DirectorySecurity_CreateDirectory(DirectorySecurity expectedSecurity) { using var tempRootDir = new TempAclDirectory(); - string path = Path.Combine(tempRootDir.Path, "createMe"); + string path = Path.Combine(tempRootDir.Path, Guid.NewGuid().ToString()); DirectoryInfo dirInfo = expectedSecurity.CreateDirectory(path); Assert.True(dirInfo.Exists); tempRootDir.CreatedSubdirectories.Add(dirInfo); From a9c96461388aad0c47f8d49435893203ee60224a Mon Sep 17 00:00:00 2001 From: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com> Date: Mon, 24 Jan 2022 11:55:05 +0300 Subject: [PATCH 022/161] Tune FP CSEs live across a call better (#63903) The problem was that the comparison of a weighted refcount, which usually has the order of hundreds or tens, with a small digit like "4" was too weak and missed some cases where we were still trying to CSE cheaps floats across calls and ending up with lots of stack shuffling. Fix this by using different tuning parameters, namely the costs estimated for the uses and defs (increase them to account for the spills and reloads). --- src/coreclr/jit/optcse.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/coreclr/jit/optcse.cpp b/src/coreclr/jit/optcse.cpp index 805e5b7d2eb3f5..108fde7e984976 100644 --- a/src/coreclr/jit/optcse.cpp +++ b/src/coreclr/jit/optcse.cpp @@ -2599,17 +2599,18 @@ class CSE_Heuristic cse_use_cost *= slotCount; } - // If this CSE is live across a call then we may need to spill an additional caller save register + // If this CSE is live across a call then we may have additional costs // if (candidate->LiveAcrossCall()) { - if (candidate->Expr()->IsCnsFltOrDbl() && (CNT_CALLEE_SAVED_FLOAT == 0) && - (candidate->CseDsc()->csdUseWtCnt <= 4)) + // If we have a floating-point CSE that is both live across a call and there + // are no callee-saved FP registers available, the RA will have to spill at + // the def site and reload at the (first) use site, if the variable is a register + // candidate. Account for that. + if (varTypeIsFloating(candidate->Expr()) && (CNT_CALLEE_SAVED_FLOAT == 0) && !candidate->IsConservative()) { - // Floating point constants are expected to be contained, so unless there are more than 4 uses - // we better not to CSE them, especially on platforms without callee-saved registers - // for values living across calls - return false; + cse_def_cost += 1; + cse_use_cost += 1; } // If we don't have a lot of variables to enregister or we have a floating point type From bde7069e7e1a2eb05fe9cc838b4de0f982a72544 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 24 Jan 2022 10:08:44 +0100 Subject: [PATCH 023/161] [main] Update dependencies from dotnet/arcade dotnet/icu dotnet/xharness dotnet/emsdk (#64098) Co-authored-by: dotnet-maestro[bot] --- .config/dotnet-tools.json | 2 +- eng/Version.Details.xml | 96 +++++++------- eng/Versions.props | 40 +++--- eng/common/internal/NuGet.config | 7 + eng/common/templates/job/execute-sdl.yml | 13 +- eng/common/templates/job/onelocbuild.yml | 3 +- eng/common/templates/jobs/jobs.yml | 4 +- .../templates/post-build/common-variables.yml | 69 ---------- .../templates/post-build/post-build.yml | 74 +++++------ .../post-build/setup-maestro-vars.yml | 123 ++++++++---------- global.json | 8 +- 11 files changed, 175 insertions(+), 264 deletions(-) create mode 100644 eng/common/internal/NuGet.config diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 0e5219042b700d..26dc5ae6a75f47 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -15,7 +15,7 @@ ] }, "microsoft.dotnet.xharness.cli": { - "version": "1.0.0-prerelease.22067.1", + "version": "1.0.0-prerelease.22071.1", "commands": [ "xharness" ] diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index af284815b19ecb..ee709f74031a46 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,16 +1,16 @@ - + https://github.com/dotnet/icu - 4170ccfbbcada3e22aa4428a84524fabef006e38 + 8a4a45cc99e7d6e5244c16f581171633091b96b3 https://github.com/dotnet/msquic a7213b4676c1803bb251771291a525482d42e511 - + https://github.com/dotnet/emsdk - 4eb953d7051890da4f36167125c6b41e06d7f56d + aaa56a6622c4991cf65d553250af3c0ade1320bc https://github.com/dotnet/wcf @@ -50,77 +50,77 @@ - + https://github.com/dotnet/arcade - 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7 + e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 - + https://github.com/dotnet/arcade - 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7 + e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 - + https://github.com/dotnet/arcade - 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7 + e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 - + https://github.com/dotnet/arcade - 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7 + e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 - + https://github.com/dotnet/arcade - 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7 + e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 - + https://github.com/dotnet/arcade - 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7 + e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 - + https://github.com/dotnet/arcade - 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7 + e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 - + https://github.com/dotnet/arcade - 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7 + e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 - + https://github.com/dotnet/arcade - 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7 + e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 - + https://github.com/dotnet/arcade - 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7 + e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 - + https://github.com/dotnet/arcade - 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7 + e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 - + https://github.com/dotnet/arcade - 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7 + e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 - + https://github.com/dotnet/arcade - 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7 + e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 - + https://github.com/dotnet/arcade - 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7 + e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 - + https://github.com/dotnet/arcade - 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7 + e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 - + https://github.com/dotnet/arcade - 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7 + e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 - + https://github.com/dotnet/arcade - 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7 + e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 - + https://github.com/dotnet/arcade - 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7 + e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 https://github.com/microsoft/vstest @@ -238,21 +238,21 @@ https://github.com/dotnet/linker e485816b48273d03bd6266a64dad9bea97f861d5 - + https://github.com/dotnet/xharness - 3060cda4543b80824a9238bcd176bb1a5af72044 + bd2a12f9cc6c93c249f987b42c1c761550369674 - + https://github.com/dotnet/xharness - 3060cda4543b80824a9238bcd176bb1a5af72044 + bd2a12f9cc6c93c249f987b42c1c761550369674 - + https://github.com/dotnet/xharness - 3060cda4543b80824a9238bcd176bb1a5af72044 + bd2a12f9cc6c93c249f987b42c1c761550369674 - + https://github.com/dotnet/arcade - 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7 + e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 https://dev.azure.com/dnceng/internal/_git/dotnet-optimization diff --git a/eng/Versions.props b/eng/Versions.props index 04f7adea4cff9d..85e7bdd4cdc822 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -54,21 +54,21 @@ 2.0.0-alpha.1.21525.11 - 7.0.0-beta.22068.3 - 7.0.0-beta.22068.3 - 7.0.0-beta.22068.3 - 7.0.0-beta.22068.3 - 7.0.0-beta.22068.3 - 7.0.0-beta.22068.3 - 2.5.1-beta.22068.3 - 7.0.0-beta.22068.3 - 7.0.0-beta.22068.3 - 7.0.0-beta.22068.3 - 7.0.0-beta.22068.3 - 7.0.0-beta.22068.3 - 7.0.0-beta.22068.3 - 7.0.0-beta.22068.3 - 7.0.0-beta.22068.3 + 7.0.0-beta.22071.6 + 7.0.0-beta.22071.6 + 7.0.0-beta.22071.6 + 7.0.0-beta.22071.6 + 7.0.0-beta.22071.6 + 7.0.0-beta.22071.6 + 2.5.1-beta.22071.6 + 7.0.0-beta.22071.6 + 7.0.0-beta.22071.6 + 7.0.0-beta.22071.6 + 7.0.0-beta.22071.6 + 7.0.0-beta.22071.6 + 7.0.0-beta.22071.6 + 7.0.0-beta.22071.6 + 7.0.0-beta.22071.6 6.0.0-preview.1.102 @@ -160,9 +160,9 @@ 1.0.1-prerelease-00006 16.9.0-preview-20201201-01 - 1.0.0-prerelease.22067.1 - 1.0.0-prerelease.22067.1 - 1.0.0-prerelease.22067.1 + 1.0.0-prerelease.22071.1 + 1.0.0-prerelease.22071.1 + 1.0.0-prerelease.22071.1 1.0.2-alpha.0.22069.1 2.4.2-pre.22 0.12.0-pre.20 @@ -180,7 +180,7 @@ 7.0.100-1.22063.2 $(MicrosoftNETILLinkTasksVersion) - 7.0.0-alpha.1.22067.1 + 7.0.0-preview.2.22071.2 7.0.0-alpha.1.21529.3 @@ -193,7 +193,7 @@ 11.1.0-alpha.1.22067.2 11.1.0-alpha.1.22067.2 - 7.0.0-alpha.1.21601.1 + 7.0.0-alpha.2.22071.3 $(MicrosoftNETWorkloadEmscriptenManifest70100Version) 1.1.87-gba258badda diff --git a/eng/common/internal/NuGet.config b/eng/common/internal/NuGet.config new file mode 100644 index 00000000000000..769650362f4aa4 --- /dev/null +++ b/eng/common/internal/NuGet.config @@ -0,0 +1,7 @@ + + + + + + + diff --git a/eng/common/templates/job/execute-sdl.yml b/eng/common/templates/job/execute-sdl.yml index 8cf772b3cbf812..a4837c32c3869c 100644 --- a/eng/common/templates/job/execute-sdl.yml +++ b/eng/common/templates/job/execute-sdl.yml @@ -29,14 +29,6 @@ parameters: # Optional: download a list of pipeline artifacts. 'downloadArtifacts' controls build artifacts, # not pipeline artifacts, so doesn't affect the use of this parameter. pipelineArtifactNames: [] - # Optional: location and ID of the AzDO build that the build/pipeline artifacts should be - # downloaded from. By default, uses runtime expressions to decide based on the variables set by - # the 'setupMaestroVars' dependency. Overriding this parameter is necessary if SDL tasks are - # running without Maestro++/BAR involved, or to download artifacts from a specific existing build - # to iterate quickly on SDL changes. - AzDOProjectName: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ] - AzDOPipelineId: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ] - AzDOBuildId: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ] jobs: - job: Run_SDL @@ -55,11 +47,14 @@ jobs: - name: GuardianVersion value: ${{ coalesce(parameters.overrideGuardianVersion, '$(DefaultGuardianVersion)') }} pool: - vmImage: windows-2019 + name: NetCore1ESPool-Internal + demands: ImageOverride -equals Build.Server.Amd64.VS2019 steps: - checkout: self clean: true + - template: /eng/common/templates/post-build/setup-maestro-vars.yml + - ${{ if ne(parameters.downloadArtifacts, 'false')}}: - ${{ if ne(parameters.artifactNames, '') }}: - ${{ each artifactName in parameters.artifactNames }}: diff --git a/eng/common/templates/job/onelocbuild.yml b/eng/common/templates/job/onelocbuild.yml index c4fc18b3ee77aa..0b93fd5b490ebb 100644 --- a/eng/common/templates/job/onelocbuild.yml +++ b/eng/common/templates/job/onelocbuild.yml @@ -4,7 +4,8 @@ parameters: # Optional: A defined YAML pool - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#pool pool: - vmImage: 'windows-2019' + name: NetCore1ESPool-Internal + demands: ImageOverride -equals Build.Server.Amd64.VS2019 CeapexPat: $(dn-bot-ceapex-package-r) # PAT for the loc AzDO instance https://dev.azure.com/ceapex GithubPat: $(BotAccount-dotnet-bot-repo-PAT) diff --git a/eng/common/templates/jobs/jobs.yml b/eng/common/templates/jobs/jobs.yml index ff4ab75c886dc7..dafa603dc5d900 100644 --- a/eng/common/templates/jobs/jobs.yml +++ b/eng/common/templates/jobs/jobs.yml @@ -83,7 +83,9 @@ jobs: - ${{ if eq(parameters.enableSourceBuild, true) }}: - Source_Build_Complete pool: - vmImage: 'windows-2019' + name: NetCore1ESPool-Internal + demands: ImageOverride -equals Build.Server.Amd64.VS2019 + runAsPublic: ${{ parameters.runAsPublic }} publishUsingPipelines: ${{ parameters.enablePublishUsingPipelines }} enablePublishBuildArtifacts: ${{ parameters.enablePublishBuildArtifacts }} diff --git a/eng/common/templates/post-build/common-variables.yml b/eng/common/templates/post-build/common-variables.yml index c99fd7503767cd..c830e6f277606e 100644 --- a/eng/common/templates/post-build/common-variables.yml +++ b/eng/common/templates/post-build/common-variables.yml @@ -4,54 +4,6 @@ variables: - group: DotNet-DotNetCli-Storage - group: DotNet-MSRC-Storage - group: Publish-Build-Assets - - # .NET Core 3.1 Dev - - name: PublicDevRelease_31_Channel_Id - value: 128 - - # .NET 5 Dev - - name: Net_5_Dev_Channel_Id - value: 131 - - # .NET Eng - Validation - - name: Net_Eng_Validation_Channel_Id - value: 9 - - # .NET Eng - Latest - - name: Net_Eng_Latest_Channel_Id - value: 2 - - # .NET 3 Eng - Validation - - name: NET_3_Eng_Validation_Channel_Id - value: 390 - - # .NET 3 Eng - - name: NetCore_3_Tools_Channel_Id - value: 344 - - # .NET Core 3.0 Internal Servicing - - name: InternalServicing_30_Channel_Id - value: 184 - - # .NET Core 3.0 Release - - name: PublicRelease_30_Channel_Id - value: 19 - - # .NET Core 3.1 Release - - name: PublicRelease_31_Channel_Id - value: 129 - - # General Testing - - name: GeneralTesting_Channel_Id - value: 529 - - # .NET Core 3.1 Blazor Features - - name: NetCore_31_Blazor_Features_Channel_Id - value: 531 - - # .NET Core Experimental - - name: NetCore_Experimental_Channel_Id - value: 562 # Whether the build is internal or not - name: IsInternalBuild @@ -70,27 +22,6 @@ variables: - name: SymbolToolVersion value: 1.0.1 - # Feed Configurations - # These should include the suffix "/index.json" - - # Default locations for Installers and checksums - # Public Locations - - name: ChecksumsBlobFeedUrl - value: https://dotnetclichecksums.blob.core.windows.net/dotnet/index.json - - name: InstallersBlobFeedUrl - value: https://dotnetcli.blob.core.windows.net/dotnet/index.json - - # Private Locations - - name: InternalChecksumsBlobFeedUrl - value: https://dotnetclichecksumsmsrc.blob.core.windows.net/dotnet/index.json - - name: InternalChecksumsBlobFeedKey - value: $(dotnetclichecksumsmsrc-storage-key) - - - name: InternalInstallersBlobFeedUrl - value: https://dotnetclimsrc.blob.core.windows.net/dotnet/index.json - - name: InternalInstallersBlobFeedKey - value: $(dotnetclimsrc-access-key) - # Skip component governance and codesign validation for SDL. These jobs # create no content. - name: skipComponentGovernanceDetection diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index 8985b429c85437..9583d27dbbf89d 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -90,25 +90,19 @@ stages: variables: - template: common-variables.yml jobs: - - template: setup-maestro-vars.yml - parameters: - BARBuildId: ${{ parameters.BARBuildId }} - PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} - - job: displayName: NuGet Validation - dependsOn: setupMaestroVars condition: eq( ${{ parameters.enableNugetValidation }}, 'true') pool: - vmImage: 'windows-2019' - variables: - - name: AzDOProjectName - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ] - - name: AzDOPipelineId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ] - - name: AzDOBuildId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ] + name: NetCore1ESPool-Internal + demands: ImageOverride -equals Build.Server.Amd64.VS2019 + steps: + - template: setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + - task: DownloadBuildArtifacts@0 displayName: Download Package Artifacts inputs: @@ -129,19 +123,16 @@ stages: - job: displayName: Signing Validation - dependsOn: setupMaestroVars condition: and( eq( ${{ parameters.enableSigningValidation }}, 'true'), ne( variables['PostBuildSign'], 'true')) - variables: - - template: common-variables.yml - - name: AzDOProjectName - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ] - - name: AzDOPipelineId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ] - - name: AzDOBuildId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ] pool: - vmImage: 'windows-2019' + name: NetCore1ESPool-Internal + demands: ImageOverride -equals Build.Server.Amd64.VS2019 steps: + - template: setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + - task: DownloadBuildArtifacts@0 displayName: Download Package Artifacts inputs: @@ -186,19 +177,16 @@ stages: - job: displayName: SourceLink Validation - dependsOn: setupMaestroVars condition: eq( ${{ parameters.enableSourceLinkValidation }}, 'true') - variables: - - template: common-variables.yml - - name: AzDOProjectName - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ] - - name: AzDOPipelineId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ] - - name: AzDOBuildId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ] pool: - vmImage: 'windows-2019' + name: NetCore1ESPool-Internal + demands: ImageOverride -equals Build.Server.Amd64.VS2019 steps: + - template: setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + - task: DownloadBuildArtifacts@0 displayName: Download Blob Artifacts inputs: @@ -224,7 +212,6 @@ stages: - template: /eng/common/templates/job/execute-sdl.yml parameters: enable: ${{ parameters.SDLValidationParameters.enable }} - dependsOn: setupMaestroVars additionalParameters: ${{ parameters.SDLValidationParameters.params }} continueOnError: ${{ parameters.SDLValidationParameters.continueOnError }} artifactNames: ${{ parameters.SDLValidationParameters.artifactNames }} @@ -239,21 +226,18 @@ stages: variables: - template: common-variables.yml jobs: - - template: setup-maestro-vars.yml - parameters: - BARBuildId: ${{ parameters.BARBuildId }} - PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} - - job: displayName: Publish Using Darc - dependsOn: setupMaestroVars timeoutInMinutes: 120 - variables: - - name: BARBuildId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] pool: - vmImage: 'windows-2019' + name: NetCore1ESPool-Internal + demands: ImageOverride -equals Build.Server.Amd64.VS2019 steps: + - template: setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + - task: PowerShell@2 displayName: Publish Using Darc inputs: diff --git a/eng/common/templates/post-build/setup-maestro-vars.yml b/eng/common/templates/post-build/setup-maestro-vars.yml index 4a22b2e6f6de79..826d3ed5f74c20 100644 --- a/eng/common/templates/post-build/setup-maestro-vars.yml +++ b/eng/common/templates/post-build/setup-maestro-vars.yml @@ -2,77 +2,68 @@ parameters: BARBuildId: '' PromoteToChannelIds: '' -jobs: -- job: setupMaestroVars - displayName: Setup Maestro Vars - variables: - - template: common-variables.yml - pool: - vmImage: 'windows-2019' - steps: - - checkout: none - - - ${{ if eq(coalesce(parameters.PromoteToChannelIds, 0), 0) }}: - - task: DownloadBuildArtifacts@0 - displayName: Download Release Configs - inputs: - buildType: current - artifactName: ReleaseConfigs - checkDownloadedFiles: true - - - task: PowerShell@2 - name: setReleaseVars - displayName: Set Release Configs Vars +steps: + - ${{ if eq(coalesce(parameters.PromoteToChannelIds, 0), 0) }}: + - task: DownloadBuildArtifacts@0 + displayName: Download Release Configs inputs: - targetType: inline - script: | - try { - if (!$Env:PromoteToMaestroChannels -or $Env:PromoteToMaestroChannels.Trim() -eq '') { - $Content = Get-Content $(Build.StagingDirectory)/ReleaseConfigs/ReleaseConfigs.txt + buildType: current + artifactName: ReleaseConfigs + checkDownloadedFiles: true - $BarId = $Content | Select -Index 0 - $Channels = $Content | Select -Index 1 - $IsStableBuild = $Content | Select -Index 2 + - task: PowerShell@2 + name: setReleaseVars + displayName: Set Release Configs Vars + inputs: + targetType: inline + script: | + try { + if (!$Env:PromoteToMaestroChannels -or $Env:PromoteToMaestroChannels.Trim() -eq '') { + $Content = Get-Content $(Build.StagingDirectory)/ReleaseConfigs/ReleaseConfigs.txt - $AzureDevOpsProject = $Env:System_TeamProject - $AzureDevOpsBuildDefinitionId = $Env:System_DefinitionId - $AzureDevOpsBuildId = $Env:Build_BuildId - } - else { - $buildApiEndpoint = "${Env:MaestroApiEndPoint}/api/builds/${Env:BARBuildId}?api-version=${Env:MaestroApiVersion}" + $BarId = $Content | Select -Index 0 + $Channels = $Content | Select -Index 1 + $IsStableBuild = $Content | Select -Index 2 - $apiHeaders = New-Object 'System.Collections.Generic.Dictionary[[String],[String]]' - $apiHeaders.Add('Accept', 'application/json') - $apiHeaders.Add('Authorization',"Bearer ${Env:MAESTRO_API_TOKEN}") - - $buildInfo = try { Invoke-WebRequest -Method Get -Uri $buildApiEndpoint -Headers $apiHeaders | ConvertFrom-Json } catch { Write-Host "Error: $_" } - - $BarId = $Env:BARBuildId - $Channels = $Env:PromoteToMaestroChannels -split "," - $Channels = $Channels -join "][" - $Channels = "[$Channels]" + $AzureDevOpsProject = $Env:System_TeamProject + $AzureDevOpsBuildDefinitionId = $Env:System_DefinitionId + $AzureDevOpsBuildId = $Env:Build_BuildId + } + else { + $buildApiEndpoint = "${Env:MaestroApiEndPoint}/api/builds/${Env:BARBuildId}?api-version=${Env:MaestroApiVersion}" - $IsStableBuild = $buildInfo.stable - $AzureDevOpsProject = $buildInfo.azureDevOpsProject - $AzureDevOpsBuildDefinitionId = $buildInfo.azureDevOpsBuildDefinitionId - $AzureDevOpsBuildId = $buildInfo.azureDevOpsBuildId - } + $apiHeaders = New-Object 'System.Collections.Generic.Dictionary[[String],[String]]' + $apiHeaders.Add('Accept', 'application/json') + $apiHeaders.Add('Authorization',"Bearer ${Env:MAESTRO_API_TOKEN}") - Write-Host "##vso[task.setvariable variable=BARBuildId;isOutput=true]$BarId" - Write-Host "##vso[task.setvariable variable=TargetChannels;isOutput=true]$Channels" - Write-Host "##vso[task.setvariable variable=IsStableBuild;isOutput=true]$IsStableBuild" + $buildInfo = try { Invoke-WebRequest -Method Get -Uri $buildApiEndpoint -Headers $apiHeaders | ConvertFrom-Json } catch { Write-Host "Error: $_" } + + $BarId = $Env:BARBuildId + $Channels = $Env:PromoteToMaestroChannels -split "," + $Channels = $Channels -join "][" + $Channels = "[$Channels]" - Write-Host "##vso[task.setvariable variable=AzDOProjectName;isOutput=true]$AzureDevOpsProject" - Write-Host "##vso[task.setvariable variable=AzDOPipelineId;isOutput=true]$AzureDevOpsBuildDefinitionId" - Write-Host "##vso[task.setvariable variable=AzDOBuildId;isOutput=true]$AzureDevOpsBuildId" + $IsStableBuild = $buildInfo.stable + $AzureDevOpsProject = $buildInfo.azureDevOpsProject + $AzureDevOpsBuildDefinitionId = $buildInfo.azureDevOpsBuildDefinitionId + $AzureDevOpsBuildId = $buildInfo.azureDevOpsBuildId } - catch { - Write-Host $_ - Write-Host $_.Exception - Write-Host $_.ScriptStackTrace - exit 1 - } - env: - MAESTRO_API_TOKEN: $(MaestroApiAccessToken) - BARBuildId: ${{ parameters.BARBuildId }} - PromoteToMaestroChannels: ${{ parameters.PromoteToChannelIds }} + + Write-Host "##vso[task.setvariable variable=BARBuildId]$BarId" + Write-Host "##vso[task.setvariable variable=TargetChannels]$Channels" + Write-Host "##vso[task.setvariable variable=IsStableBuild]$IsStableBuild" + + Write-Host "##vso[task.setvariable variable=AzDOProjectName]$AzureDevOpsProject" + Write-Host "##vso[task.setvariable variable=AzDOPipelineId]$AzureDevOpsBuildDefinitionId" + Write-Host "##vso[task.setvariable variable=AzDOBuildId]$AzureDevOpsBuildId" + } + catch { + Write-Host $_ + Write-Host $_.Exception + Write-Host $_.ScriptStackTrace + exit 1 + } + env: + MAESTRO_API_TOKEN: $(MaestroApiAccessToken) + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToMaestroChannels: ${{ parameters.PromoteToChannelIds }} diff --git a/global.json b/global.json index 6e753c749b04a4..e0d86ef423d93f 100644 --- a/global.json +++ b/global.json @@ -12,10 +12,10 @@ "python3": "3.7.1" }, "msbuild-sdks": { - "Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk": "7.0.0-beta.22068.3", - "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22068.3", - "Microsoft.DotNet.Helix.Sdk": "7.0.0-beta.22068.3", - "Microsoft.DotNet.SharedFramework.Sdk": "7.0.0-beta.22068.3", + "Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk": "7.0.0-beta.22071.6", + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22071.6", + "Microsoft.DotNet.Helix.Sdk": "7.0.0-beta.22071.6", + "Microsoft.DotNet.SharedFramework.Sdk": "7.0.0-beta.22071.6", "Microsoft.Build.NoTargets": "3.1.0", "Microsoft.Build.Traversal": "3.0.23", "Microsoft.NET.Sdk.IL": "7.0.0-alpha.1.22066.4" From 7435abedcdf4c82a32e2afbafdd05bbc8f11d8ef Mon Sep 17 00:00:00 2001 From: Eaton Zveare Date: Mon, 24 Jan 2022 04:14:20 -0500 Subject: [PATCH 024/161] Update zip extraction to never throw any exceptions when the LastWriteTime update fails (#63912) --- .../IO/Compression/ZipFileExtensions.ZipArchiveEntry.Extract.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.IO.Compression.ZipFile/src/System/IO/Compression/ZipFileExtensions.ZipArchiveEntry.Extract.cs b/src/libraries/System.IO.Compression.ZipFile/src/System/IO/Compression/ZipFileExtensions.ZipArchiveEntry.Extract.cs index 5d800c1f62ca71..fe725937441e24 100644 --- a/src/libraries/System.IO.Compression.ZipFile/src/System/IO/Compression/ZipFileExtensions.ZipArchiveEntry.Extract.cs +++ b/src/libraries/System.IO.Compression.ZipFile/src/System/IO/Compression/ZipFileExtensions.ZipArchiveEntry.Extract.cs @@ -83,7 +83,7 @@ public static void ExtractToFile(this ZipArchiveEntry source, string destination { File.SetLastWriteTime(destinationFileName, source.LastWriteTime.DateTime); } - catch (UnauthorizedAccessException) + catch { // some OSes like Android (#35374) might not support setting the last write time, the extraction should not fail because of that } From 11991bb444daaad255aa0a898a10e9c7b552dbc6 Mon Sep 17 00:00:00 2001 From: Eirik Tsarpalis Date: Mon, 24 Jan 2022 09:58:24 +0000 Subject: [PATCH 025/161] Use kebab-case in FB automation labels (#64048) --- .github/fabricbot.json | 130 ++++++++++++++++++++--------------------- 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/.github/fabricbot.json b/.github/fabricbot.json index 723e3f5c493f2f..4679bc697e3756 100644 --- a/.github/fabricbot.json +++ b/.github/fabricbot.json @@ -996,7 +996,7 @@ "subCapability": "IssueCommentResponder", "version": "1.0", "config": { - "taskName": "Replace `needs-author-action` label with `needs further triage` label when the author comments on an issue", + "taskName": "Replace `needs-author-action` label with `needs-further-triage` label when the author comments on an issue", "conditions": { "operator": "and", "operands": [ @@ -1030,7 +1030,7 @@ { "name": "addLabel", "parameters": { - "label": "needs further triage" + "label": "needs-further-triage" } }, { @@ -1052,7 +1052,7 @@ "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { - "taskName": "Remove `no recent activity` label from issues when issue is modified", + "taskName": "Remove `no-recent-activity` label from issues when issue is modified", "conditions": { "operator": "and", "operands": [ @@ -1070,7 +1070,7 @@ { "name": "hasLabel", "parameters": { - "label": "no recent activity" + "label": "no-recent-activity" } }, { @@ -1079,7 +1079,7 @@ { "name": "labelAdded", "parameters": { - "label": "no recent activity" + "label": "no-recent-activity" } } ] @@ -1090,7 +1090,7 @@ { "name": "removeLabel", "parameters": { - "label": "no recent activity" + "label": "no-recent-activity" } } ], @@ -1107,14 +1107,14 @@ "subCapability": "IssueCommentResponder", "version": "1.0", "config": { - "taskName": "Remove `no recent activity` label when an issue is commented on", + "taskName": "Remove `no-recent-activity` label when an issue is commented on", "conditions": { "operator": "and", "operands": [ { "name": "hasLabel", "parameters": { - "label": "no recent activity" + "label": "no-recent-activity" } } ] @@ -1123,7 +1123,7 @@ { "name": "removeLabel", "parameters": { - "label": "no recent activity" + "label": "no-recent-activity" } } ], @@ -1149,7 +1149,7 @@ { "name": "hasLabel", "parameters": { - "label": "no recent activity" + "label": "no-recent-activity" } }, { @@ -1158,7 +1158,7 @@ { "name": "labelAdded", "parameters": { - "label": "no recent activity" + "label": "no-recent-activity" } } ] @@ -1171,12 +1171,12 @@ "issues", "project_card" ], - "taskName": "Remove `no recent activity` label from PRs when modified", + "taskName": "Remove `no-recent-activity` label from PRs when modified", "actions": [ { "name": "removeLabel", "parameters": { - "label": "no recent activity" + "label": "no-recent-activity" } } ] @@ -1194,7 +1194,7 @@ { "name": "hasLabel", "parameters": { - "label": "no recent activity" + "label": "no-recent-activity" } }, { @@ -1207,12 +1207,12 @@ "eventNames": [ "issue_comment" ], - "taskName": "Remove `no recent activity` label from PRs when commented on", + "taskName": "Remove `no-recent-activity` label from PRs when commented on", "actions": [ { "name": "removeLabel", "parameters": { - "label": "no recent activity" + "label": "no-recent-activity" } } ] @@ -1230,7 +1230,7 @@ { "name": "hasLabel", "parameters": { - "label": "no recent activity" + "label": "no-recent-activity" } }, { @@ -1243,12 +1243,12 @@ "eventNames": [ "pull_request_review" ], - "taskName": "Remove `no recent activity` label from PRs when new review is added", + "taskName": "Remove `no-recent-activity` label from PRs when new review is added", "actions": [ { "name": "removeLabel", "parameters": { - "label": "no recent activity" + "label": "no-recent-activity" } } ] @@ -1345,7 +1345,7 @@ { "name": "hasLabel", "parameters": { - "label": "no recent activity" + "label": "no-recent-activity" } }, { @@ -1359,7 +1359,7 @@ { "name": "addReply", "parameters": { - "comment": "This issue will now be closed since it had been marked `no recent activity` but received no further activity in the past 14 days. It is still possible to reopen or comment on the issue, but please note that the issue will be locked if it remains inactive for another 30 days." + "comment": "This issue will now be closed since it had been marked `no-recent-activity` but received no further activity in the past 14 days. It is still possible to reopen or comment on the issue, but please note that the issue will be locked if it remains inactive for another 30 days." } }, { @@ -1375,7 +1375,7 @@ "subCapability": "ScheduledSearch", "version": "1.1", "config": { - "taskName": "Close PRs with no recent activity", + "taskName": "Close PRs with no-recent-activity", "frequency": [ { "weekDay": 0, @@ -1460,7 +1460,7 @@ { "name": "hasLabel", "parameters": { - "label": "no recent activity" + "label": "no-recent-activity" } }, { @@ -1474,7 +1474,7 @@ { "name": "addReply", "parameters": { - "comment": "This pull request will now be closed since it had been marked `no recent activity` but received no further activity in the past 14 days. It is still possible to reopen or comment on the pull request, but please note that it will be locked if it remains inactive for another 30 days." + "comment": "This pull request will now be closed since it had been marked `no-recent-activity` but received no further activity in the past 14 days. It is still possible to reopen or comment on the pull request, but please note that it will be locked if it remains inactive for another 30 days." } }, { @@ -1490,7 +1490,7 @@ "subCapability": "ScheduledSearch", "version": "1.1", "config": { - "taskName": "Add no recent activity label to issues", + "taskName": "Add no-recent-activity label to issues", "frequency": [ { "weekDay": 0, @@ -1587,7 +1587,7 @@ { "name": "noLabel", "parameters": { - "label": "no recent activity" + "label": "no-recent-activity" } } ], @@ -1595,13 +1595,13 @@ { "name": "addLabel", "parameters": { - "label": "no recent activity" + "label": "no-recent-activity" } }, { "name": "addReply", "parameters": { - "comment": "This issue has been automatically marked `no recent activity` because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will remove `no recent activity`." + "comment": "This issue has been automatically marked `no-recent-activity` because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will remove `no-recent-activity`." } } ] @@ -1614,7 +1614,7 @@ "subCapability": "ScheduledSearch", "version": "1.1", "config": { - "taskName": "Add no recent activity label to PRs", + "taskName": "Add no-recent-activity label to PRs", "frequency": [ { "weekDay": 0, @@ -1711,7 +1711,7 @@ { "name": "noLabel", "parameters": { - "label": "no recent activity" + "label": "no-recent-activity" } } ], @@ -1719,13 +1719,13 @@ { "name": "addLabel", "parameters": { - "label": "no recent activity" + "label": "no-recent-activity" } }, { "name": "addReply", "parameters": { - "comment": "This pull request has been automatically marked `no recent activity` because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will remove `no recent activity`." + "comment": "This pull request has been automatically marked `no-recent-activity` because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will remove `no-recent-activity`." } } ] @@ -1742,7 +1742,7 @@ "inPrLabelText": "Status: In PR", "fixedLabelText": "Status: Fixed", "fixedLabelEnabled": false, - "label_inPr": "in pr" + "label_inPr": "in-pr" } }, { @@ -2239,7 +2239,7 @@ { "name": "hasLabel", "parameters": { - "label": "needs further triage" + "label": "needs-further-triage" } } ] @@ -2267,7 +2267,7 @@ { "name": "hasLabel", "parameters": { - "label": "needs further triage" + "label": "needs-further-triage" } } ] @@ -2280,7 +2280,7 @@ { "name": "labelRemoved", "parameters": { - "label": "needs further triage" + "label": "needs-further-triage" } }, { @@ -2502,7 +2502,7 @@ { "name": "hasLabel", "parameters": { - "label": "needs further triage" + "label": "needs-further-triage" } } ] @@ -2524,7 +2524,7 @@ { "name": "hasLabel", "parameters": { - "label": "needs further triage" + "label": "needs-further-triage" } } ] @@ -2543,7 +2543,7 @@ { "name": "labelRemoved", "parameters": { - "label": "needs further triage" + "label": "needs-further-triage" } }, { @@ -2625,7 +2625,7 @@ { "name": "labelAdded", "parameters": { - "label": "needs further triage" + "label": "needs-further-triage" } }, { @@ -2928,7 +2928,7 @@ { "name": "addLabel", "parameters": { - "label": "needs further triage" + "label": "needs-further-triage" } } ] @@ -3006,7 +3006,7 @@ { "name": "addLabel", "parameters": { - "label": "needs further triage" + "label": "needs-further-triage" } } ] @@ -3130,7 +3130,7 @@ { "name": "hasLabel", "parameters": { - "label": "needs further triage" + "label": "needs-further-triage" } } ] @@ -3152,7 +3152,7 @@ { "name": "hasLabel", "parameters": { - "label": "needs further triage" + "label": "needs-further-triage" } } ] @@ -3171,7 +3171,7 @@ { "name": "labelRemoved", "parameters": { - "label": "needs further triage" + "label": "needs-further-triage" } }, { @@ -3258,7 +3258,7 @@ { "name": "hasLabel", "parameters": { - "label": "needs further triage" + "label": "needs-further-triage" } } ] @@ -3280,7 +3280,7 @@ { "name": "hasLabel", "parameters": { - "label": "needs further triage" + "label": "needs-further-triage" } } ] @@ -3299,7 +3299,7 @@ { "name": "labelRemoved", "parameters": { - "label": "needs further triage" + "label": "needs-further-triage" } }, { @@ -3369,7 +3369,7 @@ { "name": "labelRemoved", "parameters": { - "label": "needs further triage" + "label": "needs-further-triage" } }, { @@ -3398,7 +3398,7 @@ { "name": "hasLabel", "parameters": { - "label": "needs further triage" + "label": "needs-further-triage" } } ] @@ -3837,7 +3837,7 @@ { "name": "labelAdded", "parameters": { - "label": "needs further triage" + "label": "needs-further-triage" } }, { @@ -3989,7 +3989,7 @@ { "name": "hasLabel", "parameters": { - "label": "needs further triage" + "label": "needs-further-triage" } } ] @@ -4018,7 +4018,7 @@ { "name": "hasLabel", "parameters": { - "label": "needs further triage" + "label": "needs-further-triage" } } ] @@ -4029,7 +4029,7 @@ { "name": "labelRemoved", "parameters": { - "label": "needs further triage" + "label": "needs-further-triage" } }, { @@ -4210,7 +4210,7 @@ { "name": "labelAdded", "parameters": { - "label": "needs further triage" + "label": "needs-further-triage" } }, { @@ -4317,7 +4317,7 @@ { "name": "hasLabel", "parameters": { - "label": "needs further triage" + "label": "needs-further-triage" } } ] @@ -4350,7 +4350,7 @@ { "name": "hasLabel", "parameters": { - "label": "needs further triage" + "label": "needs-further-triage" } } ] @@ -4369,7 +4369,7 @@ { "name": "labelRemoved", "parameters": { - "label": "needs further triage" + "label": "needs-further-triage" } }, { @@ -5159,7 +5159,7 @@ { "name": "hasLabel", "parameters": { - "label": "needs further triage" + "label": "needs-further-triage" } } ] @@ -5187,7 +5187,7 @@ { "name": "hasLabel", "parameters": { - "label": "needs further triage" + "label": "needs-further-triage" } } ] @@ -5215,7 +5215,7 @@ { "name": "hasLabel", "parameters": { - "label": "needs further triage" + "label": "needs-further-triage" } } ] @@ -5287,7 +5287,7 @@ { "name": "hasLabel", "parameters": { - "label": "needs further triage" + "label": "needs-further-triage" } } ] @@ -5315,7 +5315,7 @@ { "name": "hasLabel", "parameters": { - "label": "needs further triage" + "label": "needs-further-triage" } } ] @@ -5328,7 +5328,7 @@ { "name": "labelRemoved", "parameters": { - "label": "needs further triage" + "label": "needs-further-triage" } }, { @@ -5383,7 +5383,7 @@ { "name": "labelAdded", "parameters": { - "label": "no recent activity" + "label": "no-recent-activity" } } ] From 42c29676a715c7bf7e61411c7e9e3746626cc7a5 Mon Sep 17 00:00:00 2001 From: Eirik Tsarpalis Date: Mon, 24 Jan 2022 10:23:01 +0000 Subject: [PATCH 026/161] Onboard new Triage & PR Boards (#64198) --- .github/fabricbot.json | 1452 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1452 insertions(+) diff --git a/.github/fabricbot.json b/.github/fabricbot.json index 4679bc697e3756..030256bef724d4 100644 --- a/.github/fabricbot.json +++ b/.github/fabricbot.json @@ -8524,5 +8524,1457 @@ } ] } + }, + { + "taskType": "trigger", + "capabilityId": "IssueResponder", + "subCapability": "IssuesOnlyResponder", + "version": "1.0", + "config": { + "conditions": { + "operator": "and", + "operands": [ + { + "operator": "or", + "operands": [ + { + "operator": "and", + "operands": [ + { + "operator": "or", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-Infrastructure-libraries" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-Microsoft.Win32" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Diagnostics.EventLog" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Diagnostics.PerformanceCounter" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Diagnostics.TraceSource" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Drawing" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Management" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.ServiceProcess" + } + } + ] + }, + { + "operator": "or", + "operands": [ + { + "name": "isAction", + "parameters": { + "action": "reopened" + } + }, + { + "operator": "not", + "operands": [ + { + "name": "isInMilestone", + "parameters": {} + } + ] + } + ] + } + ] + }, + { + "operator": "or", + "operands": [ + { + "name": "labelAdded", + "parameters": { + "label": "area-Infrastructure-libraries" + } + }, + { + "name": "labelAdded", + "parameters": { + "label": "area-Microsoft.Win32" + } + }, + { + "name": "labelAdded", + "parameters": { + "label": "area-System.Diagnostics.EventLog" + } + }, + { + "name": "labelAdded", + "parameters": { + "label": "area-System.Diagnostics.PerformanceCounter" + } + }, + { + "name": "labelAdded", + "parameters": { + "label": "area-System.Diagnostics.TraceSource" + } + }, + { + "name": "labelAdded", + "parameters": { + "label": "area-System.Drawing" + } + }, + { + "name": "labelAdded", + "parameters": { + "label": "area-System.Management" + } + }, + { + "name": "labelAdded", + "parameters": { + "label": "area-System.ServiceProcess" + } + } + ] + } + ] + }, + { + "name": "isOpen", + "parameters": {} + }, + { + "operator": "or", + "operands": [ + { + "operator": "not", + "operands": [ + { + "name": "isInProject", + "parameters": { + "projectName": "Area Pod: Carlos / Santi - Issue Triage", + "isOrgProject": true + } + } + ] + }, + { + "name": "isInProjectColumn", + "parameters": { + "projectName": "Area Pod: Carlos / Santi - Issue Triage", + "isOrgProject": true, + "columnName": "Triaged" + } + } + ] + } + ] + }, + "eventType": "issue", + "eventNames": [ + "issues", + "project_card" + ], + "taskName": "[Area Pod: Carlos / Santi - Issue Triage] Add new issue to Board", + "actions": [ + { + "name": "addToProject", + "parameters": { + "projectName": "Area Pod: Carlos / Santi - Issue Triage", + "columnName": "Needs Triage", + "isOrgProject": true + } + } + ] + } + }, + { + "taskType": "trigger", + "capabilityId": "IssueResponder", + "subCapability": "IssueCommentResponder", + "version": "1.0", + "config": { + "conditions": { + "operator": "and", + "operands": [ + { + "operator": "or", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-Infrastructure-libraries" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-Microsoft.Win32" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Diagnostics.EventLog" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Diagnostics.PerformanceCounter" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Diagnostics.TraceSource" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Drawing" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Management" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.ServiceProcess" + } + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "isCloseAndComment", + "parameters": {} + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "activitySenderHasPermissions", + "parameters": { + "permissions": "write" + } + } + ] + }, + { + "operator": "or", + "operands": [ + { + "operator": "not", + "operands": [ + { + "name": "isInProject", + "parameters": { + "projectName": "Area Pod: Carlos / Santi - Issue Triage", + "isOrgProject": true + } + } + ] + }, + { + "name": "isInProjectColumn", + "parameters": { + "projectName": "Area Pod: Carlos / Santi - Issue Triage", + "columnName": "Triaged", + "isOrgProject": true + } + } + ] + } + ] + }, + "eventType": "issue", + "eventNames": [ + "issue_comment" + ], + "taskName": "[Area Pod: Carlos / Santi - Issue Triage] Needs Further Triage", + "actions": [ + { + "name": "addToProject", + "parameters": { + "projectName": "Area Pod: Carlos / Santi - Issue Triage", + "columnName": "Needs Triage", + "isOrgProject": true + } + } + ] + } + }, + { + "taskType": "trigger", + "capabilityId": "IssueResponder", + "subCapability": "IssuesOnlyResponder", + "version": "1.0", + "config": { + "conditions": { + "operator": "and", + "operands": [ + { + "name": "isInProjectColumn", + "parameters": { + "projectName": "Area Pod: Carlos / Santi - Issue Triage", + "columnName": "Needs Triage", + "isOrgProject": true + } + }, + { + "operator": "and", + "operands": [ + { + "operator": "not", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-Infrastructure-libraries" + } + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-Microsoft.Win32" + } + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Diagnostics.EventLog" + } + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Diagnostics.PerformanceCounter" + } + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Diagnostics.TraceSource" + } + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Drawing" + } + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Management" + } + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-System.ServiceProcess" + } + } + ] + } + ] + } + ] + }, + "eventType": "issue", + "eventNames": [ + "issues", + "project_card" + ], + "taskName": "[Area Pod: Carlos / Santi - Issue Triage] Remove relabeled issues", + "actions": [ + { + "name": "removeFromProject", + "parameters": { + "projectName": "Area Pod: Carlos / Santi - Issue Triage", + "isOrgProject": true + } + } + ] + } + }, + { + "taskType": "trigger", + "capabilityId": "IssueResponder", + "subCapability": "IssuesOnlyResponder", + "version": "1.0", + "config": { + "conditions": { + "operator": "and", + "operands": [ + { + "name": "isInProject", + "parameters": { + "projectName": "Area Pod: Carlos / Santi - Issue Triage", + "isOrgProject": true + } + }, + { + "operator": "not", + "operands": [ + { + "name": "isInProjectColumn", + "parameters": { + "projectName": "Area Pod: Carlos / Santi - Issue Triage", + "columnName": "Triaged" + } + } + ] + }, + { + "operator": "or", + "operands": [ + { + "name": "addedToMilestone", + "parameters": {} + }, + { + "name": "labelAdded", + "parameters": { + "label": "needs-author-action" + } + }, + { + "name": "labelAdded", + "parameters": { + "label": "api-ready-for-review" + } + }, + { + "name": "isAction", + "parameters": { + "action": "closed" + } + } + ] + } + ] + }, + "eventType": "issue", + "eventNames": [ + "issues", + "project_card" + ], + "taskName": "[Area Pod: Carlos / Santi - Issue Triage] Move to Triaged Column", + "actions": [ + { + "name": "addToProject", + "parameters": { + "projectName": "Area Pod: Carlos / Santi - Issue Triage", + "columnName": "Triaged", + "isOrgProject": true + } + } + ] + } + }, + { + "taskType": "trigger", + "capabilityId": "IssueResponder", + "subCapability": "PullRequestResponder", + "version": "1.0", + "config": { + "conditions": { + "operator": "and", + "operands": [ + { + "operator": "or", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-Infrastructure-libraries" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-Microsoft.Win32" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Diagnostics.EventLog" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Diagnostics.PerformanceCounter" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Diagnostics.TraceSource" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Drawing" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Management" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.ServiceProcess" + } + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "isInProject", + "parameters": { + "projectName": "Area Pod: Carlos / Santi - PRs", + "isOrgProject": true + } + } + ] + } + ] + }, + "eventType": "pull_request", + "eventNames": [ + "pull_request", + "issues", + "project_card" + ], + "taskName": "[Area Pod: Carlos / Santi - PRs] Add new PR to Board", + "actions": [ + { + "name": "addToProject", + "parameters": { + "projectName": "Area Pod: Carlos / Santi - PRs", + "columnName": "Needs Champion", + "isOrgProject": true + } + } + ] + } + }, + { + "taskType": "trigger", + "capabilityId": "IssueResponder", + "subCapability": "PullRequestResponder", + "version": "1.0", + "config": { + "conditions": { + "operator": "and", + "operands": [ + { + "name": "isInProjectColumn", + "parameters": { + "projectName": "Area Pod: Carlos / Santi - PRs", + "columnName": "Needs Champion", + "isOrgProject": true + } + }, + { + "operator": "and", + "operands": [ + { + "operator": "not", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-Infrastructure-libraries" + } + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-Microsoft.Win32" + } + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Diagnostics.EventLog" + } + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Diagnostics.PerformanceCounter" + } + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Diagnostics.TraceSource" + } + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Drawing" + } + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Management" + } + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-System.ServiceProcess" + } + } + ] + } + ] + } + ] + }, + "eventType": "pull_request", + "eventNames": [ + "pull_request", + "issues", + "project_card" + ], + "taskName": "[Area Pod: Carlos / Santi - PRs] Remove relabeled PRs", + "actions": [ + { + "name": "removeFromProject", + "parameters": { + "projectName": "Area Pod: Carlos / Santi - PRs", + "isOrgProject": true + } + } + ] + } + }, + { + "taskType": "trigger", + "capabilityId": "IssueResponder", + "subCapability": "IssuesOnlyResponder", + "version": "1.0", + "config": { + "conditions": { + "operator": "and", + "operands": [ + { + "operator": "or", + "operands": [ + { + "operator": "and", + "operands": [ + { + "operator": "or", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-Extensions-FileSystem" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Console" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Diagnostics.Process" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.IO" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.IO.Compression" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Linq.Parallel" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Memory" + } + } + ] + }, + { + "operator": "or", + "operands": [ + { + "name": "isAction", + "parameters": { + "action": "reopened" + } + }, + { + "operator": "not", + "operands": [ + { + "name": "isInMilestone", + "parameters": {} + } + ] + } + ] + } + ] + }, + { + "operator": "or", + "operands": [ + { + "name": "labelAdded", + "parameters": { + "label": "area-Extensions-FileSystem" + } + }, + { + "name": "labelAdded", + "parameters": { + "label": "area-System.Console" + } + }, + { + "name": "labelAdded", + "parameters": { + "label": "area-System.Diagnostics.Process" + } + }, + { + "name": "labelAdded", + "parameters": { + "label": "area-System.IO" + } + }, + { + "name": "labelAdded", + "parameters": { + "label": "area-System.IO.Compression" + } + }, + { + "name": "labelAdded", + "parameters": { + "label": "area-System.Linq.Parallel" + } + }, + { + "name": "labelAdded", + "parameters": { + "label": "area-System.Memory" + } + } + ] + } + ] + }, + { + "name": "isOpen", + "parameters": {} + }, + { + "operator": "or", + "operands": [ + { + "operator": "not", + "operands": [ + { + "name": "isInProject", + "parameters": { + "projectName": "Area Pod: Adam / David - Issue Triage", + "isOrgProject": true + } + } + ] + }, + { + "name": "isInProjectColumn", + "parameters": { + "projectName": "Area Pod: Adam / David - Issue Triage", + "isOrgProject": true, + "columnName": "Triaged" + } + } + ] + } + ] + }, + "eventType": "issue", + "eventNames": [ + "issues", + "project_card" + ], + "taskName": "[Area Pod: Adam / David - Issue Triage] Add new issue to Board", + "actions": [ + { + "name": "addToProject", + "parameters": { + "projectName": "Area Pod: Adam / David - Issue Triage", + "columnName": "Needs Triage", + "isOrgProject": true + } + } + ] + } + }, + { + "taskType": "trigger", + "capabilityId": "IssueResponder", + "subCapability": "IssueCommentResponder", + "version": "1.0", + "config": { + "conditions": { + "operator": "and", + "operands": [ + { + "operator": "or", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-Extensions-FileSystem" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Console" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Diagnostics.Process" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.IO" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.IO.Compression" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Linq.Parallel" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Memory" + } + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "isCloseAndComment", + "parameters": {} + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "activitySenderHasPermissions", + "parameters": { + "permissions": "write" + } + } + ] + }, + { + "operator": "or", + "operands": [ + { + "operator": "not", + "operands": [ + { + "name": "isInProject", + "parameters": { + "projectName": "Area Pod: Adam / David - Issue Triage", + "isOrgProject": true + } + } + ] + }, + { + "name": "isInProjectColumn", + "parameters": { + "projectName": "Area Pod: Adam / David - Issue Triage", + "columnName": "Triaged", + "isOrgProject": true + } + } + ] + } + ] + }, + "eventType": "issue", + "eventNames": [ + "issue_comment" + ], + "taskName": "[Area Pod: Adam / David - Issue Triage] Needs Further Triage", + "actions": [ + { + "name": "addToProject", + "parameters": { + "projectName": "Area Pod: Adam / David - Issue Triage", + "columnName": "Needs Triage", + "isOrgProject": true + } + } + ] + } + }, + { + "taskType": "trigger", + "capabilityId": "IssueResponder", + "subCapability": "IssuesOnlyResponder", + "version": "1.0", + "config": { + "conditions": { + "operator": "and", + "operands": [ + { + "name": "isInProjectColumn", + "parameters": { + "projectName": "Area Pod: Adam / David - Issue Triage", + "columnName": "Needs Triage", + "isOrgProject": true + } + }, + { + "operator": "and", + "operands": [ + { + "operator": "not", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-Extensions-FileSystem" + } + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Console" + } + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Diagnostics.Process" + } + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-System.IO" + } + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-System.IO.Compression" + } + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Linq.Parallel" + } + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Memory" + } + } + ] + } + ] + } + ] + }, + "eventType": "issue", + "eventNames": [ + "issues", + "project_card" + ], + "taskName": "[Area Pod: Adam / David - Issue Triage] Remove relabeled issues", + "actions": [ + { + "name": "removeFromProject", + "parameters": { + "projectName": "Area Pod: Adam / David - Issue Triage", + "isOrgProject": true + } + } + ] + } + }, + { + "taskType": "trigger", + "capabilityId": "IssueResponder", + "subCapability": "IssuesOnlyResponder", + "version": "1.0", + "config": { + "conditions": { + "operator": "and", + "operands": [ + { + "name": "isInProject", + "parameters": { + "projectName": "Area Pod: Adam / David - Issue Triage", + "isOrgProject": true + } + }, + { + "operator": "not", + "operands": [ + { + "name": "isInProjectColumn", + "parameters": { + "projectName": "Area Pod: Adam / David - Issue Triage", + "columnName": "Triaged" + } + } + ] + }, + { + "operator": "or", + "operands": [ + { + "name": "addedToMilestone", + "parameters": {} + }, + { + "name": "labelAdded", + "parameters": { + "label": "needs-author-action" + } + }, + { + "name": "labelAdded", + "parameters": { + "label": "api-ready-for-review" + } + }, + { + "name": "isAction", + "parameters": { + "action": "closed" + } + } + ] + } + ] + }, + "eventType": "issue", + "eventNames": [ + "issues", + "project_card" + ], + "taskName": "[Area Pod: Adam / David - Issue Triage] Move to Triaged Column", + "actions": [ + { + "name": "addToProject", + "parameters": { + "projectName": "Area Pod: Adam / David - Issue Triage", + "columnName": "Triaged", + "isOrgProject": true + } + } + ] + } + }, + { + "taskType": "trigger", + "capabilityId": "IssueResponder", + "subCapability": "PullRequestResponder", + "version": "1.0", + "config": { + "conditions": { + "operator": "and", + "operands": [ + { + "operator": "or", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-Extensions-FileSystem" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Console" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Diagnostics.Process" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.IO" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.IO.Compression" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Linq.Parallel" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Memory" + } + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "isInProject", + "parameters": { + "projectName": "Area Pod: Adam / David - PRs", + "isOrgProject": true + } + } + ] + } + ] + }, + "eventType": "pull_request", + "eventNames": [ + "pull_request", + "issues", + "project_card" + ], + "taskName": "[Area Pod: Adam / David - PRs] Add new PR to Board", + "actions": [ + { + "name": "addToProject", + "parameters": { + "projectName": "Area Pod: Adam / David - PRs", + "columnName": "Needs Champion", + "isOrgProject": true + } + } + ] + } + }, + { + "taskType": "trigger", + "capabilityId": "IssueResponder", + "subCapability": "PullRequestResponder", + "version": "1.0", + "config": { + "conditions": { + "operator": "and", + "operands": [ + { + "name": "isInProjectColumn", + "parameters": { + "projectName": "Area Pod: Adam / David - PRs", + "columnName": "Needs Champion", + "isOrgProject": true + } + }, + { + "operator": "and", + "operands": [ + { + "operator": "not", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-Extensions-FileSystem" + } + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Console" + } + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Diagnostics.Process" + } + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-System.IO" + } + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-System.IO.Compression" + } + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Linq.Parallel" + } + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "area-System.Memory" + } + } + ] + } + ] + } + ] + }, + "eventType": "pull_request", + "eventNames": [ + "pull_request", + "issues", + "project_card" + ], + "taskName": "[Area Pod: Adam / David - PRs] Remove relabeled PRs", + "actions": [ + { + "name": "removeFromProject", + "parameters": { + "projectName": "Area Pod: Adam / David - PRs", + "isOrgProject": true + } + } + ] + } } ] \ No newline at end of file From 773e822f66ca5d67b3d6e54adf63fb63c346eb34 Mon Sep 17 00:00:00 2001 From: Jeff Handley Date: Mon, 24 Jan 2022 02:48:35 -0800 Subject: [PATCH 027/161] Exclusively use GitHub teams for Libraries area mentions (#64199) --- .github/fabricbot.json | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/.github/fabricbot.json b/.github/fabricbot.json index 030256bef724d4..accae195f26ee0 100644 --- a/.github/fabricbot.json +++ b/.github/fabricbot.json @@ -13,8 +13,7 @@ ], "mentionees": [ "dotnet/area-system-security", - "vcsjones", - "krwq" + "vcsjones" ] }, { @@ -33,8 +32,7 @@ "area-System.Linq.Parallel" ], "mentionees": [ - "dotnet/area-system-linq-parallel", - "tarekgh" + "dotnet/area-system-linq-parallel" ] }, { @@ -42,8 +40,7 @@ "area-System.Text.Encoding" ], "mentionees": [ - "dotnet/area-system-text-encoding", - "tarekgh" + "dotnet/area-system-text-encoding" ] }, { @@ -51,8 +48,7 @@ "area-System.Text.Encodings.Web" ], "mentionees": [ - "dotnet/area-system-text-encodings-web", - "tarekgh" + "dotnet/area-system-text-encodings-web" ] }, { @@ -175,8 +171,7 @@ "area-System.Buffers" ], "mentionees": [ - "dotnet/area-system-buffers", - "GrabYourPitchforks" + "dotnet/area-system-buffers" ] }, { @@ -377,8 +372,7 @@ "area-Extensions-FileSystem" ], "mentionees": [ - "dotnet/area-extensions-filesystem", - "maryamariyan" + "dotnet/area-extensions-filesystem" ] }, { @@ -776,8 +770,7 @@ "area-System.Resources" ], "mentionees": [ - "dotnet/area-system-resources", - "tarekgh" + "dotnet/area-system-resources" ] }, { From d964b638f1ad47a729ab2e6cf4d6822f76ea3e4f Mon Sep 17 00:00:00 2001 From: Christopher Moore Date: Mon, 24 Jan 2022 12:53:54 +0000 Subject: [PATCH 028/161] Reduce buffer size used in XmlReader when using Async mode (#63459) The current choice of AsyncBufferSize resulted in the character buffer in the XmlTextReader being allocated on the Large Object Heap (LOH) Fixes https://github.com/dotnet/runtime/issues/61459 --- .../System.Private.Xml/src/System/Xml/Core/XmlReader.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Private.Xml/src/System/Xml/Core/XmlReader.cs b/src/libraries/System.Private.Xml/src/System/Xml/Core/XmlReader.cs index c6a6c1ce3e32f4..599ff04f757fd1 100644 --- a/src/libraries/System.Private.Xml/src/System/Xml/Core/XmlReader.cs +++ b/src/libraries/System.Private.Xml/src/System/Xml/Core/XmlReader.cs @@ -81,7 +81,9 @@ public abstract partial class XmlReader : IDisposable internal const int BiggerBufferSize = 8192; internal const int MaxStreamLengthForDefaultBufferSize = 64 * 1024; // 64kB - internal const int AsyncBufferSize = 64 * 1024; //64KB + // Chosen to be small enough that the character buffer in XmlTextReader when using Async = true + // is not allocated on the Large Object Heap (LOH) + internal const int AsyncBufferSize = 32 * 1024; // Settings public virtual XmlReaderSettings? Settings => null; From 0a9aecb192e76e7bdf02cead9f93deadbcd2382e Mon Sep 17 00:00:00 2001 From: Katya Sokolova Date: Mon, 24 Jan 2022 15:02:05 +0100 Subject: [PATCH 029/161] Ignoring leading dot when comparing cookie domains (#64038) * ignoring leading dot when comparin cookie domain * Simplify cookie comparing logic to equality and moving it to CookieComparer to fix the build * Domain comparing optimizarion and more unit tests * small check optimization * Renaming method --- .../Common/src/System/Net/CookieComparer.cs | 22 +++++---- .../src/System/Net/Cookie.cs | 2 +- .../src/System/Net/CookieCollection.cs | 4 +- .../tests/UnitTests/CookieContainerTest.cs | 45 +++++++++++++++++++ 4 files changed, 62 insertions(+), 11 deletions(-) diff --git a/src/libraries/Common/src/System/Net/CookieComparer.cs b/src/libraries/Common/src/System/Net/CookieComparer.cs index 7d511ace0a9acc..529ec06a51a1fe 100644 --- a/src/libraries/Common/src/System/Net/CookieComparer.cs +++ b/src/libraries/Common/src/System/Net/CookieComparer.cs @@ -5,23 +5,29 @@ namespace System.Net { internal static class CookieComparer { - internal static int Compare(Cookie left, Cookie right) + internal static bool Equals(Cookie left, Cookie right) { - int result; - - if ((result = string.Compare(left.Name, right.Name, StringComparison.OrdinalIgnoreCase)) != 0) + if (!string.Equals(left.Name, right.Name, StringComparison.OrdinalIgnoreCase)) { - return result; + return false; } - if ((result = string.Compare(left.Domain, right.Domain, StringComparison.OrdinalIgnoreCase)) != 0) + if (!EqualDomains(left.Domain, right.Domain)) { - return result; + return false; } // NB: Only the path is case sensitive as per spec. However, many Windows applications assume // case-insensitivity. - return string.Compare(left.Path, right.Path, StringComparison.Ordinal); + return string.Equals(left.Path, right.Path, StringComparison.Ordinal); + } + + internal static bool EqualDomains(ReadOnlySpan left, ReadOnlySpan right) + { + if (left.Length != 0 && left[0] == '.') left = left.Slice(1); + if (right.Length != 0 && right[0] == '.') right = right.Slice(1); + + return left.Equals(right, StringComparison.OrdinalIgnoreCase); } } } diff --git a/src/libraries/System.Net.Primitives/src/System/Net/Cookie.cs b/src/libraries/System.Net.Primitives/src/System/Net/Cookie.cs index 8ed63ef9f97b3b..4d0bfa918fd242 100644 --- a/src/libraries/System.Net.Primitives/src/System/Net/Cookie.cs +++ b/src/libraries/System.Net.Primitives/src/System/Net/Cookie.cs @@ -717,7 +717,7 @@ public override bool Equals([NotNullWhen(true)] object? comparand) && string.Equals(Name, other.Name, StringComparison.OrdinalIgnoreCase) && string.Equals(Value, other.Value, StringComparison.Ordinal) && string.Equals(Path, other.Path, StringComparison.Ordinal) - && string.Equals(Domain, other.Domain, StringComparison.OrdinalIgnoreCase) + && CookieComparer.EqualDomains(Domain, other.Domain) && (Version == other.Version); } diff --git a/src/libraries/System.Net.Primitives/src/System/Net/CookieCollection.cs b/src/libraries/System.Net.Primitives/src/System/Net/CookieCollection.cs index e8c7c78b68c0b5..edfe5ce52551ae 100644 --- a/src/libraries/System.Net.Primitives/src/System/Net/CookieCollection.cs +++ b/src/libraries/System.Net.Primitives/src/System/Net/CookieCollection.cs @@ -203,7 +203,7 @@ internal int InternalAdd(Cookie cookie, bool isStrict) for (int i = 0; i < listCount; i++) { Cookie c = (Cookie)m_list[i]!; - if (CookieComparer.Compare(cookie, c) == 0) + if (CookieComparer.Equals(cookie, c)) { ret = 0; // Will replace or reject @@ -237,7 +237,7 @@ internal int IndexOf(Cookie cookie) int idx = 0; foreach (Cookie? c in m_list) { - if (CookieComparer.Compare(cookie, c!) == 0) + if (CookieComparer.Equals(cookie, c!)) { return idx; } diff --git a/src/libraries/System.Net.Primitives/tests/UnitTests/CookieContainerTest.cs b/src/libraries/System.Net.Primitives/tests/UnitTests/CookieContainerTest.cs index b3673331aebcd6..53cb06963caa7f 100644 --- a/src/libraries/System.Net.Primitives/tests/UnitTests/CookieContainerTest.cs +++ b/src/libraries/System.Net.Primitives/tests/UnitTests/CookieContainerTest.cs @@ -866,6 +866,51 @@ public void SetCookies_DomainCheckFailure_IgnoresAbsenceOfLeadingDot(string doma Assert.Throws(() => container.SetCookies(uri, cookie)); } + [Theory] + [InlineData("example.com", "example.com" )] + [InlineData("example.com", ".example.com" )] + [InlineData(".example.com", "example.com" )] + [InlineData(".example.com", ".example.com")] + public void SetCookies_DomainCheckSuccess_IgnoresLeadingDot(params string[] domains) + { + var uri = new Uri($"https://{domains[0].Trim('.')}/", UriKind.Absolute); + var container = new CookieContainer(); + + // First HTTP response... + container.SetCookies(uri, $"foo=bar; Path=/; Domain={domains[0]}"); + + // Second HTTP response... + container.SetCookies(uri, $"foo=baz; Path=/; Domain={domains[1]}"); + + CookieCollection acceptedCookies = container.GetCookies(uri); + Assert.Equal(1, acceptedCookies.Count); + Assert.Equal(domains[1], acceptedCookies[0].Domain); + } + + [Theory] + [InlineData("test.example.com", "example.com")] + [InlineData("test.example.com", ".example.com")] + [InlineData("example.com", "test.example.com")] + [InlineData(".example.com", "test.example.com")] + public void SetCookies_DomainCheckFailure_IgnoresLeadingDot(params string[] domains) + { + var uri = new Uri($"https://test.example.com/", UriKind.Absolute); + var container = new CookieContainer(); + + // First HTTP response... + container.SetCookies(uri, $"foo=bar; Path=/; Domain={domains[0]}"); + + // Second HTTP response... + container.SetCookies(uri, $"foo=baz; Path=/; Domain={domains[1]}"); + + CookieCollection acceptedCookies = container.GetCookies(uri); + Assert.Equal(2, acceptedCookies.Count); + foreach (Cookie cookie in acceptedCookies) + { + Assert.Contains(cookie.Domain, domains); + } + } + // Test default-path calculation as defined in // https://tools.ietf.org/html/rfc6265#section-5.1.4 public static readonly TheoryData DefaultPathData = new TheoryData() From 65b12267400471f1c11e9a396250a6beb3b495a2 Mon Sep 17 00:00:00 2001 From: Joshua Peterson Date: Mon, 24 Jan 2022 09:15:38 -0500 Subject: [PATCH 030/161] Add missing handle function enter/return macros (#64061) The mono_field_static_get_value method uses a handle, but did not set up enter/exit macros properly, so this handle was leaked. Some code in Unity calls this embedding API method pretty often, which can lead to the mark stack overflowing in the GC code. --- src/mono/mono/metadata/object.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mono/mono/metadata/object.c b/src/mono/mono/metadata/object.c index 5863a967d544f0..9a39381533e5ae 100644 --- a/src/mono/mono/metadata/object.c +++ b/src/mono/mono/metadata/object.c @@ -3242,9 +3242,13 @@ mono_field_static_get_value (MonoVTable *vt, MonoClassField *field, void *value) { MONO_REQ_GC_NEUTRAL_MODE; + HANDLE_FUNCTION_ENTER (); + ERROR_DECL (error); mono_field_static_get_value_checked (vt, field, value, MONO_HANDLE_NEW (MonoString, NULL), error); mono_error_cleanup (error); + + HANDLE_FUNCTION_RETURN (); } /** From 5a9e584d684d45ce67b6e9c9cf27114db20efd1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Strehovsk=C3=BD?= Date: Mon, 24 Jan 2022 23:28:06 +0900 Subject: [PATCH 031/161] Drop support for .NET 5 SDK (#64186) We had to duplicate a lot of Microsoft.NET.ILLink.targets logic. --- .../Microsoft.NETCore.Native.Publish.targets | 2 +- .../Microsoft.NETCore.Native.targets | 41 ------------------- 2 files changed, 1 insertion(+), 42 deletions(-) diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Publish.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Publish.targets index 18258d4288b01f..ae6229a0a7afe6 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Publish.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Publish.targets @@ -48,7 +48,7 @@ - + diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets index 365afaa6ce4687..8fc0d8e6842e90 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets @@ -40,8 +40,6 @@ The .NET Foundation licenses this file to you under the MIT license. true true - true - copyused @@ -132,13 +130,6 @@ The .NET Foundation licenses this file to you under the MIT license. - - - - true - - - @@ -200,35 +191,6 @@ The .NET Foundation licenses this file to you under the MIT license. Outputs="%(ManagedBinary.IlcRspFile)" DependsOnTargets="$(IlcCompileDependsOn)"> - - - true - - - - - - - <__SingleWarnIntermediateAssembly Include="@(ManagedAssemblyToLink)" /> - <__SingleWarnIntermediateAssembly Remove="@(IntermediateAssembly)" /> - - <_SingleWarnIntermediateAssembly Include="@(ManagedAssemblyToLink)" /> - <_SingleWarnIntermediateAssembly Remove="@(__SingleWarnIntermediateAssembly)" /> - - <_SingleWarnIntermediateAssembly> - false - - - - - - - - false - - - <_IlcRootedAssemblies Include="@(TrimmerRootAssembly)" /> <_IlcRootedAssemblies Include="@(ManagedAssemblyToLink)" Condition="%(ManagedAssemblyToLink.TrimMode) == 'copy'" /> @@ -287,9 +249,6 @@ The .NET Foundation licenses this file to you under the MIT license. - - - From 0ac0071e457434c73bdd119911d1094f6ccee544 Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Mon, 24 Jan 2022 09:43:25 -0500 Subject: [PATCH 032/161] Implement IEquatable on value types overriding Equals (and enable CA1066/1077) (#63690) --- eng/CodeAnalysis.src.globalconfig | 4 +- .../System.Private.CoreLib.csproj | 2 - .../Diagnostics/SymbolStore/SymAddressKind.cs | 49 ------------ .../System/Diagnostics/SymbolStore/Token.cs | 39 ---------- .../src/System/Reflection/MdImport.cs | 2 + .../src/System/RuntimeHandles.cs | 2 +- .../src/System/ModuleHandle.cs | 2 +- .../General/TypeUnifier.NativeFormat.cs | 2 + .../Runtime/TypeInfos/RuntimeNamedTypeInfo.cs | 2 + .../NativeFormat/Generator/ReaderGen.cs | 1 + .../NativeFormat/NativeFormatReaderGen.cs | 1 + .../NativeFormat/NativeMetadataReader.cs | 7 +- .../Common/TypeSystem/Common/LayoutInt.cs | 2 + .../Unix/System.Native/Interop.IPAddress.cs | 16 +++- .../src/ServiceLookup/ServiceCacheKey.cs | 13 +++- ...crosoft.Extensions.Logging.Abstractions.cs | 2 +- .../src/EventId.cs | 3 +- .../ImmutableDictionary_2.HashBucket.cs | 2 + .../ImmutableHashSet_1.HashBucket.cs | 2 + .../ref/System.Collections.Specialized.cs | 5 +- .../Collections/Specialized/BitVector32.cs | 11 ++- .../tests/BitVector32Tests.cs | 15 ++++ .../ref/System.ComponentModel.Composition.cs | 3 +- .../ReflectionModel/LazyMemberInfo.cs | 25 +++--- .../System.ComponentModel.TypeConverter.cs | 3 +- .../MemberRelationshipService.cs | 50 +++++------- .../ComponentModel/InterlockedBitVector32.cs | 6 +- .../ref/System.Data.Common.cs | 39 ++++++---- .../src/System/Data/DataKey.cs | 4 +- .../src/System/Data/SQLTypes/SQLBinary.cs | 25 +++--- .../src/System/Data/SQLTypes/SQLBoolean.cs | 28 +++---- .../src/System/Data/SQLTypes/SQLByte.cs | 28 +++---- .../src/System/Data/SQLTypes/SQLDateTime.cs | 28 +++---- .../src/System/Data/SQLTypes/SQLDecimal.cs | 25 +++--- .../src/System/Data/SQLTypes/SQLDouble.cs | 28 +++---- .../src/System/Data/SQLTypes/SQLGuid.cs | 28 +++---- .../src/System/Data/SQLTypes/SQLInt16.cs | 28 +++---- .../src/System/Data/SQLTypes/SQLInt32.cs | 28 +++---- .../src/System/Data/SQLTypes/SQLInt64.cs | 28 +++---- .../src/System/Data/SQLTypes/SQLMoney.cs | 29 +++---- .../src/System/Data/SQLTypes/SQLSingle.cs | 28 +++---- .../src/System/Data/SQLTypes/SQLString.cs | 25 +++--- .../src/System/Data/Selection.cs | 14 ++-- .../System/Data/SqlTypes/SqlBinaryTest.cs | 3 + .../System/Data/SqlTypes/SqlBooleanTest.cs | 4 + .../tests/System/Data/SqlTypes/SqlByteTest.cs | 3 + .../System/Data/SqlTypes/SqlDateTimeTest.cs | 2 + .../System/Data/SqlTypes/SqlDecimalTest.cs | 2 + .../System/Data/SqlTypes/SqlDoubleTest.cs | 3 + .../tests/System/Data/SqlTypes/SqlGuidTest.cs | 3 + .../System/Data/SqlTypes/SqlInt16Test.cs | 3 + .../System/Data/SqlTypes/SqlInt64Test.cs | 3 + .../System/Data/SqlTypes/SqlMoneyTest.cs | 2 + .../System/Data/SqlTypes/SqlSingleTest.cs | 3 + .../System/Data/SqlTypes/SqlStringTest.cs | 3 + ...stem.Diagnostics.PerformanceCounter.csproj | 3 +- ...agnostics.PerformanceCounter.netcoreapp.cs | 12 +++ ...stem.Diagnostics.PerformanceCounter.csproj | 1 + .../src/System/Diagnostics/CounterSample.cs | 2 +- .../ref/System.Diagnostics.StackTrace.cs | 2 +- .../Diagnostics/SymbolStore/SymbolToken.cs | 2 +- .../ref/System.Drawing.Common.netcoreapp.cs | 4 + .../src/System/Drawing/CharacterRange.cs | 30 +++---- .../src/System/Drawing/Printing/TriState.cs | 78 +++++++------------ .../tests/CharacterRangeTests.cs | 1 + .../src/System/IO/Packaging/PackUriHelper.cs | 2 + .../Expressions/Interpreter/LocalVariables.cs | 23 ++---- .../ref/System.Net.Sockets.cs | 3 +- .../System/Net/Sockets/IPPacketInformation.cs | 48 ++++-------- .../IPPacketInformationTest.cs | 7 ++ .../src/System/ArraySegment.cs | 10 ++- .../Diagnostics/Tracing/EventDescriptor.cs | 2 +- .../src/System/HashCode.cs | 2 + .../src/System/IntPtr.cs | 2 + .../src/System/Nullable.cs | 2 + .../CustomAttributeNamedArgument.cs | 17 ++-- .../CustomAttributeTypedArgument.cs | 11 ++- .../InteropServices/ArrayWithOffset.cs | 4 +- .../Runtime/InteropServices/GCHandle.cs | 9 ++- .../Runtime/Serialization/StreamingContext.cs | 2 + .../src/System/Threading/CancellationToken.cs | 2 +- .../System/Threading/LowLevelLifoSemaphore.cs | 9 ++- .../PortableThreadPool.ThreadCounts.cs | 5 +- .../PortableThreadPool.WorkerTracking.cs | 11 ++- .../src/System/TimeZoneInfo.AdjustmentRule.cs | 6 ++ .../src/System/UIntPtr.cs | 2 + .../System/Xml/BinaryXml/XmlBinaryReader.cs | 49 ++++-------- .../src/System/Xml/Xsl/Pair.cs | 43 ++++------ .../src/System/Xml/Xsl/XmlQueryCardinality.cs | 2 +- .../System/Runtime/Caching/CacheExpires.cs | 55 +++---------- .../src/System/Runtime/Caching/CacheUsage.cs | 62 +++------------ .../ref/System.Runtime.InteropServices.cs | 2 +- .../Runtime/InteropServices/GCHandleTests.cs | 1 + .../System.Runtime/ref/System.Runtime.cs | 18 +++-- ...stomAttribute_Named_Typed_ArgumentTests.cs | 22 ++++++ ...iceProcess.ServiceController.netcoreapp.cs | 3 + ...em.ServiceProcess.ServiceController.csproj | 2 + .../SessionChangeDescription.cs | 39 ++++------ .../src/Internal/Synthesis/EngineSiteSapi.cs | 38 ++++----- .../System.Text.Rune.netstandard20.cs | 2 +- .../Symbolic/SymbolicMatch.cs | 12 ++- .../Symbolic/SymbolicRegexInfo.cs | 6 +- .../System.Threading/ref/System.Threading.cs | 2 +- .../src/System/Threading/LockCookie.cs | 37 +++------ .../ref/System.Transactions.Local.cs | 5 +- .../System/Transactions/TransactionOptions.cs | 7 +- .../src/Mono/RuntimeHandles.cs | 6 +- .../src/System/ModuleHandle.cs | 2 +- .../src/System/Nullable.Mono.cs | 2 + .../BrowserDebugProxy/DevToolsHelper.cs | 12 ++- .../WasmAppBuilder/PInvokeTableGenerator.cs | 2 + 111 files changed, 650 insertions(+), 813 deletions(-) delete mode 100644 src/coreclr/System.Private.CoreLib/src/System/Diagnostics/SymbolStore/SymAddressKind.cs delete mode 100644 src/coreclr/System.Private.CoreLib/src/System/Diagnostics/SymbolStore/Token.cs create mode 100644 src/libraries/System.Diagnostics.PerformanceCounter/ref/System.Diagnostics.PerformanceCounter.netcoreapp.cs diff --git a/eng/CodeAnalysis.src.globalconfig b/eng/CodeAnalysis.src.globalconfig index 0fc9bf8e5a7eeb..e5ae41903b5a76 100644 --- a/eng/CodeAnalysis.src.globalconfig +++ b/eng/CodeAnalysis.src.globalconfig @@ -152,10 +152,10 @@ dotnet_diagnostic.CA1064.severity = none dotnet_diagnostic.CA1065.severity = none # CA1066: Implement IEquatable when overriding Object.Equals -dotnet_diagnostic.CA1066.severity = none +dotnet_diagnostic.CA1066.severity = warning # CA1067: Override Object.Equals(object) when implementing IEquatable -dotnet_diagnostic.CA1067.severity = none +dotnet_diagnostic.CA1067.severity = warning # CA1068: CancellationToken parameters must come last dotnet_diagnostic.CA1068.severity = none diff --git a/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj b/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj index e1230d59401d86..3d21bffd3d24f8 100644 --- a/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj +++ b/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj @@ -140,8 +140,6 @@ - - diff --git a/src/coreclr/System.Private.CoreLib/src/System/Diagnostics/SymbolStore/SymAddressKind.cs b/src/coreclr/System.Private.CoreLib/src/System/Diagnostics/SymbolStore/SymAddressKind.cs deleted file mode 100644 index dc2a0a05708c16..00000000000000 --- a/src/coreclr/System.Private.CoreLib/src/System/Diagnostics/SymbolStore/SymAddressKind.cs +++ /dev/null @@ -1,49 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================ -** -** -** -** Represents address Kinds used with local variables, parameters, and -** fields. -** -** -===========================================================*/ -// Only statics, does not need to be marked with the serializable attribute - -namespace System.Diagnostics.SymbolStore -{ - internal enum SymAddressKind - { - // ILOffset: addr1 = IL local var or param index. - ILOffset = 1, - - // NativeRVA: addr1 = RVA into module. - NativeRVA = 2, - - // NativeRegister: addr1 = register the var is stored in. - NativeRegister = 3, - - // NativeRegisterRelative: addr1 = register, addr2 = offset. - NativeRegisterRelative = 4, - - // NativeOffset: addr1 = offset from start of parent. - NativeOffset = 5, - - // NativeRegisterRegister: addr1 = reg low, addr2 = reg high. - NativeRegisterRegister = 6, - - // NativeRegisterStack: addr1 = reg low, addr2 = reg stk, addr3 = offset. - NativeRegisterStack = 7, - - // NativeStackRegister: addr1 = reg stk, addr2 = offset, addr3 = reg high. - NativeStackRegister = 8, - - // BitField: addr1 = field start, addr = field length. - BitField = 9, - - // NativeSectionOffset: addr1 = section, addr = offset - NativeSectionOffset = 10, - } -} diff --git a/src/coreclr/System.Private.CoreLib/src/System/Diagnostics/SymbolStore/Token.cs b/src/coreclr/System.Private.CoreLib/src/System/Diagnostics/SymbolStore/Token.cs deleted file mode 100644 index fbd9f7e4bc1ae9..00000000000000 --- a/src/coreclr/System.Private.CoreLib/src/System/Diagnostics/SymbolStore/Token.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================ -** -** -** Small value class used by the SymbolStore package for passing -** around metadata tokens. -** -===========================================================*/ - -using System.Diagnostics.CodeAnalysis; - -namespace System.Diagnostics.SymbolStore -{ - internal struct SymbolToken - { - internal int m_token; - - public SymbolToken(int val) { m_token = val; } - - public int GetToken() { return m_token; } - - public override int GetHashCode() { return m_token; } - - public override bool Equals([NotNullWhen(true)] object? obj) - { - if (obj is SymbolToken) - return Equals((SymbolToken)obj); - else - return false; - } - - public bool Equals(SymbolToken obj) - { - return obj.m_token == m_token; - } - } -} diff --git a/src/coreclr/System.Private.CoreLib/src/System/Reflection/MdImport.cs b/src/coreclr/System.Private.CoreLib/src/System/Reflection/MdImport.cs index 9368fc25d340b8..cdc15dc8fb6e08 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/Reflection/MdImport.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/Reflection/MdImport.cs @@ -194,7 +194,9 @@ public int this[int index] } } +#pragma warning disable CA1066 // IEquatable interface implementation isn't used internal readonly struct MetadataImport +#pragma warning restore CA1067 { private readonly IntPtr m_metadataImport2; private readonly object? m_keepalive; diff --git a/src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs b/src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs index 977d73e5c3b990..32a37b6d4219f1 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs @@ -1246,7 +1246,7 @@ public void GetObjectData(SerializationInfo info, StreamingContext context) } } - public unsafe partial struct ModuleHandle + public unsafe partial struct ModuleHandle : IEquatable { #region Public Static Members public static readonly ModuleHandle EmptyHandle; diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/ModuleHandle.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/ModuleHandle.cs index 3714e7ce510fba..d1bb831f347729 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/ModuleHandle.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/ModuleHandle.cs @@ -6,7 +6,7 @@ namespace System { - public struct ModuleHandle + public struct ModuleHandle : IEquatable { public static readonly ModuleHandle EmptyHandle; diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/TypeUnifier.NativeFormat.cs b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/TypeUnifier.NativeFormat.cs index b44cf57cdff6dc..fe06816cf93e3e 100644 --- a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/TypeUnifier.NativeFormat.cs +++ b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/TypeUnifier.NativeFormat.cs @@ -34,6 +34,8 @@ // - The TypeUnifier extension class provides a more friendly interface to the rest of the codebase. // +#pragma warning disable CA1067 // override Equals because it implements IEquatable + namespace System.Reflection.Runtime.General { internal static partial class TypeUnifier diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeNamedTypeInfo.cs b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeNamedTypeInfo.cs index 209a91e0cb1028..fdbcf0b53685d3 100644 --- a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeNamedTypeInfo.cs +++ b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeNamedTypeInfo.cs @@ -10,6 +10,8 @@ using Internal.Reflection.Tracing; +#pragma warning disable CA1067 // override Equals because it implements IEquatable + namespace System.Reflection.Runtime.TypeInfos { // diff --git a/src/coreclr/tools/Common/Internal/Metadata/NativeFormat/Generator/ReaderGen.cs b/src/coreclr/tools/Common/Internal/Metadata/NativeFormat/Generator/ReaderGen.cs index 55b09b37b3431e..aa1a796bfaa0f1 100644 --- a/src/coreclr/tools/Common/Internal/Metadata/NativeFormat/Generator/ReaderGen.cs +++ b/src/coreclr/tools/Common/Internal/Metadata/NativeFormat/Generator/ReaderGen.cs @@ -20,6 +20,7 @@ public void EmitSource() WriteLine("#pragma warning disable 649"); WriteLine("#pragma warning disable 169"); WriteLine("#pragma warning disable 282 // There is no defined ordering between fields in multiple declarations of partial class or struct"); + WriteLine("#pragma warning disable CA1066 // IEquatable implementations aren't used"); WriteLine("#pragma warning disable IDE0059"); WriteLine(); diff --git a/src/coreclr/tools/Common/Internal/Metadata/NativeFormat/NativeFormatReaderGen.cs b/src/coreclr/tools/Common/Internal/Metadata/NativeFormat/NativeFormatReaderGen.cs index 1d92be56771488..bbc23ec8784848 100644 --- a/src/coreclr/tools/Common/Internal/Metadata/NativeFormat/NativeFormatReaderGen.cs +++ b/src/coreclr/tools/Common/Internal/Metadata/NativeFormat/NativeFormatReaderGen.cs @@ -6,6 +6,7 @@ #pragma warning disable 649 #pragma warning disable 169 #pragma warning disable 282 // There is no defined ordering between fields in multiple declarations of partial class or struct +#pragma warning disable CA1066 // IEquatable implementations aren't used #pragma warning disable IDE0059 using System; diff --git a/src/coreclr/tools/Common/Internal/Metadata/NativeFormat/NativeMetadataReader.cs b/src/coreclr/tools/Common/Internal/Metadata/NativeFormat/NativeMetadataReader.cs index 8eba905400e423..5b7921f972f97a 100644 --- a/src/coreclr/tools/Common/Internal/Metadata/NativeFormat/NativeMetadataReader.cs +++ b/src/coreclr/tools/Common/Internal/Metadata/NativeFormat/NativeMetadataReader.cs @@ -1,12 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. - #pragma warning disable 169 - -// There is no defined ordering between fields in multiple declarations of partial class or struct -#pragma warning disable 282 - +#pragma warning disable 282 // There is no defined ordering between fields in multiple declarations of partial class or struct +#pragma warning disable CA1066 // IEquatable implementations aren't used using System; using System.IO; diff --git a/src/coreclr/tools/Common/TypeSystem/Common/LayoutInt.cs b/src/coreclr/tools/Common/TypeSystem/Common/LayoutInt.cs index 2ec3883af9f08b..c794377bf19712 100644 --- a/src/coreclr/tools/Common/TypeSystem/Common/LayoutInt.cs +++ b/src/coreclr/tools/Common/TypeSystem/Common/LayoutInt.cs @@ -12,7 +12,9 @@ namespace Internal.TypeSystem /// type system do not have a known size. This type is used to make such sizes viral through the type layout /// computations) /// +#pragma warning disable CA1066 // IEquatable implementation wouldn't be used public struct LayoutInt +#pragma warning restore CA1066 { private int _value; diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.IPAddress.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.IPAddress.cs index 567f97df901ce7..4bbd79987510bd 100644 --- a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.IPAddress.cs +++ b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.IPAddress.cs @@ -2,9 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; -using System.Text; internal static partial class Interop { @@ -33,6 +32,19 @@ public bool IsIPv6 private uint _isIPv6; // Non-zero if this is an IPv6 address; zero for IPv4. internal uint ScopeId; // Scope ID (IPv6 only) + public override unsafe int GetHashCode() + { + HashCode h = default; + fixed (byte* ptr = Address) + { + h.AddBytes(new ReadOnlySpan(ptr, IsIPv6 ? IPv6AddressBytes : IPv4AddressBytes)); + } + return h.ToHashCode(); + } + + public override bool Equals([NotNullWhen(true)] object? obj) => + obj is IPAddress other && Equals(other); + public bool Equals(IPAddress other) { int addressByteCount; diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/src/ServiceLookup/ServiceCacheKey.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/src/ServiceLookup/ServiceCacheKey.cs index 8f812ae45e6a86..737c23d7f4445a 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/src/ServiceLookup/ServiceCacheKey.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/src/ServiceLookup/ServiceCacheKey.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Diagnostics.CodeAnalysis; namespace Microsoft.Extensions.DependencyInjection.ServiceLookup { @@ -33,10 +34,14 @@ public ServiceCacheKey(Type? type, int slot) Slot = slot; } - public bool Equals(ServiceCacheKey other) - { - return Type == other.Type && Slot == other.Slot; - } + /// Indicates whether the current instance is equal to another instance of the same type. + /// An instance to compare with this instance. + /// true if the current instance is equal to the other instance; otherwise, false. + public bool Equals(ServiceCacheKey other) => + Type == other.Type && Slot == other.Slot; + + public override bool Equals([NotNullWhen(true)] object? obj) => + obj is ServiceCacheKey other && Equals(other); public override int GetHashCode() { diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/ref/Microsoft.Extensions.Logging.Abstractions.cs b/src/libraries/Microsoft.Extensions.Logging.Abstractions/ref/Microsoft.Extensions.Logging.Abstractions.cs index 1404880a972882..33e79ca09252e4 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/ref/Microsoft.Extensions.Logging.Abstractions.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/ref/Microsoft.Extensions.Logging.Abstractions.cs @@ -6,7 +6,7 @@ namespace Microsoft.Extensions.Logging { - public readonly partial struct EventId + public readonly partial struct EventId : System.IEquatable { private readonly object _dummy; private readonly int _dummyPrimitive; diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/EventId.cs b/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/EventId.cs index 972fb1ec0488ce..1cb4775b275b97 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/EventId.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/EventId.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System; using System.Diagnostics.CodeAnalysis; namespace Microsoft.Extensions.Logging @@ -8,7 +9,7 @@ namespace Microsoft.Extensions.Logging /// /// Identifies a logging event. The primary identifier is the "Id" property, with the "Name" property providing a short description of this type of event. /// - public readonly struct EventId + public readonly struct EventId : IEquatable { /// /// Implicitly creates an EventId from the given . diff --git a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableDictionary_2.HashBucket.cs b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableDictionary_2.HashBucket.cs index aa8d7636cfbca0..2562372c666b4a 100644 --- a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableDictionary_2.HashBucket.cs +++ b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableDictionary_2.HashBucket.cs @@ -15,7 +15,9 @@ public partial class ImmutableDictionary /// /// Contains all the key/values in the collection that hash to the same value. /// +#pragma warning disable CA1066 // Implement IEquatable when overriding Object.Equals internal readonly struct HashBucket : IEnumerable> +#pragma warning restore CA1066 { /// /// One of the values in this bucket. diff --git a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableHashSet_1.HashBucket.cs b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableHashSet_1.HashBucket.cs index 82fd48fbc62e5f..04ca794da7808e 100644 --- a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableHashSet_1.HashBucket.cs +++ b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableHashSet_1.HashBucket.cs @@ -30,7 +30,9 @@ internal enum OperationResult /// /// Contains all the keys in the collection that hash to the same value. /// +#pragma warning disable CA1066 // Implement IEquatable when overriding Object.Equals internal readonly struct HashBucket +#pragma warning restore CA1066 { /// /// One of the values in this bucket. diff --git a/src/libraries/System.Collections.Specialized/ref/System.Collections.Specialized.cs b/src/libraries/System.Collections.Specialized/ref/System.Collections.Specialized.cs index 1864717141ca47..00fc77efe910c2 100644 --- a/src/libraries/System.Collections.Specialized/ref/System.Collections.Specialized.cs +++ b/src/libraries/System.Collections.Specialized/ref/System.Collections.Specialized.cs @@ -6,7 +6,7 @@ namespace System.Collections.Specialized { - public partial struct BitVector32 + public partial struct BitVector32 : System.IEquatable { private int _dummyPrimitive; public BitVector32(System.Collections.Specialized.BitVector32 value) { throw null; } @@ -18,11 +18,12 @@ public partial struct BitVector32 public static int CreateMask(int previous) { throw null; } public static System.Collections.Specialized.BitVector32.Section CreateSection(short maxValue) { throw null; } public static System.Collections.Specialized.BitVector32.Section CreateSection(short maxValue, System.Collections.Specialized.BitVector32.Section previous) { throw null; } + public bool Equals(System.Collections.Specialized.BitVector32 other) { throw null; } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? o) { throw null; } public override int GetHashCode() { throw null; } public override string ToString() { throw null; } public static string ToString(System.Collections.Specialized.BitVector32 value) { throw null; } - public readonly partial struct Section + public readonly partial struct Section : System.IEquatable { private readonly int _dummyPrimitive; public short Mask { get { throw null; } } diff --git a/src/libraries/System.Collections.Specialized/src/System/Collections/Specialized/BitVector32.cs b/src/libraries/System.Collections.Specialized/src/System/Collections/Specialized/BitVector32.cs index ce4ba761ab7aff..60a2580cfb6fd0 100644 --- a/src/libraries/System.Collections.Specialized/src/System/Collections/Specialized/BitVector32.cs +++ b/src/libraries/System.Collections.Specialized/src/System/Collections/Specialized/BitVector32.cs @@ -10,7 +10,7 @@ namespace System.Collections.Specialized /// Provides a simple light bit vector with easy integer or Boolean access to /// a 32 bit storage. /// - public struct BitVector32 + public struct BitVector32 : IEquatable { private uint _data; @@ -151,7 +151,12 @@ private static Section CreateSectionHelper(short maxValue, short priorMask, shor return new Section(mask, offset); } - public override bool Equals([NotNullWhen(true)] object? o) => o is BitVector32 other && _data == other._data; + public override bool Equals([NotNullWhen(true)] object? o) => o is BitVector32 other && Equals(other); + + /// Indicates whether the current instance is equal to another instance of the same type. + /// An instance to compare with this instance. + /// true if the current instance is equal to the other instance; otherwise, false. + public bool Equals(BitVector32 other) => _data == other._data; public override int GetHashCode() => _data.GetHashCode(); @@ -182,7 +187,7 @@ public override string ToString() /// /// Represents an section of the vector that can contain a integer number. /// - public readonly struct Section + public readonly struct Section : IEquatable
{ private readonly short _mask; private readonly short _offset; diff --git a/src/libraries/System.Collections.Specialized/tests/BitVector32Tests.cs b/src/libraries/System.Collections.Specialized/tests/BitVector32Tests.cs index 61734a09b741f1..69453b6c574d5a 100644 --- a/src/libraries/System.Collections.Specialized/tests/BitVector32Tests.cs +++ b/src/libraries/System.Collections.Specialized/tests/BitVector32Tests.cs @@ -518,17 +518,32 @@ public static void EqualsTest() Assert.True(new BitVector32(0).Equals(original)); Assert.True(original.Equals(new BitVector32(0))); + Assert.True(original.Equals((object)original)); + Assert.True(new BitVector32().Equals((object)original)); + Assert.True(original.Equals((object)new BitVector32())); + Assert.True(new BitVector32(0).Equals((object)original)); + Assert.True(original.Equals((object)new BitVector32(0))); + BitVector32 other = new BitVector32(int.MaxValue / 2 - 1); Assert.True(other.Equals(other)); Assert.True(new BitVector32(int.MaxValue / 2 - 1).Equals(other)); Assert.True(other.Equals(new BitVector32(int.MaxValue / 2 - 1))); + Assert.True(other.Equals((object)other)); + Assert.True(new BitVector32(int.MaxValue / 2 - 1).Equals((object)other)); + Assert.True(other.Equals((object)new BitVector32(int.MaxValue / 2 - 1))); + Assert.False(other.Equals(original)); Assert.False(original.Equals(other)); Assert.False(other.Equals(null)); Assert.False(original.Equals(null)); Assert.False(other.Equals(int.MaxValue / 2 - 1)); Assert.False(original.Equals(0)); + + Assert.False(other.Equals((object)original)); + Assert.False(original.Equals((object)other)); + Assert.False(other.Equals(int.MaxValue / 2 - 1)); + Assert.False(original.Equals(0)); } [Fact] diff --git a/src/libraries/System.ComponentModel.Composition/ref/System.ComponentModel.Composition.cs b/src/libraries/System.ComponentModel.Composition/ref/System.ComponentModel.Composition.cs index f55f6b216d37f9..60accaee91e879 100644 --- a/src/libraries/System.ComponentModel.Composition/ref/System.ComponentModel.Composition.cs +++ b/src/libraries/System.ComponentModel.Composition/ref/System.ComponentModel.Composition.cs @@ -608,7 +608,7 @@ public ImportDefinition(System.Linq.Expressions.Expression { private object _dummy; private int _dummyPrimitive; @@ -616,6 +616,7 @@ public partial struct LazyMemberInfo public LazyMemberInfo(System.Reflection.MemberTypes memberType, System.Func accessorsCreator) { throw null; } public LazyMemberInfo(System.Reflection.MemberTypes memberType, params System.Reflection.MemberInfo[] accessors) { throw null; } public System.Reflection.MemberTypes MemberType { get { throw null; } } + public bool Equals(System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo other) { throw null; } public override bool Equals(object? obj) { throw null; } public System.Reflection.MemberInfo[] GetAccessors() { throw null; } public override int GetHashCode() { throw null; } diff --git a/src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/ReflectionModel/LazyMemberInfo.cs b/src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/ReflectionModel/LazyMemberInfo.cs index 480e339c4080f5..02d1f811e71b71 100644 --- a/src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/ReflectionModel/LazyMemberInfo.cs +++ b/src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/ReflectionModel/LazyMemberInfo.cs @@ -8,7 +8,7 @@ namespace System.ComponentModel.Composition.ReflectionModel { - public struct LazyMemberInfo + public struct LazyMemberInfo : IEquatable { private readonly MemberTypes _memberType; private MemberInfo?[]? _accessors; @@ -106,31 +106,32 @@ public override int GetHashCode() throw new Exception(SR.Diagnostic_InternalExceptionMessage); } - public override bool Equals(object? obj) - { - if (obj is not LazyMemberInfo that) - { - return false; - } + public override bool Equals(object? obj) => + obj is LazyMemberInfo other && Equals(other); + /// Indicates whether the current instance is equal to another instance of the same type. + /// An instance to compare with this instance. + /// true if the current instance is equal to the other instance; otherwise, false. + public bool Equals(LazyMemberInfo other) + { // Different member types mean different members - if (_memberType != that._memberType) + if (_memberType != other._memberType) { return false; } // if any of the lazy memebers create accessors in a delay-loaded fashion, we simply compare the creators - if ((_accessorsCreator != null) || (that._accessorsCreator != null)) + if ((_accessorsCreator != null) || (other._accessorsCreator != null)) { - return object.Equals(_accessorsCreator, that._accessorsCreator); + return object.Equals(_accessorsCreator, other._accessorsCreator); } // we are dealing with explicitly passed accessors in both cases - if (_accessors == null || that._accessors == null) + if (_accessors == null || other._accessors == null) { throw new Exception(SR.Diagnostic_InternalExceptionMessage); } - return _accessors.SequenceEqual(that._accessors); + return _accessors.SequenceEqual(other._accessors); } public static bool operator ==(LazyMemberInfo left, LazyMemberInfo right) diff --git a/src/libraries/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.cs b/src/libraries/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.cs index 510fffca714069..8fe3c9a37f8217 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.cs @@ -2164,7 +2164,7 @@ public InstanceDescriptor(System.Reflection.MemberInfo? member, System.Collectio public object? Invoke() { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct MemberRelationship + public readonly partial struct MemberRelationship : System.IEquatable { private readonly object _dummy; private readonly int _dummyPrimitive; @@ -2173,6 +2173,7 @@ public readonly partial struct MemberRelationship public bool IsEmpty { get { throw null; } } public System.ComponentModel.MemberDescriptor Member { get { throw null; } } public object? Owner { get { throw null; } } + public bool Equals(System.ComponentModel.Design.Serialization.MemberRelationship other) { throw null; } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } public override int GetHashCode() { throw null; } public static bool operator ==(System.ComponentModel.Design.Serialization.MemberRelationship left, System.ComponentModel.Design.Serialization.MemberRelationship right) { throw null; } diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/Serialization/MemberRelationshipService.cs b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/Serialization/MemberRelationshipService.cs index 6691792d7fcfe3..090fa91accbf7c 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/Serialization/MemberRelationshipService.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/Serialization/MemberRelationshipService.cs @@ -153,7 +153,7 @@ private static void ThrowRelationshipNotSupported(MemberRelationship source, Mem /// /// Used as storage in our relationship table /// - private struct RelationshipEntry + private struct RelationshipEntry : IEquatable { internal WeakReference _owner; internal MemberDescriptor _member; @@ -169,20 +169,19 @@ internal RelationshipEntry(MemberRelationship rel) public override bool Equals([NotNullWhen(true)] object? o) { Debug.Assert(o is RelationshipEntry, "This is only called indirectly from a dictionary only containing RelationshipEntry structs."); - return this == (RelationshipEntry)o; + return Equals((RelationshipEntry)o); } - public static bool operator ==(RelationshipEntry re1, RelationshipEntry re2) + public bool Equals(RelationshipEntry other) { - object? owner1 = (re1._owner.IsAlive ? re1._owner.Target : null); - object? owner2 = (re2._owner.IsAlive ? re2._owner.Target : null); - return owner1 == owner2 && re1._member.Equals(re2._member); + object? owner1 = (_owner.IsAlive ? _owner.Target : null); + object? owner2 = (other._owner.IsAlive ? other._owner.Target : null); + return owner1 == owner2 && _member.Equals(other._member); } - public static bool operator !=(RelationshipEntry re1, RelationshipEntry re2) - { - return !(re1 == re2); - } + public static bool operator ==(RelationshipEntry re1, RelationshipEntry re2) => re1.Equals(re2); + + public static bool operator !=(RelationshipEntry re1, RelationshipEntry re2) => !re1.Equals(re2); public override int GetHashCode() => _hashCode; } @@ -191,7 +190,7 @@ public override bool Equals([NotNullWhen(true)] object? o) /// /// This class represents a single relationship between an object and a member. /// - public readonly struct MemberRelationship + public readonly struct MemberRelationship : IEquatable { public static readonly MemberRelationship Empty; @@ -222,37 +221,26 @@ public MemberRelationship(object owner, MemberDescriptor member) /// /// Infrastructure support to make this a first class struct /// - public override bool Equals([NotNullWhen(true)] object? obj) - { - return obj is MemberRelationship rel && rel.Owner == Owner && rel.Member == Member; - } + public override bool Equals([NotNullWhen(true)] object? obj) => obj is MemberRelationship rel && Equals(rel); /// /// Infrastructure support to make this a first class struct /// - public override int GetHashCode() - { - if (Owner == null) - { - return base.GetHashCode(); - } + public bool Equals(MemberRelationship other) => other.Owner == Owner && other.Member == Member; - return Owner.GetHashCode() ^ Member.GetHashCode(); - } /// /// Infrastructure support to make this a first class struct /// - public static bool operator ==(MemberRelationship left, MemberRelationship right) - { - return left.Owner == right.Owner && left.Member == right.Member; - } + public override int GetHashCode() => Owner is null ? base.GetHashCode() : Owner.GetHashCode() ^ Member.GetHashCode(); /// /// Infrastructure support to make this a first class struct /// - public static bool operator !=(MemberRelationship left, MemberRelationship right) - { - return !(left == right); - } + public static bool operator ==(MemberRelationship left, MemberRelationship right) => left.Equals(right); + + /// + /// Infrastructure support to make this a first class struct + /// + public static bool operator !=(MemberRelationship left, MemberRelationship right) => !left.Equals(right); } } diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/InterlockedBitVector32.cs b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/InterlockedBitVector32.cs index 2190f32299fbb4..7aa25ce5bdf631 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/InterlockedBitVector32.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/InterlockedBitVector32.cs @@ -11,7 +11,7 @@ namespace System.ComponentModel /// Provides a subset of the surface area, using volatile /// operations for reads and interlocked operations for writes. ///
- internal struct InterlockedBitVector32 + internal struct InterlockedBitVector32 : IEquatable { private int _data; @@ -44,7 +44,9 @@ public static int CreateMask(int previous) return previous == 0 ? 1 : previous << 1; } - public override bool Equals([NotNullWhen(true)] object? o) => o is InterlockedBitVector32 vector && _data == vector._data; + public override bool Equals([NotNullWhen(true)] object? o) => o is InterlockedBitVector32 other && Equals(other); + + public bool Equals(InterlockedBitVector32 other) => _data == other._data; public override int GetHashCode() => base.GetHashCode(); } diff --git a/src/libraries/System.Data.Common/ref/System.Data.Common.cs b/src/libraries/System.Data.Common/ref/System.Data.Common.cs index 569f83d8ac7776..5e664573d5ea6c 100644 --- a/src/libraries/System.Data.Common/ref/System.Data.Common.cs +++ b/src/libraries/System.Data.Common/ref/System.Data.Common.cs @@ -2737,7 +2737,7 @@ public SqlAlreadyFilledException(string? message) { } public SqlAlreadyFilledException(string? message, System.Exception? e) { } } [System.Xml.Serialization.XmlSchemaProviderAttribute("GetXsdType")] - public partial struct SqlBinary : System.Data.SqlTypes.INullable, System.IComparable, System.Xml.Serialization.IXmlSerializable + public partial struct SqlBinary : System.Data.SqlTypes.INullable, System.IComparable, System.Xml.Serialization.IXmlSerializable, System.IEquatable { private object _dummy; private int _dummyPrimitive; @@ -2752,6 +2752,7 @@ public partial struct SqlBinary : System.Data.SqlTypes.INullable, System.ICompar public int CompareTo(object? value) { throw null; } public static System.Data.SqlTypes.SqlBinary Concat(System.Data.SqlTypes.SqlBinary x, System.Data.SqlTypes.SqlBinary y) { throw null; } public static System.Data.SqlTypes.SqlBoolean Equals(System.Data.SqlTypes.SqlBinary x, System.Data.SqlTypes.SqlBinary y) { throw null; } + public bool Equals(System.Data.SqlTypes.SqlBinary other) { throw null; } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; } public override int GetHashCode() { throw null; } public static System.Xml.XmlQualifiedName GetXsdType(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; } @@ -2777,7 +2778,7 @@ void System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter wri public override string ToString() { throw null; } } [System.Xml.Serialization.XmlSchemaProviderAttribute("GetXsdType")] - public partial struct SqlBoolean : System.Data.SqlTypes.INullable, System.IComparable, System.Xml.Serialization.IXmlSerializable + public partial struct SqlBoolean : System.Data.SqlTypes.INullable, System.IComparable, System.Xml.Serialization.IXmlSerializable, System.IEquatable { private int _dummyPrimitive; public static readonly System.Data.SqlTypes.SqlBoolean False; @@ -2796,6 +2797,7 @@ public partial struct SqlBoolean : System.Data.SqlTypes.INullable, System.ICompa public int CompareTo(System.Data.SqlTypes.SqlBoolean value) { throw null; } public int CompareTo(object? value) { throw null; } public static System.Data.SqlTypes.SqlBoolean Equals(System.Data.SqlTypes.SqlBoolean x, System.Data.SqlTypes.SqlBoolean y) { throw null; } + public bool Equals(System.Data.SqlTypes.SqlBoolean other) { throw null; } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; } public override int GetHashCode() { throw null; } public static System.Xml.XmlQualifiedName GetXsdType(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; } @@ -2847,7 +2849,7 @@ void System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter wri public static System.Data.SqlTypes.SqlBoolean Xor(System.Data.SqlTypes.SqlBoolean x, System.Data.SqlTypes.SqlBoolean y) { throw null; } } [System.Xml.Serialization.XmlSchemaProviderAttribute("GetXsdType")] - public partial struct SqlByte : System.Data.SqlTypes.INullable, System.IComparable, System.Xml.Serialization.IXmlSerializable + public partial struct SqlByte : System.Data.SqlTypes.INullable, System.IComparable, System.Xml.Serialization.IXmlSerializable, System.IEquatable { private int _dummyPrimitive; public static readonly System.Data.SqlTypes.SqlByte MaxValue; @@ -2864,6 +2866,7 @@ public partial struct SqlByte : System.Data.SqlTypes.INullable, System.IComparab public int CompareTo(object? value) { throw null; } public static System.Data.SqlTypes.SqlByte Divide(System.Data.SqlTypes.SqlByte x, System.Data.SqlTypes.SqlByte y) { throw null; } public static System.Data.SqlTypes.SqlBoolean Equals(System.Data.SqlTypes.SqlByte x, System.Data.SqlTypes.SqlByte y) { throw null; } + public bool Equals(System.Data.SqlTypes.SqlByte other) { throw null; } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; } public override int GetHashCode() { throw null; } public static System.Xml.XmlQualifiedName GetXsdType(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; } @@ -2987,7 +2990,7 @@ public enum SqlCompareOptions BinarySort = 32768, } [System.Xml.Serialization.XmlSchemaProviderAttribute("GetXsdType")] - public partial struct SqlDateTime : System.Data.SqlTypes.INullable, System.IComparable, System.Xml.Serialization.IXmlSerializable + public partial struct SqlDateTime : System.Data.SqlTypes.INullable, System.IComparable, System.Xml.Serialization.IXmlSerializable, System.IEquatable { private int _dummyPrimitive; public static readonly System.Data.SqlTypes.SqlDateTime MaxValue; @@ -3010,6 +3013,7 @@ public partial struct SqlDateTime : System.Data.SqlTypes.INullable, System.IComp public int CompareTo(System.Data.SqlTypes.SqlDateTime value) { throw null; } public int CompareTo(object? value) { throw null; } public static System.Data.SqlTypes.SqlBoolean Equals(System.Data.SqlTypes.SqlDateTime x, System.Data.SqlTypes.SqlDateTime y) { throw null; } + public bool Equals(System.Data.SqlTypes.SqlDateTime other) { throw null; } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; } public override int GetHashCode() { throw null; } public static System.Xml.XmlQualifiedName GetXsdType(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; } @@ -3038,7 +3042,7 @@ void System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter wri public override string ToString() { throw null; } } [System.Xml.Serialization.XmlSchemaProviderAttribute("GetXsdType")] - public partial struct SqlDecimal : System.Data.SqlTypes.INullable, System.IComparable, System.Xml.Serialization.IXmlSerializable + public partial struct SqlDecimal : System.Data.SqlTypes.INullable, System.IComparable, System.Xml.Serialization.IXmlSerializable, System.IEquatable { private int _dummyPrimitive; public static readonly byte MaxPrecision; @@ -3068,6 +3072,7 @@ public partial struct SqlDecimal : System.Data.SqlTypes.INullable, System.ICompa public static System.Data.SqlTypes.SqlDecimal ConvertToPrecScale(System.Data.SqlTypes.SqlDecimal n, int precision, int scale) { throw null; } public static System.Data.SqlTypes.SqlDecimal Divide(System.Data.SqlTypes.SqlDecimal x, System.Data.SqlTypes.SqlDecimal y) { throw null; } public static System.Data.SqlTypes.SqlBoolean Equals(System.Data.SqlTypes.SqlDecimal x, System.Data.SqlTypes.SqlDecimal y) { throw null; } + public bool Equals(System.Data.SqlTypes.SqlDecimal other) { throw null; } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; } public static System.Data.SqlTypes.SqlDecimal Floor(System.Data.SqlTypes.SqlDecimal n) { throw null; } public override int GetHashCode() { throw null; } @@ -3124,7 +3129,7 @@ void System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter wri public static System.Data.SqlTypes.SqlDecimal Truncate(System.Data.SqlTypes.SqlDecimal n, int position) { throw null; } } [System.Xml.Serialization.XmlSchemaProviderAttribute("GetXsdType")] - public partial struct SqlDouble : System.Data.SqlTypes.INullable, System.IComparable, System.Xml.Serialization.IXmlSerializable + public partial struct SqlDouble : System.Data.SqlTypes.INullable, System.IComparable, System.Xml.Serialization.IXmlSerializable, System.IEquatable { private int _dummyPrimitive; public static readonly System.Data.SqlTypes.SqlDouble MaxValue; @@ -3139,6 +3144,7 @@ public partial struct SqlDouble : System.Data.SqlTypes.INullable, System.ICompar public int CompareTo(object? value) { throw null; } public static System.Data.SqlTypes.SqlDouble Divide(System.Data.SqlTypes.SqlDouble x, System.Data.SqlTypes.SqlDouble y) { throw null; } public static System.Data.SqlTypes.SqlBoolean Equals(System.Data.SqlTypes.SqlDouble x, System.Data.SqlTypes.SqlDouble y) { throw null; } + public bool Equals(System.Data.SqlTypes.SqlDouble other) { throw null; } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; } public override int GetHashCode() { throw null; } public static System.Xml.XmlQualifiedName GetXsdType(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; } @@ -3187,7 +3193,7 @@ void System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter wri public override string ToString() { throw null; } } [System.Xml.Serialization.XmlSchemaProviderAttribute("GetXsdType")] - public partial struct SqlGuid : System.Data.SqlTypes.INullable, System.IComparable, System.Xml.Serialization.IXmlSerializable + public partial struct SqlGuid : System.Data.SqlTypes.INullable, System.IComparable, System.Xml.Serialization.IXmlSerializable, System.IEquatable { private object _dummy; private int _dummyPrimitive; @@ -3201,6 +3207,7 @@ public partial struct SqlGuid : System.Data.SqlTypes.INullable, System.IComparab public int CompareTo(System.Data.SqlTypes.SqlGuid value) { throw null; } public int CompareTo(object? value) { throw null; } public static System.Data.SqlTypes.SqlBoolean Equals(System.Data.SqlTypes.SqlGuid x, System.Data.SqlTypes.SqlGuid y) { throw null; } + public bool Equals(System.Data.SqlTypes.SqlGuid other) { throw null; } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; } public override int GetHashCode() { throw null; } public static System.Xml.XmlQualifiedName GetXsdType(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; } @@ -3229,7 +3236,7 @@ void System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter wri public override string ToString() { throw null; } } [System.Xml.Serialization.XmlSchemaProviderAttribute("GetXsdType")] - public partial struct SqlInt16 : System.Data.SqlTypes.INullable, System.IComparable, System.Xml.Serialization.IXmlSerializable + public partial struct SqlInt16 : System.Data.SqlTypes.INullable, System.IComparable, System.Xml.Serialization.IXmlSerializable, System.IEquatable { private int _dummyPrimitive; public static readonly System.Data.SqlTypes.SqlInt16 MaxValue; @@ -3246,6 +3253,7 @@ public partial struct SqlInt16 : System.Data.SqlTypes.INullable, System.ICompara public int CompareTo(object? value) { throw null; } public static System.Data.SqlTypes.SqlInt16 Divide(System.Data.SqlTypes.SqlInt16 x, System.Data.SqlTypes.SqlInt16 y) { throw null; } public static System.Data.SqlTypes.SqlBoolean Equals(System.Data.SqlTypes.SqlInt16 x, System.Data.SqlTypes.SqlInt16 y) { throw null; } + public bool Equals(System.Data.SqlTypes.SqlInt16 other) { throw null; } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; } public override int GetHashCode() { throw null; } public static System.Xml.XmlQualifiedName GetXsdType(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; } @@ -3303,7 +3311,7 @@ void System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter wri public static System.Data.SqlTypes.SqlInt16 Xor(System.Data.SqlTypes.SqlInt16 x, System.Data.SqlTypes.SqlInt16 y) { throw null; } } [System.Xml.Serialization.XmlSchemaProviderAttribute("GetXsdType")] - public partial struct SqlInt32 : System.Data.SqlTypes.INullable, System.IComparable, System.Xml.Serialization.IXmlSerializable + public partial struct SqlInt32 : System.Data.SqlTypes.INullable, System.IComparable, System.Xml.Serialization.IXmlSerializable, System.IEquatable { private int _dummyPrimitive; public static readonly System.Data.SqlTypes.SqlInt32 MaxValue; @@ -3320,6 +3328,7 @@ public partial struct SqlInt32 : System.Data.SqlTypes.INullable, System.ICompara public int CompareTo(object? value) { throw null; } public static System.Data.SqlTypes.SqlInt32 Divide(System.Data.SqlTypes.SqlInt32 x, System.Data.SqlTypes.SqlInt32 y) { throw null; } public static System.Data.SqlTypes.SqlBoolean Equals(System.Data.SqlTypes.SqlInt32 x, System.Data.SqlTypes.SqlInt32 y) { throw null; } + public bool Equals(System.Data.SqlTypes.SqlInt32 other) { throw null; } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; } public override int GetHashCode() { throw null; } public static System.Xml.XmlQualifiedName GetXsdType(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; } @@ -3377,7 +3386,7 @@ void System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter wri public static System.Data.SqlTypes.SqlInt32 Xor(System.Data.SqlTypes.SqlInt32 x, System.Data.SqlTypes.SqlInt32 y) { throw null; } } [System.Xml.Serialization.XmlSchemaProviderAttribute("GetXsdType")] - public partial struct SqlInt64 : System.Data.SqlTypes.INullable, System.IComparable, System.Xml.Serialization.IXmlSerializable + public partial struct SqlInt64 : System.Data.SqlTypes.INullable, System.IComparable, System.Xml.Serialization.IXmlSerializable, System.IEquatable { private int _dummyPrimitive; public static readonly System.Data.SqlTypes.SqlInt64 MaxValue; @@ -3394,6 +3403,7 @@ public partial struct SqlInt64 : System.Data.SqlTypes.INullable, System.ICompara public int CompareTo(object? value) { throw null; } public static System.Data.SqlTypes.SqlInt64 Divide(System.Data.SqlTypes.SqlInt64 x, System.Data.SqlTypes.SqlInt64 y) { throw null; } public static System.Data.SqlTypes.SqlBoolean Equals(System.Data.SqlTypes.SqlInt64 x, System.Data.SqlTypes.SqlInt64 y) { throw null; } + public bool Equals(System.Data.SqlTypes.SqlInt64 other) { throw null; } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; } public override int GetHashCode() { throw null; } public static System.Xml.XmlQualifiedName GetXsdType(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; } @@ -3451,7 +3461,7 @@ void System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter wri public static System.Data.SqlTypes.SqlInt64 Xor(System.Data.SqlTypes.SqlInt64 x, System.Data.SqlTypes.SqlInt64 y) { throw null; } } [System.Xml.Serialization.XmlSchemaProviderAttribute("GetXsdType")] - public partial struct SqlMoney : System.Data.SqlTypes.INullable, System.IComparable, System.Xml.Serialization.IXmlSerializable + public partial struct SqlMoney : System.Data.SqlTypes.INullable, System.IComparable, System.Xml.Serialization.IXmlSerializable, System.IEquatable { private int _dummyPrimitive; public static readonly System.Data.SqlTypes.SqlMoney MaxValue; @@ -3469,6 +3479,7 @@ public partial struct SqlMoney : System.Data.SqlTypes.INullable, System.ICompara public int CompareTo(object? value) { throw null; } public static System.Data.SqlTypes.SqlMoney Divide(System.Data.SqlTypes.SqlMoney x, System.Data.SqlTypes.SqlMoney y) { throw null; } public static System.Data.SqlTypes.SqlBoolean Equals(System.Data.SqlTypes.SqlMoney x, System.Data.SqlTypes.SqlMoney y) { throw null; } + public bool Equals(System.Data.SqlTypes.SqlMoney other) { throw null; } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; } public override int GetHashCode() { throw null; } public static System.Xml.XmlQualifiedName GetXsdType(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; } @@ -3535,7 +3546,7 @@ public SqlNullValueException(string? message) { } public SqlNullValueException(string? message, System.Exception? e) { } } [System.Xml.Serialization.XmlSchemaProviderAttribute("GetXsdType")] - public partial struct SqlSingle : System.Data.SqlTypes.INullable, System.IComparable, System.Xml.Serialization.IXmlSerializable + public partial struct SqlSingle : System.Data.SqlTypes.INullable, System.IComparable, System.Xml.Serialization.IXmlSerializable, System.IEquatable { private int _dummyPrimitive; public static readonly System.Data.SqlTypes.SqlSingle MaxValue; @@ -3551,6 +3562,7 @@ public partial struct SqlSingle : System.Data.SqlTypes.INullable, System.ICompar public int CompareTo(object? value) { throw null; } public static System.Data.SqlTypes.SqlSingle Divide(System.Data.SqlTypes.SqlSingle x, System.Data.SqlTypes.SqlSingle y) { throw null; } public static System.Data.SqlTypes.SqlBoolean Equals(System.Data.SqlTypes.SqlSingle x, System.Data.SqlTypes.SqlSingle y) { throw null; } + public bool Equals(System.Data.SqlTypes.SqlSingle other) { throw null; } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; } public override int GetHashCode() { throw null; } public static System.Xml.XmlQualifiedName GetXsdType(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; } @@ -3599,7 +3611,7 @@ void System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter wri public override string ToString() { throw null; } } [System.Xml.Serialization.XmlSchemaProviderAttribute("GetXsdType")] - public partial struct SqlString : System.Data.SqlTypes.INullable, System.IComparable, System.Xml.Serialization.IXmlSerializable + public partial struct SqlString : System.Data.SqlTypes.INullable, System.IComparable, System.Xml.Serialization.IXmlSerializable, System.IEquatable { private object _dummy; private int _dummyPrimitive; @@ -3630,6 +3642,7 @@ public partial struct SqlString : System.Data.SqlTypes.INullable, System.ICompar public int CompareTo(object? value) { throw null; } public static System.Data.SqlTypes.SqlString Concat(System.Data.SqlTypes.SqlString x, System.Data.SqlTypes.SqlString y) { throw null; } public static System.Data.SqlTypes.SqlBoolean Equals(System.Data.SqlTypes.SqlString x, System.Data.SqlTypes.SqlString y) { throw null; } + public bool Equals(System.Data.SqlTypes.SqlString other) { throw null; } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; } public override int GetHashCode() { throw null; } public byte[]? GetNonUnicodeBytes() { throw null; } diff --git a/src/libraries/System.Data.Common/src/System/Data/DataKey.cs b/src/libraries/System.Data.Common/src/System/Data/DataKey.cs index 379035bb75d6b3..7f1a15f75f51b7 100644 --- a/src/libraries/System.Data.Common/src/System/Data/DataKey.cs +++ b/src/libraries/System.Data.Common/src/System/Data/DataKey.cs @@ -5,7 +5,7 @@ namespace System.Data { - internal readonly struct DataKey + internal readonly struct DataKey : IEquatable { private const int maxColumns = 32; @@ -154,7 +154,7 @@ public override bool Equals(object? value) return Equals((DataKey)value); } - internal bool Equals(DataKey value) + public bool Equals(DataKey value) { //check to see if this.columns && key2's columns are equal... DataColumn[] column1 = _columns; diff --git a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLBinary.cs b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLBinary.cs index a757be446e73a7..f6a45dbba5f2cb 100644 --- a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLBinary.cs +++ b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLBinary.cs @@ -12,7 +12,7 @@ namespace System.Data.SqlTypes { [XmlSchemaProvider("GetXsdType")] - public struct SqlBinary : INullable, IComparable, IXmlSerializable + public struct SqlBinary : INullable, IComparable, IXmlSerializable, IEquatable { // NOTE: If any instance fields change, update SqlTypeWorkarounds type in System.Data.SqlClient. private byte[]? _value; @@ -362,20 +362,15 @@ public int CompareTo(SqlBinary value) } // Compares this instance with a specified object - public override bool Equals([NotNullWhen(true)] object? value) - { - if (!(value is SqlBinary)) - { - return false; - } - - SqlBinary i = (SqlBinary)value; - - if (i.IsNull || IsNull) - return (i.IsNull && IsNull); - else - return (this == i).Value; - } + public override bool Equals([NotNullWhen(true)] object? value) => + value is SqlBinary other && Equals(other); + + /// Indicates whether the current instance is equal to another instance of the same type. + /// An instance to compare with this instance. + /// true if the current instance is equal to the other instance; otherwise, false. + public bool Equals(SqlBinary other) => + other.IsNull || IsNull ? other.IsNull && IsNull : + (this == other).Value; // Hash a byte array. // Trailing zeroes/spaces would affect the hash value, so caller needs to diff --git a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLBoolean.cs b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLBoolean.cs index 1efff18021e52b..d7b723f9f05f01 100644 --- a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLBoolean.cs +++ b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLBoolean.cs @@ -18,7 +18,7 @@ namespace System.Data.SqlTypes [StructLayout(LayoutKind.Sequential)] [XmlSchemaProvider("GetXsdType")] [System.Runtime.CompilerServices.TypeForwardedFrom("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] - public struct SqlBoolean : INullable, IComparable, IXmlSerializable + public struct SqlBoolean : INullable, IComparable, IXmlSerializable, IEquatable { // m_value: 2 (true), 1 (false), 0 (unknown/Null) private byte m_value; // Do not rename (binary serialization) @@ -465,26 +465,18 @@ public int CompareTo(SqlBoolean value) } // Compares this instance with a specified object - public override bool Equals([NotNullWhen(true)] object? value) - { - if (!(value is SqlBoolean)) - { - return false; - } - - SqlBoolean i = (SqlBoolean)value; + public override bool Equals([NotNullWhen(true)] object? value) => + value is SqlBoolean other && Equals(other); - if (i.IsNull || IsNull) - return (i.IsNull && IsNull); - else - return (this == i).Value; - } + /// Indicates whether the current instance is equal to another instance of the same type. + /// An instance to compare with this instance. + /// true if the current instance is equal to the other instance; otherwise, false. + public bool Equals(SqlBoolean other) => + other.IsNull || IsNull ? other.IsNull && IsNull : + (this == other).Value; // For hashing purpose - public override int GetHashCode() - { - return IsNull ? 0 : Value.GetHashCode(); - } + public override int GetHashCode() => IsNull ? 0 : Value.GetHashCode(); XmlSchema? IXmlSerializable.GetSchema() { return null; } diff --git a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLByte.cs b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLByte.cs index f7c1cdde432260..3dc5548ffed7a3 100644 --- a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLByte.cs +++ b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLByte.cs @@ -18,7 +18,7 @@ namespace System.Data.SqlTypes [StructLayout(LayoutKind.Sequential)] [XmlSchemaProvider("GetXsdType")] [System.Runtime.CompilerServices.TypeForwardedFrom("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] - public struct SqlByte : INullable, IComparable, IXmlSerializable + public struct SqlByte : INullable, IComparable, IXmlSerializable, IEquatable { private bool m_fNotNull; // false if null. Do not rename (binary serialization) private byte m_value; // Do not rename (binary serialization) @@ -474,26 +474,18 @@ public int CompareTo(SqlByte value) } // Compares this instance with a specified object - public override bool Equals([NotNullWhen(true)] object? value) - { - if (!(value is SqlByte)) - { - return false; - } - - SqlByte i = (SqlByte)value; + public override bool Equals([NotNullWhen(true)] object? value) => + value is SqlByte other && Equals(other); - if (i.IsNull || IsNull) - return (i.IsNull && IsNull); - else - return (this == i).Value; - } + /// Indicates whether the current instance is equal to another instance of the same type. + /// An instance to compare with this instance. + /// true if the current instance is equal to the other instance; otherwise, false. + public bool Equals(SqlByte other) => + other.IsNull || IsNull ? other.IsNull && IsNull : + (this == other).Value; // For hashing purpose - public override int GetHashCode() - { - return IsNull ? 0 : Value.GetHashCode(); - } + public override int GetHashCode() => IsNull ? 0 : Value.GetHashCode(); XmlSchema? IXmlSerializable.GetSchema() { return null; } diff --git a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLDateTime.cs b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLDateTime.cs index 195ca26628ea40..1edd44bedf3388 100644 --- a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLDateTime.cs +++ b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLDateTime.cs @@ -21,7 +21,7 @@ namespace System.Data.SqlTypes [StructLayout(LayoutKind.Sequential)] [XmlSchemaProvider("GetXsdType")] [System.Runtime.CompilerServices.TypeForwardedFrom("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] - public struct SqlDateTime : INullable, IComparable, IXmlSerializable + public struct SqlDateTime : INullable, IComparable, IXmlSerializable, IEquatable { private bool m_fNotNull; // false if null. Do not rename (binary serialization) private int m_day; // Day from 1900/1/1, could be negative. Range: Jan 1 1753 - Dec 31 9999. Do not rename (binary serialization) @@ -621,26 +621,18 @@ public int CompareTo(SqlDateTime value) } // Compares this instance with a specified object - public override bool Equals([NotNullWhen(true)] object? value) - { - if (!(value is SqlDateTime)) - { - return false; - } - - SqlDateTime i = (SqlDateTime)value; + public override bool Equals([NotNullWhen(true)] object? value) => + value is SqlDateTime other && Equals(other); - if (i.IsNull || IsNull) - return (i.IsNull && IsNull); - else - return (this == i).Value; - } + /// Indicates whether the current instance is equal to another instance of the same type. + /// An instance to compare with this instance. + /// true if the current instance is equal to the other instance; otherwise, false. + public bool Equals(SqlDateTime other) => + other.IsNull || IsNull ? other.IsNull && IsNull : + (this == other).Value; // For hashing purpose - public override int GetHashCode() - { - return IsNull ? 0 : Value.GetHashCode(); - } + public override int GetHashCode() => IsNull ? 0 : Value.GetHashCode(); XmlSchema? IXmlSerializable.GetSchema() { return null; } diff --git a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLDecimal.cs b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLDecimal.cs index 784d50d2bb1cfc..336639fbf0e5b4 100644 --- a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLDecimal.cs +++ b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLDecimal.cs @@ -18,7 +18,7 @@ namespace System.Data.SqlTypes ///
[StructLayout(LayoutKind.Sequential)] [XmlSchemaProvider("GetXsdType")] - public struct SqlDecimal : INullable, IComparable, IXmlSerializable + public struct SqlDecimal : INullable, IComparable, IXmlSerializable, IEquatable { // data in CSsNumeric in SQL Server // BYTE m_cbLen; // # of DWORDs + 1 (1 is for sign) @@ -3278,20 +3278,15 @@ public int CompareTo(SqlDecimal value) } // Compares this instance with a specified object - public override bool Equals([NotNullWhen(true)] object? value) - { - if (!(value is SqlDecimal)) - { - return false; - } - - SqlDecimal i = (SqlDecimal)value; - - if (i.IsNull || IsNull) - return (i.IsNull && IsNull); - else - return (this == i).Value; - } + public override bool Equals([NotNullWhen(true)] object? value) => + value is SqlDecimal other && Equals(other); + + /// Indicates whether the current instance is equal to another instance of the same type. + /// An instance to compare with this instance. + /// true if the current instance is equal to the other instance; otherwise, false. + public bool Equals(SqlDecimal other) => + other.IsNull || IsNull ? other.IsNull && IsNull : + (this == other).Value; // For hashing purpose public override int GetHashCode() diff --git a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLDouble.cs b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLDouble.cs index 3f10f943124002..4cc9ac4e321e0e 100644 --- a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLDouble.cs +++ b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLDouble.cs @@ -19,7 +19,7 @@ namespace System.Data.SqlTypes [StructLayout(LayoutKind.Sequential)] [XmlSchemaProvider("GetXsdType")] [System.Runtime.CompilerServices.TypeForwardedFrom("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] - public struct SqlDouble : INullable, IComparable, IXmlSerializable + public struct SqlDouble : INullable, IComparable, IXmlSerializable, IEquatable { private bool m_fNotNull; // false if null. Do not rename (binary serialization) private double m_value; // Do not rename (binary serialization) @@ -390,26 +390,18 @@ public int CompareTo(SqlDouble value) } // Compares this instance with a specified object - public override bool Equals([NotNullWhen(true)] object? value) - { - if (!(value is SqlDouble)) - { - return false; - } - - SqlDouble i = (SqlDouble)value; + public override bool Equals([NotNullWhen(true)] object? value) => + value is SqlDouble other && Equals(other); - if (i.IsNull || IsNull) - return (i.IsNull && IsNull); - else - return (this == i).Value; - } + /// Indicates whether the current instance is equal to another instance of the same type. + /// An instance to compare with this instance. + /// true if the current instance is equal to the other instance; otherwise, false. + public bool Equals(SqlDouble other) => + other.IsNull || IsNull ? other.IsNull && IsNull : + (this == other).Value; // For hashing purpose - public override int GetHashCode() - { - return IsNull ? 0 : Value.GetHashCode(); - } + public override int GetHashCode() => IsNull ? 0 : Value.GetHashCode(); XmlSchema? IXmlSerializable.GetSchema() { return null; } diff --git a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLGuid.cs b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLGuid.cs index 8e3c58dff3dadf..2742c25d53b53a 100644 --- a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLGuid.cs +++ b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLGuid.cs @@ -16,7 +16,7 @@ namespace System.Data.SqlTypes [Serializable] [XmlSchemaProvider("GetXsdType")] [System.Runtime.CompilerServices.TypeForwardedFrom("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] - public struct SqlGuid : INullable, IComparable, IXmlSerializable + public struct SqlGuid : INullable, IComparable, IXmlSerializable, IEquatable { private const int SizeOfGuid = 16; @@ -281,26 +281,18 @@ public int CompareTo(SqlGuid value) } // Compares this instance with a specified object - public override bool Equals([NotNullWhen(true)] object? value) - { - if (!(value is SqlGuid)) - { - return false; - } - - SqlGuid i = (SqlGuid)value; + public override bool Equals([NotNullWhen(true)] object? value) => + value is SqlGuid other && Equals(other); - if (i.IsNull || IsNull) - return (i.IsNull && IsNull); - else - return (this == i).Value; - } + /// Indicates whether the current instance is equal to another instance of the same type. + /// An instance to compare with this instance. + /// true if the current instance is equal to the other instance; otherwise, false. + public bool Equals(SqlGuid other) => + other.IsNull || IsNull ? other.IsNull && IsNull : + (this == other).Value; // For hashing purpose - public override int GetHashCode() - { - return IsNull ? 0 : Value.GetHashCode(); - } + public override int GetHashCode() => IsNull ? 0 : Value.GetHashCode(); XmlSchema? IXmlSerializable.GetSchema() { return null; } diff --git a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLInt16.cs b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLInt16.cs index 5833a009385612..d3879a06cf91b2 100644 --- a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLInt16.cs +++ b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLInt16.cs @@ -17,7 +17,7 @@ namespace System.Data.SqlTypes [StructLayout(LayoutKind.Sequential)] [XmlSchemaProvider("GetXsdType")] [System.Runtime.CompilerServices.TypeForwardedFrom("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] - public struct SqlInt16 : INullable, IComparable, IXmlSerializable + public struct SqlInt16 : INullable, IComparable, IXmlSerializable, IEquatable { private bool m_fNotNull; // false if null. Do not rename (binary serialization) private short m_value; // Do not rename (binary serialization) @@ -475,26 +475,18 @@ public int CompareTo(SqlInt16 value) } // Compares this instance with a specified object - public override bool Equals([NotNullWhen(true)] object? value) - { - if (!(value is SqlInt16)) - { - return false; - } - - SqlInt16 i = (SqlInt16)value; + public override bool Equals([NotNullWhen(true)] object? value) => + value is SqlInt16 other && Equals(other); - if (i.IsNull || IsNull) - return (i.IsNull && IsNull); - else - return (this == i).Value; - } + /// Indicates whether the current instance is equal to another instance of the same type. + /// An instance to compare with this instance. + /// true if the current instance is equal to the other instance; otherwise, false. + public bool Equals(SqlInt16 other) => + other.IsNull || IsNull ? other.IsNull && IsNull : + (this == other).Value; // For hashing purpose - public override int GetHashCode() - { - return IsNull ? 0 : Value.GetHashCode(); - } + public override int GetHashCode() => IsNull ? 0 : Value.GetHashCode(); XmlSchema? IXmlSerializable.GetSchema() { return null; } diff --git a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLInt32.cs b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLInt32.cs index 271d6509e71f58..8ce08e74e4403e 100644 --- a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLInt32.cs +++ b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLInt32.cs @@ -17,7 +17,7 @@ namespace System.Data.SqlTypes [StructLayout(LayoutKind.Sequential)] [XmlSchemaProvider("GetXsdType")] [System.Runtime.CompilerServices.TypeForwardedFrom("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] - public struct SqlInt32 : INullable, IComparable, IXmlSerializable + public struct SqlInt32 : INullable, IComparable, IXmlSerializable, IEquatable { private bool m_fNotNull; // false if null, the default ctor (plain 0) will make it Null. Do not rename (binary serialization) private int m_value; // Do not rename (binary serialization) @@ -490,26 +490,18 @@ public int CompareTo(SqlInt32 value) } // Compares this instance with a specified object - public override bool Equals([NotNullWhen(true)] object? value) - { - if (!(value is SqlInt32)) - { - return false; - } - - SqlInt32 i = (SqlInt32)value; + public override bool Equals([NotNullWhen(true)] object? value) => + value is SqlInt32 other && Equals(other); - if (i.IsNull || IsNull) - return (i.IsNull && IsNull); - else - return (this == i).Value; - } + /// Indicates whether the current instance is equal to another instance of the same type. + /// An instance to compare with this instance. + /// true if the current instance is equal to the other instance; otherwise, false. + public bool Equals(SqlInt32 other) => + other.IsNull || IsNull ? other.IsNull && IsNull : + (this == other).Value; // For hashing purpose - public override int GetHashCode() - { - return IsNull ? 0 : Value.GetHashCode(); - } + public override int GetHashCode() => IsNull ? 0 : Value.GetHashCode(); XmlSchema? IXmlSerializable.GetSchema() { return null; } diff --git a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLInt64.cs b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLInt64.cs index b7f33674ce03a8..393945b0303957 100644 --- a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLInt64.cs +++ b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLInt64.cs @@ -18,7 +18,7 @@ namespace System.Data.SqlTypes [StructLayout(LayoutKind.Sequential)] [XmlSchemaProvider("GetXsdType")] [System.Runtime.CompilerServices.TypeForwardedFrom("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] - public struct SqlInt64 : INullable, IComparable, IXmlSerializable + public struct SqlInt64 : INullable, IComparable, IXmlSerializable, IEquatable { private bool m_fNotNull; // false if null. Do not rename (binary serialization) private long m_value; // Do not rename (binary serialization) @@ -549,26 +549,18 @@ public int CompareTo(SqlInt64 value) } // Compares this instance with a specified object - public override bool Equals([NotNullWhen(true)] object? value) - { - if (!(value is SqlInt64)) - { - return false; - } - - SqlInt64 i = (SqlInt64)value; + public override bool Equals([NotNullWhen(true)] object? value) => + value is SqlInt64 other && Equals(other); - if (i.IsNull || IsNull) - return (i.IsNull && IsNull); - else - return (this == i).Value; - } + /// Indicates whether the current instance is equal to another instance of the same type. + /// An instance to compare with this instance. + /// true if the current instance is equal to the other instance; otherwise, false. + public bool Equals(SqlInt64 other) => + other.IsNull || IsNull ? other.IsNull && IsNull : + (this == other).Value; // For hashing purpose - public override int GetHashCode() - { - return IsNull ? 0 : Value.GetHashCode(); - } + public override int GetHashCode() => IsNull ? 0 : Value.GetHashCode(); XmlSchema? IXmlSerializable.GetSchema() { return null; } diff --git a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLMoney.cs b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLMoney.cs index 5431c8737d4aff..64c0d168631c86 100644 --- a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLMoney.cs +++ b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLMoney.cs @@ -21,7 +21,7 @@ namespace System.Data.SqlTypes ///
[StructLayout(LayoutKind.Sequential)] [XmlSchemaProvider("GetXsdType")] - public struct SqlMoney : INullable, IComparable, IXmlSerializable + public struct SqlMoney : INullable, IComparable, IXmlSerializable, IEquatable { // NOTE: If any instance fields change, update SqlTypeWorkarounds type in System.Data.SqlClient. private bool _fNotNull; // false if null @@ -539,27 +539,20 @@ public int CompareTo(SqlMoney value) } // Compares this instance with a specified object - public override bool Equals([NotNullWhen(true)] object? value) - { - if (!(value is SqlMoney)) - { - return false; - } - - SqlMoney i = (SqlMoney)value; + public override bool Equals([NotNullWhen(true)] object? value) => + value is SqlMoney other && Equals(other); - if (i.IsNull || IsNull) - return (i.IsNull && IsNull); - else - return (this == i).Value; - } + /// Indicates whether the current instance is equal to another instance of the same type. + /// An instance to compare with this instance. + /// true if the current instance is equal to the other instance; otherwise, false. + public bool Equals(SqlMoney other) => + other.IsNull || IsNull ? other.IsNull && IsNull : + (this == other).Value; // For hashing purpose - public override int GetHashCode() - { + public override int GetHashCode() => // Don't use Value property, because Value will convert to Decimal, which is not necessary. - return IsNull ? 0 : _value.GetHashCode(); - } + IsNull ? 0 : _value.GetHashCode(); XmlSchema? IXmlSerializable.GetSchema() { return null; } diff --git a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLSingle.cs b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLSingle.cs index 59f29dcc89cbca..5fa7562824e13d 100644 --- a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLSingle.cs +++ b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLSingle.cs @@ -17,7 +17,7 @@ namespace System.Data.SqlTypes /// [StructLayout(LayoutKind.Sequential)] [XmlSchemaProvider("GetXsdType")] - public struct SqlSingle : INullable, IComparable, IXmlSerializable + public struct SqlSingle : INullable, IComparable, IXmlSerializable, IEquatable { private bool _fNotNull; // false if null private float _value; @@ -400,26 +400,18 @@ public int CompareTo(SqlSingle value) } // Compares this instance with a specified object - public override bool Equals([NotNullWhen(true)] object? value) - { - if (!(value is SqlSingle)) - { - return false; - } - - SqlSingle i = (SqlSingle)value; + public override bool Equals([NotNullWhen(true)] object? value) => + value is SqlSingle other && Equals(other); - if (i.IsNull || IsNull) - return (i.IsNull && IsNull); - else - return (this == i).Value; - } + /// Indicates whether the current instance is equal to another instance of the same type. + /// An instance to compare with this instance. + /// true if the current instance is equal to the other instance; otherwise, false. + public bool Equals(SqlSingle other) => + other.IsNull || IsNull ? other.IsNull && IsNull : + (this == other).Value; // For hashing purpose - public override int GetHashCode() - { - return IsNull ? 0 : Value.GetHashCode(); - } + public override int GetHashCode() => IsNull ? 0 : Value.GetHashCode(); XmlSchema? IXmlSerializable.GetSchema() { return null; } diff --git a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLString.cs b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLString.cs index cac4122feba684..0c22570d2462d2 100644 --- a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLString.cs +++ b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLString.cs @@ -34,7 +34,7 @@ public enum SqlCompareOptions [StructLayout(LayoutKind.Sequential)] [XmlSchemaProvider("GetXsdType")] [System.Runtime.CompilerServices.TypeForwardedFrom("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] - public struct SqlString : INullable, IComparable, IXmlSerializable + public struct SqlString : INullable, IComparable, IXmlSerializable, IEquatable { private string? m_value; // Do not rename (binary serialization) private CompareInfo? m_cmpInfo; // Do not rename (binary serialization) @@ -871,20 +871,15 @@ public int CompareTo(SqlString value) } // Compares this instance with a specified object - public override bool Equals([NotNullWhen(true)] object? value) - { - if (!(value is SqlString)) - { - return false; - } - - SqlString i = (SqlString)value; - - if (i.IsNull || IsNull) - return (i.IsNull && IsNull); - else - return (this == i).Value; - } + public override bool Equals([NotNullWhen(true)] object? value) => + value is SqlString other && Equals(other); + + /// Indicates whether the current instance is equal to another instance of the same type. + /// An instance to compare with this instance. + /// true if the current instance is equal to the other instance; otherwise, false. + public bool Equals(SqlString other) => + other.IsNull || IsNull ? other.IsNull && IsNull : + (this == other).Value; // For hashing purpose public override int GetHashCode() diff --git a/src/libraries/System.Data.Common/src/System/Data/Selection.cs b/src/libraries/System.Data.Common/src/System/Data/Selection.cs index 21a6d951393c19..fd76acfda7c36f 100644 --- a/src/libraries/System.Data.Common/src/System/Data/Selection.cs +++ b/src/libraries/System.Data.Common/src/System/Data/Selection.cs @@ -9,7 +9,7 @@ namespace System.Data { - internal readonly struct IndexField + internal readonly struct IndexField : IEquatable { public readonly DataColumn Column; public readonly bool IsDescending; // false = Asc; true = Desc what is default value for this? @@ -22,15 +22,15 @@ internal IndexField(DataColumn column, bool isDescending) IsDescending = isDescending; } - public static bool operator ==(IndexField if1, IndexField if2) => - if1.Column == if2.Column && if1.IsDescending == if2.IsDescending; + public static bool operator ==(IndexField if1, IndexField if2) => if1.Equals(if2); - public static bool operator !=(IndexField if1, IndexField if2) => !(if1 == if2); + public static bool operator !=(IndexField if1, IndexField if2) => !if1.Equals(if2); // must override Equals if == operator is defined - public override bool Equals([NotNullWhen(true)] object? obj) => obj is IndexField ? - this == (IndexField)obj : - false; + public override bool Equals([NotNullWhen(true)] object? obj) => + obj is IndexField other && Equals(other); + + public bool Equals(IndexField other) => Column == other.Column && IsDescending == other.IsDescending; // must override GetHashCode if Equals is redefined public override int GetHashCode() => diff --git a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlBinaryTest.cs b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlBinaryTest.cs index 6a631b392bea90..8655d3feea0030 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlBinaryTest.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlBinaryTest.cs @@ -122,8 +122,11 @@ public void ComparisonMethods() // Equals Assert.False(_test1.Equals(_test2)); + Assert.False(_test1.Equals((object)_test2)); Assert.False(_test3.Equals(_test2)); + Assert.False(_test3.Equals((object)_test2)); Assert.True(_test3.Equals(_test1)); + Assert.True(_test3.Equals((object)_test1)); // NotEquals Assert.True(SqlBinary.NotEquals(_test1, _test2).Value); diff --git a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlBooleanTest.cs b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlBooleanTest.cs index 4da63a4bcdcf83..b52f671dad2d4b 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlBooleanTest.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlBooleanTest.cs @@ -242,10 +242,14 @@ public void EqualsTest() SqlBoolean sqlFalse2 = new SqlBoolean(false); Assert.True(_sqlTrue.Equals(sqlTrue2)); + Assert.True(_sqlTrue.Equals((object)sqlTrue2)); Assert.True(_sqlFalse.Equals(sqlFalse2)); + Assert.True(_sqlFalse.Equals((object)sqlFalse2)); Assert.False(_sqlTrue.Equals(_sqlFalse)); + Assert.False(_sqlTrue.Equals((object)_sqlFalse)); Assert.False(_sqlFalse.Equals(_sqlTrue)); + Assert.False(_sqlFalse.Equals((object)_sqlTrue)); Assert.False(_sqlTrue.Equals(SqlBoolean.Null)); Assert.False(_sqlFalse.Equals(SqlBoolean.Null)); diff --git a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlByteTest.cs b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlByteTest.cs index 2ae5976e9f1a9e..9af75f4f46997b 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlByteTest.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlByteTest.cs @@ -155,9 +155,12 @@ public void EqualsMethod() SqlByte testByte180II = new SqlByte(180); Assert.False(testByte0.Equals(testByte158)); + Assert.False(testByte0.Equals((object)testByte158)); Assert.False(testByte158.Equals(testByte180)); + Assert.False(testByte158.Equals((object)testByte180)); Assert.False(testByte180.Equals(new SqlString("TEST"))); Assert.True(testByte180.Equals(testByte180II)); + Assert.True(testByte180.Equals((object)testByte180II)); } [Fact] diff --git a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlDateTimeTest.cs b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlDateTimeTest.cs index 6d3287ed49b0fd..0c835ff00c5405 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlDateTimeTest.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlDateTimeTest.cs @@ -175,8 +175,10 @@ public void CompareTo() public void EqualsMethods() { Assert.False(_test1.Equals(_test2)); + Assert.False(_test1.Equals((object)_test2)); Assert.False(_test2.Equals(new SqlString("TEST"))); Assert.True(_test2.Equals(_test3)); + Assert.True(_test2.Equals((object)_test3)); // Static Equals()-method Assert.True(SqlDateTime.Equals(_test2, _test3).Value); diff --git a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlDecimalTest.cs b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlDecimalTest.cs index 6fd72ba4157aaf..b9807ebcc102e2 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlDecimalTest.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlDecimalTest.cs @@ -225,8 +225,10 @@ public void CompareTo() public void EqualsMethods() { Assert.False(_test1.Equals(_test2)); + Assert.False(_test1.Equals((object)_test2)); Assert.False(_test2.Equals(new SqlString("TEST"))); Assert.True(_test2.Equals(_test3)); + Assert.True(_test2.Equals((object)_test3)); // Static Equals()-method Assert.True(SqlDecimal.Equals(_test2, _test2).Value); diff --git a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlDoubleTest.cs b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlDoubleTest.cs index 4f0856e2ba2269..db913271dc0209 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlDoubleTest.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlDoubleTest.cs @@ -134,9 +134,12 @@ public void EqualsMethods() SqlDouble test22 = new SqlDouble(1.8e180); Assert.False(test0.Equals(test1)); + Assert.False(test0.Equals((object)test1)); Assert.False(test1.Equals(test2)); + Assert.False(test1.Equals((object)test2)); Assert.False(test2.Equals(new SqlString("TEST"))); Assert.True(test2.Equals(test22)); + Assert.True(test2.Equals((object)test22)); // Static Equals()-method Assert.True(SqlDouble.Equals(test2, test22).Value); diff --git a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlGuidTest.cs b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlGuidTest.cs index 84dcb3a3f53730..4c21e38d07ef2a 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlGuidTest.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlGuidTest.cs @@ -126,9 +126,12 @@ public void CompareTo() public void EqualsMethods() { Assert.False(_test1.Equals(_test2)); + Assert.False(_test1.Equals((object)_test2)); Assert.False(_test2.Equals(_test4)); + Assert.False(_test2.Equals((object)_test4)); Assert.False(_test2.Equals(new SqlString("TEST"))); Assert.True(_test2.Equals(_test3)); + Assert.True(_test2.Equals((object)_test3)); // Static Equals()-method Assert.True(SqlGuid.Equals(_test2, _test3).Value); diff --git a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlInt16Test.cs b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlInt16Test.cs index 3c240d6d9ed0f1..7c00f4845884de 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlInt16Test.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlInt16Test.cs @@ -157,9 +157,12 @@ public void EqualsMethod() SqlInt16 test180II = new SqlInt16(180); Assert.False(test0.Equals(test158)); + Assert.False(test0.Equals((object)test158)); Assert.False(test158.Equals(test180)); + Assert.False(test158.Equals((object)test180)); Assert.False(test180.Equals(new SqlString("TEST"))); Assert.True(test180.Equals(test180II)); + Assert.True(test180.Equals((object)test180II)); } [Fact] diff --git a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlInt64Test.cs b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlInt64Test.cs index 601b6a8bdb1bcc..ed466fb50b277f 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlInt64Test.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlInt64Test.cs @@ -159,9 +159,12 @@ public void EqualsMethod() SqlInt64 test180II = new SqlInt64(180); Assert.False(test0.Equals(test158)); + Assert.False(test0.Equals((object)test158)); Assert.False(test158.Equals(test180)); + Assert.False(test158.Equals((object)test180)); Assert.False(test180.Equals(new SqlString("TEST"))); Assert.True(test180.Equals(test180II)); + Assert.True(test180.Equals((object)test180II)); } [Fact] diff --git a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlMoneyTest.cs b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlMoneyTest.cs index 726302190b3884..db99ba4de6691c 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlMoneyTest.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlMoneyTest.cs @@ -131,7 +131,9 @@ public void CompareTo() public void EqualsMethods() { Assert.False(_test1.Equals(_test2)); + Assert.False(_test1.Equals((object)_test2)); Assert.True(_test2.Equals(_test3)); + Assert.True(_test2.Equals((object)_test3)); Assert.False(SqlMoney.Equals(_test1, _test2).Value); Assert.True(SqlMoney.Equals(_test3, _test2).Value); } diff --git a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlSingleTest.cs b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlSingleTest.cs index 2c92e08226e490..3ff6c803aaef60 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlSingleTest.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlSingleTest.cs @@ -132,9 +132,12 @@ public void EqualsMethods() SqlSingle test22 = new SqlSingle(1.8e32); Assert.False(test0.Equals(test1)); + Assert.False(test0.Equals((object)test1)); Assert.False(test1.Equals(test2)); + Assert.False(test1.Equals((object)test2)); Assert.False(test2.Equals(new SqlString("TEST"))); Assert.True(test2.Equals(test22)); + Assert.True(test2.Equals((object)test22)); // Static Equals()-method Assert.True(SqlSingle.Equals(test2, test22).Value); diff --git a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlStringTest.cs b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlStringTest.cs index 86a4b1683c4c92..56f8fa51b06ca2 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlStringTest.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlStringTest.cs @@ -262,9 +262,12 @@ public void CompareTo() public void EqualsMethods() { Assert.False(_test1.Equals(_test2)); + Assert.False(_test1.Equals((object)_test2)); Assert.False(_test3.Equals(_test1)); + Assert.False(_test3.Equals((object)_test1)); Assert.False(_test2.Equals(new SqlString("TEST"))); Assert.True(_test2.Equals(_test3)); + Assert.True(_test2.Equals((object)_test3)); // Static Equals()-method Assert.True(SqlString.Equals(_test2, _test3).Value); diff --git a/src/libraries/System.Diagnostics.PerformanceCounter/ref/System.Diagnostics.PerformanceCounter.csproj b/src/libraries/System.Diagnostics.PerformanceCounter/ref/System.Diagnostics.PerformanceCounter.csproj index 9851685566186c..220c3e850b5f1f 100644 --- a/src/libraries/System.Diagnostics.PerformanceCounter/ref/System.Diagnostics.PerformanceCounter.csproj +++ b/src/libraries/System.Diagnostics.PerformanceCounter/ref/System.Diagnostics.PerformanceCounter.csproj @@ -6,6 +6,7 @@ + @@ -18,4 +19,4 @@ - \ No newline at end of file + diff --git a/src/libraries/System.Diagnostics.PerformanceCounter/ref/System.Diagnostics.PerformanceCounter.netcoreapp.cs b/src/libraries/System.Diagnostics.PerformanceCounter/ref/System.Diagnostics.PerformanceCounter.netcoreapp.cs new file mode 100644 index 00000000000000..b33f32066185b1 --- /dev/null +++ b/src/libraries/System.Diagnostics.PerformanceCounter/ref/System.Diagnostics.PerformanceCounter.netcoreapp.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// ------------------------------------------------------------------------------ +// Changes to this file must follow the https://aka.ms/api-review process. +// ------------------------------------------------------------------------------ + +namespace System.Diagnostics +{ + public readonly partial struct CounterSample : System.IEquatable + { + } +} diff --git a/src/libraries/System.Diagnostics.PerformanceCounter/src/System.Diagnostics.PerformanceCounter.csproj b/src/libraries/System.Diagnostics.PerformanceCounter/src/System.Diagnostics.PerformanceCounter.csproj index 28133feec83ed6..5ebf58e40c57e6 100644 --- a/src/libraries/System.Diagnostics.PerformanceCounter/src/System.Diagnostics.PerformanceCounter.csproj +++ b/src/libraries/System.Diagnostics.PerformanceCounter/src/System.Diagnostics.PerformanceCounter.csproj @@ -3,6 +3,7 @@ true $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);$(NetCoreAppMinimum)-windows;$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum) $(NoWarn);CA1847 + $(NoWarn);CA1066 annotations true Provides the System.Diagnostics.PerformanceCounter class, which allows access to Windows performance counters. diff --git a/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/CounterSample.cs b/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/CounterSample.cs index c89df23ed9aac6..315ec5a87ccb47 100644 --- a/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/CounterSample.cs +++ b/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/CounterSample.cs @@ -6,7 +6,7 @@ namespace System.Diagnostics /// /// A struct holding the raw data for a performance counter. /// - public readonly struct CounterSample + public readonly struct CounterSample : IEquatable { private readonly long _rawValue; private readonly long _baseValue; diff --git a/src/libraries/System.Diagnostics.StackTrace/ref/System.Diagnostics.StackTrace.cs b/src/libraries/System.Diagnostics.StackTrace/ref/System.Diagnostics.StackTrace.cs index 0efbf90bb1da10..60e755ecf790c4 100644 --- a/src/libraries/System.Diagnostics.StackTrace/ref/System.Diagnostics.StackTrace.cs +++ b/src/libraries/System.Diagnostics.StackTrace/ref/System.Diagnostics.StackTrace.cs @@ -170,7 +170,7 @@ public enum SymAddressKind BitField = 9, NativeSectionOffset = 10, } - public readonly partial struct SymbolToken + public readonly partial struct SymbolToken : System.IEquatable { private readonly int _dummyPrimitive; public SymbolToken(int val) { throw null; } diff --git a/src/libraries/System.Diagnostics.StackTrace/src/System/Diagnostics/SymbolStore/SymbolToken.cs b/src/libraries/System.Diagnostics.StackTrace/src/System/Diagnostics/SymbolStore/SymbolToken.cs index b6a894f144fc90..8b27f618770fb7 100644 --- a/src/libraries/System.Diagnostics.StackTrace/src/System/Diagnostics/SymbolStore/SymbolToken.cs +++ b/src/libraries/System.Diagnostics.StackTrace/src/System/Diagnostics/SymbolStore/SymbolToken.cs @@ -5,7 +5,7 @@ namespace System.Diagnostics.SymbolStore { - public readonly struct SymbolToken + public readonly struct SymbolToken : IEquatable { private readonly int _token; diff --git a/src/libraries/System.Drawing.Common/ref/System.Drawing.Common.netcoreapp.cs b/src/libraries/System.Drawing.Common/ref/System.Drawing.Common.netcoreapp.cs index f9d987de24d1c1..1514ee19e8c331 100644 --- a/src/libraries/System.Drawing.Common/ref/System.Drawing.Common.netcoreapp.cs +++ b/src/libraries/System.Drawing.Common/ref/System.Drawing.Common.netcoreapp.cs @@ -6,6 +6,10 @@ namespace System.Drawing { + public partial struct CharacterRange : System.IEquatable + { + public bool Equals(System.Drawing.CharacterRange other) { throw null; } + } public sealed partial class Graphics { public void DrawRectangle(System.Drawing.Pen pen, System.Drawing.RectangleF rect) { } diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/CharacterRange.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/CharacterRange.cs index 157533b84283c6..a0dccdc4b28765 100644 --- a/src/libraries/System.Drawing.Common/src/System/Drawing/CharacterRange.cs +++ b/src/libraries/System.Drawing.Common/src/System/Drawing/CharacterRange.cs @@ -7,51 +7,43 @@ namespace System.Drawing { [StructLayout(LayoutKind.Sequential)] - public struct CharacterRange + public struct CharacterRange : IEquatable { private int _first; private int _length; - /// - /// Initializes a new instance of the class with the specified coordinates. - /// + /// Initializes a new instance of the class with the specified coordinates. public CharacterRange(int First, int Length) { _first = First; _length = Length; } - /// - /// Gets the First character position of this . - /// + /// Gets the First character position of this . public int First { get => _first; set => _first = value; } - /// - /// Gets the Length of this . - /// + /// Gets the Length of this . public int Length { get => _length; set => _length = value; } - public override bool Equals([NotNullWhen(true)] object? obj) - { - if (!(obj is CharacterRange cr)) - { - return false; - } + public override bool Equals([NotNullWhen(true)] object? obj) => + obj is CharacterRange other && Equals(other); - return First == cr.First && Length == cr.Length; - } + /// Indicates whether the current instance is equal to another instance of the same type. + /// An instance to compare with this instance. + /// true if the current instance is equal to the other instance; otherwise, false. + public bool Equals(CharacterRange other) => First == other.First && Length == other.Length; public static bool operator ==(CharacterRange cr1, CharacterRange cr2) => cr1.Equals(cr2); - public static bool operator !=(CharacterRange cr1, CharacterRange cr2) => !(cr1 == cr2); + public static bool operator !=(CharacterRange cr1, CharacterRange cr2) => !cr1.Equals(cr2); public override int GetHashCode() => HashCode.Combine(First, Length); } diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/Printing/TriState.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/Printing/TriState.cs index 665a642a3e4f36..bb7b163d1ce958 100644 --- a/src/libraries/System.Drawing.Common/src/System/Drawing/Printing/TriState.cs +++ b/src/libraries/System.Drawing.Common/src/System/Drawing/Printing/TriState.cs @@ -1,9 +1,12 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; + namespace System.Drawing.Printing { - internal readonly partial struct TriState + internal readonly partial struct TriState : IEquatable { private readonly byte _value; // 0 is "default", not false @@ -11,73 +14,46 @@ internal readonly partial struct TriState public static readonly TriState False = new TriState(1); public static readonly TriState True = new TriState(2); - private TriState(byte value) - { - _value = value; - } + private TriState(byte value) => _value = value; - public bool IsDefault - { - get { return this == Default; } - } + public bool IsDefault => this == Default; - public bool IsFalse - { - get { return this == False; } - } + public bool IsFalse => this == False; - public bool IsNotDefault - { - get { return this != Default; } - } + public bool IsNotDefault => this != Default; - public bool IsTrue - { - get { return this == True; } - } + public bool IsTrue => this == True; - public static bool operator ==(TriState left, TriState right) - { - return left._value == right._value; - } + public static bool operator ==(TriState left, TriState right) => left.Equals(right); - public static bool operator !=(TriState left, TriState right) - { - return !(left == right); - } + public static bool operator !=(TriState left, TriState right) => !left.Equals(right); - public override bool Equals(object? o) + public override bool Equals([NotNullWhen(true)] object? o) { - TriState state = (TriState)o!; - return _value == state._value; + Debug.Assert(o is TriState); + return Equals((TriState)o); } - public override int GetHashCode() - { - return _value; - } + public bool Equals(TriState other) => _value == other._value; - public static implicit operator TriState(bool value) - { - return (value) ? True : False; - } + public override int GetHashCode() => _value; + + public static implicit operator TriState(bool value) => value ? True : False; public static explicit operator bool(TriState value) { if (value.IsDefault) + { throw new InvalidCastException(SR.TriStateCompareError); - else - return (value == TriState.True); - } + } - /// - /// Provides some interesting information about the TriState in String form. - /// - public override string ToString() - { - if (this == Default) return "Default"; - else if (this == False) return "False"; - else return "True"; + return (value == TriState.True); } + + /// Provides some interesting information about the TriState in String form. + public override string ToString() => + this == Default ? "Default" : + this == False ? "False" : + "True"; } } diff --git a/src/libraries/System.Drawing.Common/tests/CharacterRangeTests.cs b/src/libraries/System.Drawing.Common/tests/CharacterRangeTests.cs index 7147cb809be6bb..989ee85c093120 100644 --- a/src/libraries/System.Drawing.Common/tests/CharacterRangeTests.cs +++ b/src/libraries/System.Drawing.Common/tests/CharacterRangeTests.cs @@ -84,6 +84,7 @@ public void Equals_Invoke_ReturnsExpected(CharacterRange range, object obj, bool Assert.Equal(expected, range.Equals(obj)); if (obj is CharacterRange otherRange) { + Assert.Equal(expected, range.Equals(otherRange)); Assert.Equal(expected, range == otherRange); Assert.Equal(!expected, range != otherRange); Assert.Equal(expected, range.GetHashCode().Equals(otherRange.GetHashCode())); diff --git a/src/libraries/System.IO.Packaging/src/System/IO/Packaging/PackUriHelper.cs b/src/libraries/System.IO.Packaging/src/System/IO/Packaging/PackUriHelper.cs index 15c89947da327f..5825a149f3315d 100644 --- a/src/libraries/System.IO.Packaging/src/System/IO/Packaging/PackUriHelper.cs +++ b/src/libraries/System.IO.Packaging/src/System/IO/Packaging/PackUriHelper.cs @@ -611,7 +611,9 @@ private static bool IsPartNameEmpty(string partName) /// to reduce the parsing and number of allocations for Strings and Uris /// we cache the results after parsing. /// + #pragma warning disable CA1067 // Override Equals because it implements IEquatable; not overriding to avoid possible regressions in code that's working internal sealed class ValidatedPartUri : Uri, IComparable, IEquatable +#pragma warning restore CA1067 { //------------------------------------------------------ // diff --git a/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/LocalVariables.cs b/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/LocalVariables.cs index d078d82a597f4e..f42254df42dd3e 100644 --- a/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/LocalVariables.cs +++ b/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/LocalVariables.cs @@ -44,7 +44,7 @@ public override string ToString() => string.Create(CultureInfo.InvariantCulture, $"{Index}: {(IsBoxed ? "boxed" : null)} {(InClosure ? "in closure" : null)}"); } - internal readonly struct LocalDefinition + internal readonly struct LocalDefinition : IEquatable { internal LocalDefinition(int localIndex, ParameterExpression parameter) { @@ -53,27 +53,14 @@ internal LocalDefinition(int localIndex, ParameterExpression parameter) } public int Index { get; } + public ParameterExpression Parameter { get; } - public override bool Equals([NotNullWhen(true)] object? obj) - { - if (obj is LocalDefinition) - { - LocalDefinition other = (LocalDefinition)obj; - return other.Index == Index && other.Parameter == Parameter; - } + public override bool Equals([NotNullWhen(true)] object? obj) => obj is LocalDefinition other && Equals(other); - return false; - } + public bool Equals(LocalDefinition other) => other.Index == Index && other.Parameter == Parameter; - public override int GetHashCode() - { - if (Parameter == null) - { - return 0; - } - return Parameter.GetHashCode() ^ Index.GetHashCode(); - } + public override int GetHashCode() => Parameter is null ? 0 : Parameter.GetHashCode() ^ Index.GetHashCode(); } internal sealed class LocalVariables diff --git a/src/libraries/System.Net.Sockets/ref/System.Net.Sockets.cs b/src/libraries/System.Net.Sockets/ref/System.Net.Sockets.cs index 212c063b3b3308..e813cca044ee04 100644 --- a/src/libraries/System.Net.Sockets/ref/System.Net.Sockets.cs +++ b/src/libraries/System.Net.Sockets/ref/System.Net.Sockets.cs @@ -74,13 +74,14 @@ public enum IOControlCode : long [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] AddressListSort = (long)3355443225, } - public partial struct IPPacketInformation + public partial struct IPPacketInformation : System.IEquatable { private object _dummy; private int _dummyPrimitive; public System.Net.IPAddress Address { get { throw null; } } public int Interface { get { throw null; } } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] object? comparand) { throw null; } + public bool Equals(System.Net.Sockets.IPPacketInformation other) { throw null; } public override int GetHashCode() { throw null; } public static bool operator ==(System.Net.Sockets.IPPacketInformation packetInformation1, System.Net.Sockets.IPPacketInformation packetInformation2) { throw null; } public static bool operator !=(System.Net.Sockets.IPPacketInformation packetInformation1, System.Net.Sockets.IPPacketInformation packetInformation2) { throw null; } diff --git a/src/libraries/System.Net.Sockets/src/System/Net/Sockets/IPPacketInformation.cs b/src/libraries/System.Net.Sockets/src/System/Net/Sockets/IPPacketInformation.cs index 06d4eca31750b0..b0597b626c4804 100644 --- a/src/libraries/System.Net.Sockets/src/System/Net/Sockets/IPPacketInformation.cs +++ b/src/libraries/System.Net.Sockets/src/System/Net/Sockets/IPPacketInformation.cs @@ -5,7 +5,7 @@ namespace System.Net.Sockets { - public struct IPPacketInformation + public struct IPPacketInformation : IEquatable { private readonly IPAddress _address; private readonly int _networkInterface; @@ -16,41 +16,27 @@ internal IPPacketInformation(IPAddress address, int networkInterface) _networkInterface = networkInterface; } - public IPAddress Address - { - get - { - return _address; - } - } + public IPAddress Address => _address; - public int Interface - { - get - { - return _networkInterface; - } - } + public int Interface => _networkInterface; - public static bool operator ==(IPPacketInformation packetInformation1, IPPacketInformation packetInformation2) - { - return packetInformation1._networkInterface == packetInformation2._networkInterface && - ((packetInformation1._address == null && packetInformation2._address == null) || - (packetInformation1._address != null && packetInformation1._address.Equals(packetInformation2._address))); - } + public static bool operator ==(IPPacketInformation packetInformation1, IPPacketInformation packetInformation2) => + packetInformation1.Equals(packetInformation2); - public static bool operator !=(IPPacketInformation packetInformation1, IPPacketInformation packetInformation2) - { - return !(packetInformation1 == packetInformation2); - } + public static bool operator !=(IPPacketInformation packetInformation1, IPPacketInformation packetInformation2) => + !packetInformation1.Equals(packetInformation2); public override bool Equals([NotNullWhen(true)] object? comparand) => - comparand is IPPacketInformation other && this == other; + comparand is IPPacketInformation other && Equals(other); - public override int GetHashCode() - { - return unchecked(_networkInterface.GetHashCode() * (int)0xA5555529) + - (_address == null ? 0 : _address.GetHashCode()); - } + /// Indicates whether the current instance is equal to another instance of the same type. + /// An instance to compare with this instance. + /// true if the current instance is equal to the other instance; otherwise, false. + public bool Equals(IPPacketInformation other) => + _networkInterface == other._networkInterface && + (_address is null ? other._address is null : _address.Equals(other._address)); + + public override int GetHashCode() => + unchecked(_networkInterface.GetHashCode() * (int)0xA5555529) + (_address?.GetHashCode() ?? 0); } } diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/IPPacketInformationTest.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/IPPacketInformationTest.cs index 443924b66d2b44..19dbc7f470d007 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/IPPacketInformationTest.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/IPPacketInformationTest.cs @@ -13,7 +13,10 @@ public class IPPacketInformationTest public void Equals_DefaultValues_Success() { Assert.Equal(default(IPPacketInformation), default(IPPacketInformation)); + Assert.True(default(IPPacketInformation) == default(IPPacketInformation)); + Assert.True(default(IPPacketInformation).Equals(default(IPPacketInformation))); + Assert.False(default(IPPacketInformation) != default(IPPacketInformation)); } @@ -31,10 +34,14 @@ public void Equals_NonDefaultValue_Success() Assert.Equal(packetInfo, packetInfoCopy); Assert.True(packetInfo == packetInfoCopy); + Assert.True(packetInfo.Equals(packetInfoCopy)); + Assert.True(packetInfo.Equals((object)packetInfoCopy)); Assert.False(packetInfo != packetInfoCopy); Assert.NotEqual(default, packetInfo); Assert.False(packetInfo == default(IPPacketInformation)); + Assert.False(packetInfo.Equals(default(IPPacketInformation))); + Assert.False(packetInfo.Equals((object)default(IPPacketInformation))); Assert.True(packetInfo != default(IPPacketInformation)); int ignored = packetInfo.Interface; // just make sure it doesn't throw, nothing else to verify diff --git a/src/libraries/System.Private.CoreLib/src/System/ArraySegment.cs b/src/libraries/System.Private.CoreLib/src/System/ArraySegment.cs index 06c31c4d6e0097..2d6c817b872686 100644 --- a/src/libraries/System.Private.CoreLib/src/System/ArraySegment.cs +++ b/src/libraries/System.Private.CoreLib/src/System/ArraySegment.cs @@ -26,8 +26,16 @@ namespace System // (ie, users could assign a new value to the old location). [Serializable] [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] +#pragma warning disable CA1066 // adding IEquatable implementation could change semantics of code like that in xunit that queries for IEquatable vs enumerating contents public readonly struct ArraySegment : IList, IReadOnlyList +#pragma warning restore CA1066 { + // ArraySegment doesn't implement IEquatable, even though it provides a strongly-typed + // Equals(T), as that results in different comparison semantics than comparing item-by-item + // the elements returned from its IEnumerable implementation. This then is a breaking change + // for usage like that in xunit's Assert.Equal, which will prioritize using an instance's IEquatable + // over its IEnumerable. + // Do not replace the array allocation with Array.Empty. We don't want to have the overhead of // instantiating another generic type in addition to ArraySegment for new type parameters. #pragma warning disable CA1825 @@ -120,7 +128,7 @@ public void CopyTo(ArraySegment destination) } public override bool Equals([NotNullWhen(true)] object? obj) => - obj is ArraySegment && Equals((ArraySegment)obj); + obj is ArraySegment other && Equals(other); public bool Equals(ArraySegment obj) => obj._array == _array && obj._offset == _offset && obj._count == _count; diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventDescriptor.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventDescriptor.cs index c3994e613a3160..b1aaccd7f7f7c6 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventDescriptor.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventDescriptor.cs @@ -15,7 +15,7 @@ namespace System.Diagnostics.Tracing #if ES_BUILD_STANDALONE [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] #endif - internal struct EventDescriptor + internal readonly struct EventDescriptor : IEquatable { #region private [FieldOffset(0)] diff --git a/src/libraries/System.Private.CoreLib/src/System/HashCode.cs b/src/libraries/System.Private.CoreLib/src/System/HashCode.cs index d9735f05b44348..f40830e416d368 100644 --- a/src/libraries/System.Private.CoreLib/src/System/HashCode.cs +++ b/src/libraries/System.Private.CoreLib/src/System/HashCode.cs @@ -47,6 +47,8 @@ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT using System.Runtime.InteropServices; using Internal.Runtime.CompilerServices; +#pragma warning disable CA1066 // Implement IEquatable when overriding Object.Equals + namespace System { // xxHash32 is used for the hash code. diff --git a/src/libraries/System.Private.CoreLib/src/System/IntPtr.cs b/src/libraries/System.Private.CoreLib/src/System/IntPtr.cs index 7fb1803d6f5ab0..355578395db40d 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IntPtr.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IntPtr.cs @@ -11,6 +11,8 @@ using Internal.Runtime.CompilerServices; #pragma warning disable SA1121 // explicitly using type aliases instead of built-in types +#pragma warning disable CA1066 // Implement IEquatable when overriding Object.Equals + #if TARGET_64BIT using nint_t = System.Int64; #else diff --git a/src/libraries/System.Private.CoreLib/src/System/Nullable.cs b/src/libraries/System.Private.CoreLib/src/System/Nullable.cs index 0fa9141483ee24..089f970057dc8a 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Nullable.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Nullable.cs @@ -4,6 +4,8 @@ using System.Collections.Generic; using System.Runtime.Versioning; +#pragma warning disable CA1066 // Implement IEquatable when overriding Object.Equals + namespace System { // Because we have special type system support that says a boxed Nullable diff --git a/src/libraries/System.Private.CoreLib/src/System/Reflection/CustomAttributeNamedArgument.cs b/src/libraries/System.Private.CoreLib/src/System/Reflection/CustomAttributeNamedArgument.cs index 9699e14e5d1e53..b2baa777460a6b 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Reflection/CustomAttributeNamedArgument.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Reflection/CustomAttributeNamedArgument.cs @@ -1,9 +1,11 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Diagnostics.CodeAnalysis; + namespace System.Reflection { - public readonly partial struct CustomAttributeNamedArgument + public readonly partial struct CustomAttributeNamedArgument : IEquatable { public static bool operator ==(CustomAttributeNamedArgument left, CustomAttributeNamedArgument right) => left.Equals(right); public static bool operator !=(CustomAttributeNamedArgument left, CustomAttributeNamedArgument right) => !left.Equals(right); @@ -46,10 +48,15 @@ public override int GetHashCode() return base.GetHashCode(); } - public override bool Equals(object? obj) - { - return obj == (object)this; - } + public override bool Equals([NotNullWhen(true)] object? obj) => + obj is CustomAttributeNamedArgument other && Equals(other); + + /// Indicates whether the current instance is equal to another instance of the same type. + /// An instance to compare with this instance. + /// true if the current instance is equal to the other instance; otherwise, false. + public bool Equals(CustomAttributeNamedArgument other) => + _memberInfo == other._memberInfo && + _value == other._value; internal Type ArgumentType => _memberInfo is FieldInfo fi ? diff --git a/src/libraries/System.Private.CoreLib/src/System/Reflection/CustomAttributeTypedArgument.cs b/src/libraries/System.Private.CoreLib/src/System/Reflection/CustomAttributeTypedArgument.cs index 3198e9fd458027..b0e306af8f838e 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Reflection/CustomAttributeTypedArgument.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Reflection/CustomAttributeTypedArgument.cs @@ -2,11 +2,12 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Text; namespace System.Reflection { - public readonly partial struct CustomAttributeTypedArgument + public readonly partial struct CustomAttributeTypedArgument : IEquatable { public static bool operator ==(CustomAttributeTypedArgument left, CustomAttributeTypedArgument right) => left.Equals(right); public static bool operator !=(CustomAttributeTypedArgument left, CustomAttributeTypedArgument right) => !left.Equals(right); @@ -86,7 +87,13 @@ internal string ToString(bool typed) } public override int GetHashCode() => base.GetHashCode(); - public override bool Equals(object? obj) => obj == (object)this; + + public override bool Equals([NotNullWhen(true)] object? obj) => obj is CustomAttributeTypedArgument cata && Equals(cata); + + /// Indicates whether the current instance is equal to another instance of the same type. + /// An instance to compare with this instance. + /// true if the current instance is equal to the other instance; otherwise, false. + public bool Equals(CustomAttributeTypedArgument other) => _value == other._value && _argumentType == other._argumentType; public Type ArgumentType => _argumentType; public object? Value => _value; diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/ArrayWithOffset.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/ArrayWithOffset.cs index 8a80faa9977b61..92d42d67955672 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/ArrayWithOffset.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/ArrayWithOffset.cs @@ -6,7 +6,7 @@ namespace System.Runtime.InteropServices { - public readonly struct ArrayWithOffset + public readonly struct ArrayWithOffset : IEquatable { private readonly object? m_array; private readonly int m_offset; @@ -52,7 +52,7 @@ public ArrayWithOffset(object? array, int offset) public override bool Equals([NotNullWhen(true)] object? obj) { - return obj is ArrayWithOffset && Equals((ArrayWithOffset)obj); + return obj is ArrayWithOffset awo && Equals(awo); } public bool Equals(ArrayWithOffset obj) diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/GCHandle.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/GCHandle.cs index 579633db55cafc..a1c849b48c71b1 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/GCHandle.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/GCHandle.cs @@ -23,7 +23,7 @@ namespace System.Runtime.InteropServices /// Pinned - same as Normal, but allows the address of the actual object to be taken. /// [StructLayout(LayoutKind.Sequential)] - public partial struct GCHandle + public partial struct GCHandle : IEquatable { // The actual integer handle value that the EE uses internally. private IntPtr _handle; @@ -163,7 +163,12 @@ public static GCHandle FromIntPtr(IntPtr value) public override int GetHashCode() => _handle.GetHashCode(); - public override bool Equals([NotNullWhen(true)] object? o) => o is GCHandle && _handle == ((GCHandle)o)._handle; + public override bool Equals([NotNullWhen(true)] object? o) => o is GCHandle other && Equals(other); + + /// Indicates whether the current instance is equal to another instance of the same type. + /// An instance to compare with this instance. + /// true if the current instance is equal to the other instance; otherwise, false. + public bool Equals(GCHandle other) => _handle == other._handle; public static bool operator ==(GCHandle a, GCHandle b) => (nint)a._handle == (nint)b._handle; diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Serialization/StreamingContext.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Serialization/StreamingContext.cs index 3501457fa82d1e..1b3b86c0b9a646 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Serialization/StreamingContext.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Serialization/StreamingContext.cs @@ -3,6 +3,8 @@ using System.Diagnostics.CodeAnalysis; +#pragma warning disable CA1066 // Implement IEquatable when overriding Object.Equals + namespace System.Runtime.Serialization { public readonly struct StreamingContext diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/CancellationToken.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/CancellationToken.cs index ab03e12e87be02..27f29cb0dd9498 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/CancellationToken.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/CancellationToken.cs @@ -27,7 +27,7 @@ namespace System.Threading /// /// [DebuggerDisplay("IsCancellationRequested = {IsCancellationRequested}")] - public readonly struct CancellationToken + public readonly struct CancellationToken : IEquatable { // The backing TokenSource. // if null, it implicitly represents the same thing as new CancellationToken(false). diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/LowLevelLifoSemaphore.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/LowLevelLifoSemaphore.cs index 6b6b86eb28b716..25a229c87ef66a 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/LowLevelLifoSemaphore.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/LowLevelLifoSemaphore.cs @@ -242,7 +242,7 @@ private bool WaitForSignal(int timeoutMs) } } - private struct Counts + private struct Counts : IEquatable { private const byte SignalCountShift = 0; private const byte WaiterCountShift = 32; @@ -350,10 +350,11 @@ public void DecrementCountOfWaitersSignaledToWake() public Counts InterlockedCompareExchange(Counts newCounts, Counts oldCounts) => new Counts(Interlocked.CompareExchange(ref _data, newCounts._data, oldCounts._data)); - public static bool operator ==(Counts lhs, Counts rhs) => lhs._data == rhs._data; - public static bool operator !=(Counts lhs, Counts rhs) => lhs._data != rhs._data; + public static bool operator ==(Counts lhs, Counts rhs) => lhs.Equals(rhs); + public static bool operator !=(Counts lhs, Counts rhs) => !lhs.Equals(rhs); - public override bool Equals([NotNullWhen(true)] object? obj) => obj is Counts counts && _data == counts._data; + public override bool Equals([NotNullWhen(true)] object? obj) => obj is Counts other && Equals(other); + public bool Equals(Counts other) => _data == other._data; public override int GetHashCode() => (int)_data + (int)(_data >> 32); } diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.ThreadCounts.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.ThreadCounts.cs index 43aa0fcf7102cb..3242f165aff9a7 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.ThreadCounts.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.ThreadCounts.cs @@ -11,7 +11,7 @@ internal sealed partial class PortableThreadPool /// /// Tracks information on the number of threads we want/have in different states in our thread pool. /// - private struct ThreadCounts + private struct ThreadCounts : IEquatable { // SOS's ThreadPool command depends on this layout private const byte NumProcessingWorkShift = 0; @@ -126,7 +126,8 @@ public ThreadCounts InterlockedCompareExchange(ThreadCounts newCounts, ThreadCou public static bool operator ==(ThreadCounts lhs, ThreadCounts rhs) => lhs._data == rhs._data; public static bool operator !=(ThreadCounts lhs, ThreadCounts rhs) => lhs._data != rhs._data; - public override bool Equals([NotNullWhen(true)] object? obj) => obj is ThreadCounts other && _data == other._data; + public override bool Equals([NotNullWhen(true)] object? obj) => obj is ThreadCounts other && Equals(other); + public bool Equals(ThreadCounts other) => _data == other._data; public override int GetHashCode() => (int)_data + (int)(_data >> 32); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.WorkerTracking.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.WorkerTracking.cs index 8c588965add43e..8a5f1d8bba581f 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.WorkerTracking.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.WorkerTracking.cs @@ -58,7 +58,7 @@ private short GetAndResetHighWatermarkCountOfThreadsProcessingUserCallbacks() /// /// Tracks thread count information that is used when the EnableWorkerTracking config option is enabled. /// - private struct CountsOfThreadsProcessingUserCallbacks + private struct CountsOfThreadsProcessingUserCallbacks : IEquatable { private const byte CurrentShift = 0; private const byte HighWatermarkShift = 16; @@ -114,13 +114,16 @@ public CountsOfThreadsProcessingUserCallbacks InterlockedCompareExchange( public static bool operator ==( CountsOfThreadsProcessingUserCallbacks lhs, - CountsOfThreadsProcessingUserCallbacks rhs) => lhs._data == rhs._data; + CountsOfThreadsProcessingUserCallbacks rhs) => lhs.Equals(rhs); public static bool operator !=( CountsOfThreadsProcessingUserCallbacks lhs, - CountsOfThreadsProcessingUserCallbacks rhs) => lhs._data != rhs._data; + CountsOfThreadsProcessingUserCallbacks rhs) => !lhs.Equals(rhs); public override bool Equals([NotNullWhen(true)] object? obj) => - obj is CountsOfThreadsProcessingUserCallbacks other && _data == other._data; + obj is CountsOfThreadsProcessingUserCallbacks other && Equals(other); + + public bool Equals(CountsOfThreadsProcessingUserCallbacks other) => _data == other._data; + public override int GetHashCode() => (int)_data; } } diff --git a/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.AdjustmentRule.cs b/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.AdjustmentRule.cs index 6f53ab75ce3511..7c754b4f285708 100644 --- a/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.AdjustmentRule.cs +++ b/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.AdjustmentRule.cs @@ -56,6 +56,12 @@ public bool Equals([NotNullWhen(true)] AdjustmentRule? other) => _daylightTransitionEnd.Equals(other._daylightTransitionEnd) && _daylightTransitionStart.Equals(other._daylightTransitionStart); + /// Indicates whether the current instance is equal to another instance. + /// An instance to compare with this instance. + /// true if the current instance is equal to the other instance; otherwise, false. + public override bool Equals([NotNullWhen(true)] object? obj) => + obj is AdjustmentRule other && Equals(other); + public override int GetHashCode() => _dateStart.GetHashCode(); private AdjustmentRule( diff --git a/src/libraries/System.Private.CoreLib/src/System/UIntPtr.cs b/src/libraries/System.Private.CoreLib/src/System/UIntPtr.cs index bc7859c0d18d9e..12a2dce1d7258f 100644 --- a/src/libraries/System.Private.CoreLib/src/System/UIntPtr.cs +++ b/src/libraries/System.Private.CoreLib/src/System/UIntPtr.cs @@ -11,6 +11,8 @@ using Internal.Runtime.CompilerServices; #pragma warning disable SA1121 // explicitly using type aliases instead of built-in types +#pragma warning disable CA1066 // Implement IEquatable when overriding Object.Equals + #if TARGET_64BIT using nuint_t = System.UInt64; #else diff --git a/src/libraries/System.Private.Xml/src/System/Xml/BinaryXml/XmlBinaryReader.cs b/src/libraries/System.Private.Xml/src/System/Xml/BinaryXml/XmlBinaryReader.cs index 074f795ea54c07..33d1e3dff11c23 100644 --- a/src/libraries/System.Private.Xml/src/System/Xml/BinaryXml/XmlBinaryReader.cs +++ b/src/libraries/System.Private.Xml/src/System/Xml/BinaryXml/XmlBinaryReader.cs @@ -59,7 +59,7 @@ private enum ScanState }; // Note: also used by XmlBinaryWriter - internal struct QName + internal struct QName : IEquatable { public string prefix; public string localname; @@ -95,45 +95,26 @@ public void CheckPrefixNS(string prefix, string namespaceUri) throw new XmlException(SR.XmlBinary_NoRemapPrefix, new string[] { prefix, this.namespaceUri, namespaceUri }); } - public override int GetHashCode() - { - return this.prefix.GetHashCode() ^ this.localname.GetHashCode(); - } + public int GetNSHashCode() => + HashCode.Combine(this.namespaceUri, this.localname); - public int GetNSHashCode() - { - return HashCode.Combine(this.namespaceUri, this.localname); - } + public override int GetHashCode() => + this.prefix.GetHashCode() ^ this.localname.GetHashCode(); + public override bool Equals([NotNullWhen(true)] object? other) => + other is QName qname && Equals(qname); - public override bool Equals([NotNullWhen(true)] object? other) - { - if (other is QName that) - { - return this == that; - } - return false; - } + public bool Equals(QName other) => + prefix == other.prefix && + localname == other.localname && + namespaceUri == other.namespaceUri; - public override string ToString() - { - if (prefix.Length == 0) - return this.localname; - else - return $"{this.prefix}:{this.localname}"; - } + public static bool operator ==(QName a, QName b) => a.Equals(b); - public static bool operator ==(QName a, QName b) - { - return ((a.prefix == b.prefix) - && (a.localname == b.localname) - && (a.namespaceUri == b.namespaceUri)); - } + public static bool operator !=(QName a, QName b) => !a.Equals(b); - public static bool operator !=(QName a, QName b) - { - return !(a == b); - } + public override string ToString() => + prefix.Length == 0 ? localname : $"{this.prefix}:{this.localname}"; }; private struct ElemInfo diff --git a/src/libraries/System.Private.Xml/src/System/Xml/Xsl/Pair.cs b/src/libraries/System.Private.Xml/src/System/Xml/Xsl/Pair.cs index 8e3e1a4b841a76..33b4fe98b3f922 100644 --- a/src/libraries/System.Private.Xml/src/System/Xml/Xsl/Pair.cs +++ b/src/libraries/System.Private.Xml/src/System/Xml/Xsl/Pair.cs @@ -7,49 +7,34 @@ namespace System.Xml.Xsl { - internal struct Int32Pair + internal readonly struct Int32Pair : IEquatable { - private readonly int _left; - private readonly int _right; - public Int32Pair(int left, int right) { - _left = left; - _right = right; + Left = left; + Right = right; } - public int Left { get { return _left; } } - public int Right { get { return _right; } } + public int Left { get; } + public int Right { get; } - public override bool Equals([NotNullWhen(true)] object? other) - { - if (other is Int32Pair) - { - Int32Pair o = (Int32Pair)other; - return _left == o._left && _right == o._right; - } + public override bool Equals([NotNullWhen(true)] object? other) => + other is Int32Pair o && Equals(o); - return false; - } + public bool Equals(Int32Pair other) => Left == other.Left && Right == other.Right; - public override int GetHashCode() - { - return _left.GetHashCode() ^ _right.GetHashCode(); - } + public override int GetHashCode() => Left.GetHashCode() ^ Right.GetHashCode(); } - internal struct StringPair + internal readonly struct StringPair { - private readonly string _left; - private readonly string _right; - public StringPair(string left, string right) { - _left = left; - _right = right; + Left = left; + Right = right; } - public string Left { get { return _left; } } - public string Right { get { return _right; } } + public string Left { get; } + public string Right { get; } } } diff --git a/src/libraries/System.Private.Xml/src/System/Xml/Xsl/XmlQueryCardinality.cs b/src/libraries/System.Private.Xml/src/System/Xml/Xsl/XmlQueryCardinality.cs index 1046765a2d3b23..a95ce13c1737c9 100644 --- a/src/libraries/System.Private.Xml/src/System/Xml/Xsl/XmlQueryCardinality.cs +++ b/src/libraries/System.Private.Xml/src/System/Xml/Xsl/XmlQueryCardinality.cs @@ -11,7 +11,7 @@ namespace System.Xml.Xsl /// Cardinality of part of XmlQueryType /// struct is being used because enum doesn't allow members /// - internal struct XmlQueryCardinality + internal readonly struct XmlQueryCardinality : IEquatable { private readonly int _value; diff --git a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/CacheExpires.cs b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/CacheExpires.cs index e4eab06b7adb31..f9cc0fd36dadf0 100644 --- a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/CacheExpires.cs +++ b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/CacheExpires.cs @@ -13,7 +13,7 @@ namespace System.Runtime.Caching { - internal struct ExpiresEntryRef + internal readonly struct ExpiresEntryRef : IEquatable { internal static readonly ExpiresEntryRef INVALID = new ExpiresEntryRef(0, 0); @@ -31,55 +31,18 @@ internal ExpiresEntryRef(int pageIndex, int entryIndex) _ref = ((((uint)pageIndex) << PAGE_SHIFT) | (((uint)(entryIndex)) & ENTRY_MASK)); } - public override bool Equals(object value) - { - if (value is ExpiresEntryRef) - { - return _ref == ((ExpiresEntryRef)value)._ref; - } + public override bool Equals(object value) => value is ExpiresEntryRef other && Equals(other); - return false; - } + public bool Equals(ExpiresEntryRef other) => _ref == other._ref; - public static bool operator !=(ExpiresEntryRef r1, ExpiresEntryRef r2) - { - return r1._ref != r2._ref; - } - public static bool operator ==(ExpiresEntryRef r1, ExpiresEntryRef r2) - { - return r1._ref == r2._ref; - } + public static bool operator ==(ExpiresEntryRef r1, ExpiresEntryRef r2) => r1.Equals(r2); + public static bool operator !=(ExpiresEntryRef r1, ExpiresEntryRef r2) => !r1.Equals(r2); - public override int GetHashCode() - { - return (int)_ref; - } + public override int GetHashCode() => (int)_ref; - internal int PageIndex - { - get - { - int result = (int)(_ref >> PAGE_SHIFT); - return result; - } - } - - internal int Index - { - get - { - int result = (int)(_ref & ENTRY_MASK); - return result; - } - } - - internal bool IsInvalid - { - get - { - return _ref == 0; - } - } + internal int PageIndex => (int)(_ref >> PAGE_SHIFT); + internal int Index => (int)(_ref & ENTRY_MASK); + internal bool IsInvalid => _ref == 0; } [StructLayout(LayoutKind.Explicit)] diff --git a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/CacheUsage.cs b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/CacheUsage.cs index 73ed9f30d3d5c9..7b7ea642792110 100644 --- a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/CacheUsage.cs +++ b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/CacheUsage.cs @@ -13,7 +13,7 @@ namespace System.Runtime.Caching { - internal struct UsageEntryRef + internal readonly struct UsageEntryRef : IEquatable { internal static readonly UsageEntryRef INVALID = new UsageEntryRef(0, 0); @@ -31,38 +31,18 @@ internal UsageEntryRef(int pageIndex, int entryIndex) _ref = ((((uint)pageIndex) << PAGE_SHIFT) | (((uint)(entryIndex)) & ENTRY_MASK)); } - public override bool Equals(object value) - { - if (value is UsageEntryRef) - { - return _ref == ((UsageEntryRef)value)._ref; - } + public override bool Equals(object value) => + value is UsageEntryRef other && Equals(other); - return false; - } - public static bool operator ==(UsageEntryRef r1, UsageEntryRef r2) - { - return r1._ref == r2._ref; - } + public bool Equals(UsageEntryRef other) => _ref == other._ref; - public static bool operator !=(UsageEntryRef r1, UsageEntryRef r2) - { - return r1._ref != r2._ref; - } + public static bool operator ==(UsageEntryRef r1, UsageEntryRef r2) => r1.Equals(r2); - public override int GetHashCode() - { - return (int)_ref; - } + public static bool operator !=(UsageEntryRef r1, UsageEntryRef r2) => !r1.Equals(r2); - internal int PageIndex - { - get - { - int result = (int)(_ref >> PAGE_SHIFT); - return result; - } - } + public override int GetHashCode() => (int)_ref; + + internal int PageIndex => (int)(_ref >> PAGE_SHIFT); internal int Ref1Index { @@ -84,29 +64,11 @@ internal int Ref2Index } } - internal bool IsRef1 - { - get - { - return ((int)(sbyte)(_ref & ENTRY_MASK)) > 0; - } - } + internal bool IsRef1 => ((int)(sbyte)(_ref & ENTRY_MASK)) > 0; - internal bool IsRef2 - { - get - { - return ((int)(sbyte)(_ref & ENTRY_MASK)) < 0; - } - } + internal bool IsRef2 => ((int)(sbyte)(_ref & ENTRY_MASK)) < 0; - internal bool IsInvalid - { - get - { - return _ref == 0; - } - } + internal bool IsInvalid => _ref == 0; } internal struct UsageEntryLink diff --git a/src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs b/src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs index 901b76346b82c1..e58de5b8a040a9 100644 --- a/src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs +++ b/src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs @@ -98,7 +98,7 @@ public sealed partial class AllowReversePInvokeCallsAttribute : System.Attribute { public AllowReversePInvokeCallsAttribute() { } } - public readonly partial struct ArrayWithOffset + public readonly partial struct ArrayWithOffset : System.IEquatable { private readonly object _dummy; private readonly int _dummyPrimitive; diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/GCHandleTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/GCHandleTests.cs index bf5ec1713cdbc6..8a79b7a66db456 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/GCHandleTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/GCHandleTests.cs @@ -138,6 +138,7 @@ public void Equals_Object_ReturnsExpected(GCHandle handle, object other, bool ex Assert.Equal(expected, handle.Equals(other)); if (other is GCHandle otherHandle) { + Assert.Equal(expected, handle.Equals(otherHandle)); Assert.Equal(expected, handle == otherHandle); Assert.Equal(!expected, handle != otherHandle); } diff --git a/src/libraries/System.Runtime/ref/System.Runtime.cs b/src/libraries/System.Runtime/ref/System.Runtime.cs index c57c5b13cc1190..57c9f8368994eb 100644 --- a/src/libraries/System.Runtime/ref/System.Runtime.cs +++ b/src/libraries/System.Runtime/ref/System.Runtime.cs @@ -4826,7 +4826,7 @@ public MissingMethodException(string? message, System.Exception? inner) { } public MissingMethodException(string? className, string? methodName) { } public override string Message { get { throw null; } } } - public partial struct ModuleHandle + public partial struct ModuleHandle : System.IEquatable { private object _dummy; private int _dummyPrimitive; @@ -6367,6 +6367,7 @@ internal AdjustmentRule() { } public static System.TimeZoneInfo.AdjustmentRule CreateAdjustmentRule(System.DateTime dateStart, System.DateTime dateEnd, System.TimeSpan daylightDelta, System.TimeZoneInfo.TransitionTime daylightTransitionStart, System.TimeZoneInfo.TransitionTime daylightTransitionEnd) { throw null; } public static System.TimeZoneInfo.AdjustmentRule CreateAdjustmentRule(System.DateTime dateStart, System.DateTime dateEnd, System.TimeSpan daylightDelta, System.TimeZoneInfo.TransitionTime daylightTransitionStart, System.TimeZoneInfo.TransitionTime daylightTransitionEnd, System.TimeSpan baseUtcOffsetDelta) { throw null; } public bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.TimeZoneInfo.AdjustmentRule? other) { throw null; } + public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } public override int GetHashCode() { throw null; } void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(object? sender) { } void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } @@ -11648,7 +11649,7 @@ protected CustomAttributeFormatException(System.Runtime.Serialization.Serializat public CustomAttributeFormatException(string? message) { } public CustomAttributeFormatException(string? message, System.Exception? inner) { } } - public readonly partial struct CustomAttributeNamedArgument + public readonly partial struct CustomAttributeNamedArgument : System.IEquatable { private readonly object _dummy; private readonly int _dummyPrimitive; @@ -11658,13 +11659,14 @@ public readonly partial struct CustomAttributeNamedArgument public System.Reflection.MemberInfo MemberInfo { get { throw null; } } public string MemberName { get { throw null; } } public System.Reflection.CustomAttributeTypedArgument TypedValue { get { throw null; } } - public override bool Equals(object? obj) { throw null; } + public bool Equals(System.Reflection.CustomAttributeNamedArgument other) { throw null; } + public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } public override int GetHashCode() { throw null; } public static bool operator ==(System.Reflection.CustomAttributeNamedArgument left, System.Reflection.CustomAttributeNamedArgument right) { throw null; } public static bool operator !=(System.Reflection.CustomAttributeNamedArgument left, System.Reflection.CustomAttributeNamedArgument right) { throw null; } public override string ToString() { throw null; } } - public readonly partial struct CustomAttributeTypedArgument + public readonly partial struct CustomAttributeTypedArgument : System.IEquatable { private readonly object _dummy; private readonly int _dummyPrimitive; @@ -11672,7 +11674,8 @@ public readonly partial struct CustomAttributeTypedArgument public CustomAttributeTypedArgument(System.Type argumentType, object? value) { throw null; } public System.Type ArgumentType { get { throw null; } } public object? Value { get { throw null; } } - public override bool Equals(object? obj) { throw null; } + public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } + public bool Equals(System.Reflection.CustomAttributeTypedArgument other) { throw null; } public override int GetHashCode() { throw null; } public static bool operator ==(System.Reflection.CustomAttributeTypedArgument left, System.Reflection.CustomAttributeTypedArgument right) { throw null; } public static bool operator !=(System.Reflection.CustomAttributeTypedArgument left, System.Reflection.CustomAttributeTypedArgument right) { throw null; } @@ -13493,7 +13496,7 @@ public sealed partial class FieldOffsetAttribute : System.Attribute public FieldOffsetAttribute(int offset) { } public int Value { get { throw null; } } } - public partial struct GCHandle + public partial struct GCHandle : System.IEquatable { private int _dummyPrimitive; public bool IsAllocated { get { throw null; } } @@ -13502,6 +13505,7 @@ public partial struct GCHandle public static System.Runtime.InteropServices.GCHandle Alloc(object? value) { throw null; } public static System.Runtime.InteropServices.GCHandle Alloc(object? value, System.Runtime.InteropServices.GCHandleType type) { throw null; } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? o) { throw null; } + public bool Equals(System.Runtime.InteropServices.GCHandle other) { throw null; } public void Free() { } public static System.Runtime.InteropServices.GCHandle FromIntPtr(System.IntPtr value) { throw null; } public override int GetHashCode() { throw null; } @@ -14770,7 +14774,7 @@ public static partial class Utf8 } namespace System.Threading { - public readonly partial struct CancellationToken + public readonly partial struct CancellationToken : System.IEquatable { private readonly object _dummy; private readonly int _dummyPrimitive; diff --git a/src/libraries/System.Runtime/tests/System/Reflection/CustomAttribute_Named_Typed_ArgumentTests.cs b/src/libraries/System.Runtime/tests/System/Reflection/CustomAttribute_Named_Typed_ArgumentTests.cs index 4460797182c873..c406e36ea21c3f 100644 --- a/src/libraries/System.Runtime/tests/System/Reflection/CustomAttribute_Named_Typed_ArgumentTests.cs +++ b/src/libraries/System.Runtime/tests/System/Reflection/CustomAttribute_Named_Typed_ArgumentTests.cs @@ -52,6 +52,28 @@ public static void Test_CustomAttributeTypedArgument_Constructor() Assert.True(false, "Expected to find MyAttr Attribute"); } + [Fact] + public static void Test_CustomAttributeTypedArgument_Equals() + { + Type t = typeof(MyClass); + foreach (CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(t)) + { + foreach (CustomAttributeTypedArgument cata in cad.ConstructorArguments) + { + Assert.True(cata.Equals(cata)); + Assert.True(cata.Equals((object)cata)); + + var notEqualArgument = new CustomAttributeTypedArgument(new [] { new CustomAttributeTypedArgument(0) }); + Assert.False(cata.Equals(notEqualArgument)); + Assert.False(cata.Equals((object)notEqualArgument)); + + return; + } + } + + Assert.True(false, "Expected to find MyAttr Attribute"); + } + [Fact] public static void Test_CustomAttributeTypedArgument_ToString() { diff --git a/src/libraries/System.ServiceProcess.ServiceController/ref/System.ServiceProcess.ServiceController.netcoreapp.cs b/src/libraries/System.ServiceProcess.ServiceController/ref/System.ServiceProcess.ServiceController.netcoreapp.cs index 3fd806b0f56492..1298a7c23d6909 100644 --- a/src/libraries/System.ServiceProcess.ServiceController/ref/System.ServiceProcess.ServiceController.netcoreapp.cs +++ b/src/libraries/System.ServiceProcess.ServiceController/ref/System.ServiceProcess.ServiceController.netcoreapp.cs @@ -10,4 +10,7 @@ public partial class ServiceController : System.ComponentModel.Component { public void Stop(bool stopDependentServices) { } } + public readonly partial struct SessionChangeDescription : System.IEquatable + { + } } diff --git a/src/libraries/System.ServiceProcess.ServiceController/src/System.ServiceProcess.ServiceController.csproj b/src/libraries/System.ServiceProcess.ServiceController/src/System.ServiceProcess.ServiceController.csproj index 8fd0582994dd4e..fac46aed04ba2c 100644 --- a/src/libraries/System.ServiceProcess.ServiceController/src/System.ServiceProcess.ServiceController.csproj +++ b/src/libraries/System.ServiceProcess.ServiceController/src/System.ServiceProcess.ServiceController.csproj @@ -17,6 +17,8 @@ System.ServiceProcess.ServiceType true true SR.PlatformNotSupported_ServiceController + + $(NoWarn);CA1066 +#endif { internal SessionChangeDescription(SessionChangeReason reason, int id) { @@ -17,34 +20,20 @@ internal SessionChangeDescription(SessionChangeReason reason, int id) public int SessionId { get; } - public override bool Equals([NotNullWhen(true)] object? obj) - { - if (!(obj is SessionChangeDescription)) - { - return false; - } + public override int GetHashCode() => + (int)Reason ^ SessionId; - return Equals((SessionChangeDescription)obj); - } + public override bool Equals([NotNullWhen(true)] object? obj) => + obj is SessionChangeDescription other && Equals(other); - public override int GetHashCode() - { - return (int)Reason ^ SessionId; - } + public bool Equals(SessionChangeDescription changeDescription) => + (Reason == changeDescription.Reason) && + (SessionId == changeDescription.SessionId); - public bool Equals(SessionChangeDescription changeDescription) - { - return (Reason == changeDescription.Reason) && (SessionId == changeDescription.SessionId); - } + public static bool operator ==(SessionChangeDescription a, SessionChangeDescription b) => + a.Equals(b); - public static bool operator ==(SessionChangeDescription a, SessionChangeDescription b) - { - return a.Equals(b); - } - - public static bool operator !=(SessionChangeDescription a, SessionChangeDescription b) - { - return !a.Equals(b); - } + public static bool operator !=(SessionChangeDescription a, SessionChangeDescription b) => + !a.Equals(b); } } diff --git a/src/libraries/System.Speech/src/Internal/Synthesis/EngineSiteSapi.cs b/src/libraries/System.Speech/src/Internal/Synthesis/EngineSiteSapi.cs index d6bf03a57d2f17..e44843b0c81938 100644 --- a/src/libraries/System.Speech/src/Internal/Synthesis/EngineSiteSapi.cs +++ b/src/libraries/System.Speech/src/Internal/Synthesis/EngineSiteSapi.cs @@ -176,8 +176,9 @@ internal interface ISpEngineSite void CompleteSkip(int skipped); void LoadResource([MarshalAs(UnmanagedType.LPWStr)] string resource, ref string mediaType, out IStream stream); } + [StructLayout(LayoutKind.Sequential)] - internal struct SpeechEventSapi + internal struct SpeechEventSapi : IEquatable { public short EventId; public short ParameterType; @@ -185,27 +186,22 @@ internal struct SpeechEventSapi public long AudioStreamOffset; public IntPtr Param1; // Always just a numeric type - contains no unmanaged resources so does not need special clean-up. public IntPtr Param2; // Can be a numeric type, or pointer to string or object. Use SafeSapiLParamHandle to cleanup. - public static bool operator ==(SpeechEventSapi event1, SpeechEventSapi event2) - { - return event1.EventId == event2.EventId && event1.ParameterType == event2.ParameterType && event1.StreamNumber == event2.StreamNumber && event1.AudioStreamOffset == event2.AudioStreamOffset && event1.Param1 == event2.Param1 && event1.Param2 == event2.Param2; - } - public static bool operator !=(SpeechEventSapi event1, SpeechEventSapi event2) - { - return !(event1 == event2); - } - public override bool Equals(object obj) - { - if (!(obj is SpeechEventSapi)) - { - return false; - } - return this == (SpeechEventSapi)obj; - } - public override int GetHashCode() - { - return base.GetHashCode(); - } + public static bool operator ==(SpeechEventSapi event1, SpeechEventSapi event2) => event1.Equals(event2); + public static bool operator !=(SpeechEventSapi event1, SpeechEventSapi event2) => !event1.Equals(event2); + + public override bool Equals(object obj) => + obj is SpeechEventSapi other && Equals(other); + + public bool Equals(SpeechEventSapi other) => + EventId == other.EventId && + ParameterType == other.ParameterType && + StreamNumber == other.StreamNumber && + AudioStreamOffset == other.AudioStreamOffset && + Param1 == other.Param1 && + Param2 == other.Param2; + + public override int GetHashCode() => base.GetHashCode(); } #endregion diff --git a/src/libraries/System.Text.Encodings.Web/src/Polyfills/System.Text.Rune.netstandard20.cs b/src/libraries/System.Text.Encodings.Web/src/Polyfills/System.Text.Rune.netstandard20.cs index 66c637eda2a2b1..774ee9e426c7e5 100644 --- a/src/libraries/System.Text.Encodings.Web/src/Polyfills/System.Text.Rune.netstandard20.cs +++ b/src/libraries/System.Text.Encodings.Web/src/Polyfills/System.Text.Rune.netstandard20.cs @@ -14,7 +14,7 @@ namespace System.Text { - internal readonly struct Rune + internal readonly struct Rune : IEquatable { private const int MaxUtf16CharsPerRune = 2; // supplementary plane code points are encoded as 2 UTF-16 code units diff --git a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Symbolic/SymbolicMatch.cs b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Symbolic/SymbolicMatch.cs index c6754b8577b0dc..5ba715c25ef4c8 100644 --- a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Symbolic/SymbolicMatch.cs +++ b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Symbolic/SymbolicMatch.cs @@ -5,7 +5,7 @@ namespace System.Text.RegularExpressions.Symbolic { - internal readonly struct SymbolicMatch + internal readonly struct SymbolicMatch : IEquatable { /// Indicates failure to find a match. internal static SymbolicMatch NoMatch => new SymbolicMatch(-1, -1); @@ -20,17 +20,21 @@ public SymbolicMatch(int index, int length) } public int Index { get; } + public int Length { get; } + public bool Success => Index >= 0; public static bool operator ==(SymbolicMatch left, SymbolicMatch right) => - left.Index == right.Index && left.Length == right.Length; + left.Equals(right); public static bool operator !=(SymbolicMatch left, SymbolicMatch right) => - !(left == right); + !left.Equals(right); public override bool Equals([NotNullWhen(true)] object? obj) => - obj is SymbolicMatch other && this == other; + obj is SymbolicMatch other && Equals(other); + + public bool Equals(SymbolicMatch other) => Index == other.Index && Length == other.Length; public override int GetHashCode() => HashCode.Combine(Index, Length); } diff --git a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Symbolic/SymbolicRegexInfo.cs b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Symbolic/SymbolicRegexInfo.cs index ba522d513392c7..4e60696eb07174 100644 --- a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Symbolic/SymbolicRegexInfo.cs +++ b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Symbolic/SymbolicRegexInfo.cs @@ -4,7 +4,7 @@ namespace System.Text.RegularExpressions.Symbolic { /// Misc information of structural properties of a that is computed bottom up. - internal readonly struct SymbolicRegexInfo + internal readonly struct SymbolicRegexInfo : IEquatable { private const uint IsAlwaysNullableMask = 1; private const uint StartsWithLineAnchorMask = 2; @@ -177,7 +177,9 @@ public static SymbolicRegexInfo Not(SymbolicRegexInfo info) => containsSomeCharacter: info.ContainsSomeCharacter, isLazy: info.IsLazy); - public override bool Equals(object? obj) => obj is SymbolicRegexInfo i && i._info == _info; + public override bool Equals(object? obj) => obj is SymbolicRegexInfo i && Equals(i); + + public bool Equals(SymbolicRegexInfo other) => _info == other._info; public override int GetHashCode() => _info.GetHashCode(); diff --git a/src/libraries/System.Threading/ref/System.Threading.cs b/src/libraries/System.Threading/ref/System.Threading.cs index 1237c49cecaedc..3c5f1268e88731 100644 --- a/src/libraries/System.Threading/ref/System.Threading.cs +++ b/src/libraries/System.Threading/ref/System.Threading.cs @@ -235,7 +235,7 @@ public static partial class LazyInitializer public static T EnsureInitialized([System.Diagnostics.CodeAnalysis.NotNullAttribute] ref T? target, System.Func valueFactory) where T : class { throw null; } public static T EnsureInitialized([System.Diagnostics.CodeAnalysis.NotNullAttribute] ref T? target, [System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("syncLock")] ref object? syncLock, System.Func valueFactory) where T : class { throw null; } } - public partial struct LockCookie + public partial struct LockCookie : System.IEquatable { private int _dummyPrimitive; public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } diff --git a/src/libraries/System.Threading/src/System/Threading/LockCookie.cs b/src/libraries/System.Threading/src/System/Threading/LockCookie.cs index 6a76ceb023d0a0..a9c9011179f8fb 100644 --- a/src/libraries/System.Threading/src/System/Threading/LockCookie.cs +++ b/src/libraries/System.Threading/src/System/Threading/LockCookie.cs @@ -9,40 +9,27 @@ namespace System.Threading /// Stores the lock state of a before its lock state is changed, such that the lock state may /// later be restored. /// - public struct LockCookie + public struct LockCookie : IEquatable { internal LockCookieFlags _flags; internal ushort _readerLevel; internal ushort _writerLevel; internal int _threadID; - public override int GetHashCode() - { - return (int)_flags + _readerLevel + _writerLevel + _threadID; - } + public override int GetHashCode() => + (int)_flags + _readerLevel + _writerLevel + _threadID; - public override bool Equals([NotNullWhen(true)] object? obj) - { - return obj is LockCookie && Equals((LockCookie)obj); - } + public override bool Equals([NotNullWhen(true)] object? obj) => + obj is LockCookie other && Equals(other); - public bool Equals(LockCookie obj) - { - return - _flags == obj._flags && - _readerLevel == obj._readerLevel && - _writerLevel == obj._writerLevel && - _threadID == obj._threadID; - } + public bool Equals(LockCookie obj) => + _flags == obj._flags && + _readerLevel == obj._readerLevel && + _writerLevel == obj._writerLevel && + _threadID == obj._threadID; - public static bool operator ==(LockCookie a, LockCookie b) - { - return a.Equals(b); - } + public static bool operator ==(LockCookie a, LockCookie b) => a.Equals(b); - public static bool operator !=(LockCookie a, LockCookie b) - { - return !(a == b); - } + public static bool operator !=(LockCookie a, LockCookie b) => !a.Equals(b); } } diff --git a/src/libraries/System.Transactions.Local/ref/System.Transactions.Local.cs b/src/libraries/System.Transactions.Local/ref/System.Transactions.Local.cs index 91804388b42fa2..f52ae1ffd8b918 100644 --- a/src/libraries/System.Transactions.Local/ref/System.Transactions.Local.cs +++ b/src/libraries/System.Transactions.Local/ref/System.Transactions.Local.cs @@ -202,12 +202,13 @@ protected TransactionManagerCommunicationException(System.Runtime.Serialization. public TransactionManagerCommunicationException(string? message) { } public TransactionManagerCommunicationException(string? message, System.Exception? innerException) { } } - public partial struct TransactionOptions + public partial struct TransactionOptions : System.IEquatable { - private int _dummyPrimitive; + private readonly int _dummyPrimitive; public System.Transactions.IsolationLevel IsolationLevel { get { throw null; } set { } } public System.TimeSpan Timeout { get { throw null; } set { } } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } + public bool Equals(System.Transactions.TransactionOptions other) { throw null; } public override int GetHashCode() { throw null; } public static bool operator ==(System.Transactions.TransactionOptions x, System.Transactions.TransactionOptions y) { throw null; } public static bool operator !=(System.Transactions.TransactionOptions x, System.Transactions.TransactionOptions y) { throw null; } diff --git a/src/libraries/System.Transactions.Local/src/System/Transactions/TransactionOptions.cs b/src/libraries/System.Transactions.Local/src/System/Transactions/TransactionOptions.cs index 1fa34283bb4557..4ce7bb4bd1394a 100644 --- a/src/libraries/System.Transactions.Local/src/System/Transactions/TransactionOptions.cs +++ b/src/libraries/System.Transactions.Local/src/System/Transactions/TransactionOptions.cs @@ -5,7 +5,7 @@ namespace System.Transactions { - public struct TransactionOptions + public struct TransactionOptions : IEquatable { private TimeSpan _timeout; private IsolationLevel _isolationLevel; @@ -26,7 +26,10 @@ public IsolationLevel IsolationLevel public override bool Equals([NotNullWhen(true)] object? obj) => obj is TransactionOptions transactionOptions && Equals(transactionOptions); - private bool Equals(TransactionOptions other) => + /// Indicates whether the current instance is equal to another instance of the same type. + /// An instance to compare with this instance. + /// true if the current instance is equal to the other instance; otherwise, false. + public bool Equals(TransactionOptions other) => _timeout == other._timeout && _isolationLevel == other._isolationLevel; diff --git a/src/mono/System.Private.CoreLib/src/Mono/RuntimeHandles.cs b/src/mono/System.Private.CoreLib/src/Mono/RuntimeHandles.cs index c62dde66120498..90b612313c19d4 100644 --- a/src/mono/System.Private.CoreLib/src/Mono/RuntimeHandles.cs +++ b/src/mono/System.Private.CoreLib/src/Mono/RuntimeHandles.cs @@ -7,7 +7,7 @@ namespace Mono { - internal unsafe struct RuntimeClassHandle + internal unsafe struct RuntimeClassHandle : IEquatable { private readonly RuntimeStructs.MonoClass* value; @@ -125,7 +125,7 @@ private int GetConstraintsCount() } } - internal struct RuntimeEventHandle + internal struct RuntimeEventHandle : IEquatable { private readonly IntPtr value; @@ -165,7 +165,7 @@ public override int GetHashCode() } } - internal struct RuntimePropertyHandle + internal struct RuntimePropertyHandle : IEquatable { private readonly IntPtr value; diff --git a/src/mono/System.Private.CoreLib/src/System/ModuleHandle.cs b/src/mono/System.Private.CoreLib/src/System/ModuleHandle.cs index 9f73b99fb6db90..c30bf25582a3a5 100644 --- a/src/mono/System.Private.CoreLib/src/System/ModuleHandle.cs +++ b/src/mono/System.Private.CoreLib/src/System/ModuleHandle.cs @@ -6,7 +6,7 @@ namespace System { - public struct ModuleHandle + public struct ModuleHandle : IEquatable { private readonly IntPtr value; diff --git a/src/mono/System.Private.CoreLib/src/System/Nullable.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Nullable.Mono.cs index 23f7668e73549b..c1204551999226 100644 --- a/src/mono/System.Private.CoreLib/src/System/Nullable.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Nullable.Mono.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +#pragma warning disable CA1066 // Implement IEquatable when overriding Object.Equals + namespace System { public partial struct Nullable diff --git a/src/mono/wasm/debugger/BrowserDebugProxy/DevToolsHelper.cs b/src/mono/wasm/debugger/BrowserDebugProxy/DevToolsHelper.cs index af1cead1c95935..9b9c5a410cf2ff 100644 --- a/src/mono/wasm/debugger/BrowserDebugProxy/DevToolsHelper.cs +++ b/src/mono/wasm/debugger/BrowserDebugProxy/DevToolsHelper.cs @@ -14,7 +14,7 @@ namespace Microsoft.WebAssembly.Diagnostics { - public struct SessionId + public struct SessionId : IEquatable { public readonly string sessionId; @@ -26,7 +26,9 @@ public SessionId(string sessionId) // hashset treats 0 as unset public override int GetHashCode() => sessionId?.GetHashCode() ?? -1; - public override bool Equals(object obj) => (obj is SessionId) ? ((SessionId)obj).sessionId == sessionId : false; + public override bool Equals(object obj) => obj is SessionId other && Equals(other); + + public bool Equals(SessionId other) => other.sessionId == sessionId; public static bool operator ==(SessionId a, SessionId b) => a.sessionId == b.sessionId; @@ -37,7 +39,7 @@ public SessionId(string sessionId) public override string ToString() => $"session-{sessionId}"; } - public struct MessageId + public struct MessageId : IEquatable { public readonly string sessionId; public readonly int id; @@ -54,7 +56,9 @@ public MessageId(string sessionId, int id) public override int GetHashCode() => (sessionId?.GetHashCode() ?? 0) ^ id.GetHashCode(); - public override bool Equals(object obj) => (obj is MessageId) ? ((MessageId)obj).sessionId == sessionId && ((MessageId)obj).id == id : false; + public override bool Equals(object obj) => obj is MessageId other && Equals(other); + + public bool Equals(MessageId other) => other.sessionId == sessionId && other.id == id; } internal class DotnetObjectId diff --git a/src/tasks/WasmAppBuilder/PInvokeTableGenerator.cs b/src/tasks/WasmAppBuilder/PInvokeTableGenerator.cs index 9526a602876f28..34b42e2db3ad63 100644 --- a/src/tasks/WasmAppBuilder/PInvokeTableGenerator.cs +++ b/src/tasks/WasmAppBuilder/PInvokeTableGenerator.cs @@ -478,7 +478,9 @@ private static bool IsBlittable (Type type) private static void Error (string msg) => throw new LogAsErrorException(msg); } +#pragma warning disable CA1067 internal sealed class PInvoke : IEquatable +#pragma warning restore CA1067 { public PInvoke(string entryPoint, string module, MethodInfo method) { From 6cf765e72719a73d43c37e8d1ddfcb54a0e89564 Mon Sep 17 00:00:00 2001 From: imhameed Date: Mon, 24 Jan 2022 10:28:49 -0500 Subject: [PATCH 033/161] [mono] Temporarily disable two tests that fail on arm64 LLVM FullAOT. (#64180) --- src/tests/issues.targets | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/tests/issues.targets b/src/tests/issues.targets index edf95e8c106f62..d6aa159fba256f 100644 --- a/src/tests/issues.targets +++ b/src/tests/issues.targets @@ -2805,6 +2805,13 @@ This test includes an intentionally-invalid UnmanagedCallersOnly method. Invalid UnmanagedCallersOnly methods cause failures at AOT-time. + + + https://github.com/dotnet/runtime/issues/64179 + + + https://github.com/dotnet/runtime/issues/64179 + From eb8a502a0cac4733cdfb30e39288a808f51851ba Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Mon, 24 Jan 2022 10:33:04 -0500 Subject: [PATCH 034/161] Delete stale reference in System.Drawing.Primitives (#64202) --- .../src/System.Drawing.Primitives.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj b/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj index 162b5d563a72d3..e8328af20cde96 100644 --- a/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj +++ b/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj @@ -36,7 +36,6 @@ Link="Common\Interop\Windows\User32\Interop.Win32SystemColors.cs" /> - From d99fa6789ad213df87358b0bd6fbffd9e0c31371 Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Mon, 24 Jan 2022 10:42:15 -0600 Subject: [PATCH 035/161] Respond to feedback in GenerateMultiTargetRoslynComponentTargetsFile (#63943) * Respond to feedback in GenerateMultiTargetRoslynComponentTargetsFile Two small follow up changes from #58446 - Fix a type-o that breaks incremental build. Forgot to use MSBuild property syntax - Instead of having the infrastructure hard-code removing 'Abstractions', packages can set their own Disable source gen property name. * PR feedback --- docs/coding-guidelines/libraries-packaging.md | 7 +++++++ eng/packaging.targets | 7 +++---- .../src/Microsoft.Extensions.Logging.Abstractions.csproj | 1 + 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/coding-guidelines/libraries-packaging.md b/docs/coding-guidelines/libraries-packaging.md index 9e07a0683fd8d0..66909e4df855cf 100644 --- a/docs/coding-guidelines/libraries-packaging.md +++ b/docs/coding-guidelines/libraries-packaging.md @@ -86,5 +86,12 @@ In the analyzer project make sure to do the following. Ensure it only targets `n ``` +In order to mitigate design-time/build-time performance issues with source generators, we generate build logic to allow the end user to disable the source generator from the package. By default, the MSBuild property an end user can set is named `Disable{PackageId}SourceGenerator`. If a package needs a custom property name, this can be overriden by setting the following property in the project that produces the package +```xml + + CustomPropertyName + +``` + ### .NETFramework RID specific assets When targeting .NETFramework, RID specific assets are automatically added to the package if the project contains other compatible RID specific assets, mainly `netstandard2.0-windows`. diff --git a/eng/packaging.targets b/eng/packaging.targets index 667837fbff1067..c305c64dd94090 100644 --- a/eng/packaging.targets +++ b/eng/packaging.targets @@ -162,19 +162,18 @@ <_MultiTargetRoslynComponentTargetPrefix>$(PackageId.Replace('.', '_')) - <_MultiTargetRoslynComponentDisableSourceGeneratorPropertyName>Disable$(PackageId.Replace('.', ''))SourceGenerator - <_MultiTargetRoslynComponentDisableSourceGeneratorPropertyName>$(_MultiTargetRoslynComponentDisableSourceGeneratorPropertyName.Replace('Abstractions', '')) + Disable$(PackageId.Replace('.', ''))SourceGenerator diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/Microsoft.Extensions.Logging.Abstractions.csproj b/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/Microsoft.Extensions.Logging.Abstractions.csproj index 8ca2bab854730e..eb95f66e4f5a36 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/Microsoft.Extensions.Logging.Abstractions.csproj +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/Microsoft.Extensions.Logging.Abstractions.csproj @@ -18,6 +18,7 @@ Microsoft.Extensions.Logging.LogLevel Microsoft.Extensions.Logging.Logger<T> Microsoft.Extensions.Logging.LoggerMessage Microsoft.Extensions.Logging.Abstractions.NullLogger + DisableMicrosoftExtensionsLoggingSourceGenerator From 2713e11deefb1757644dc2366c35379dd95f7b08 Mon Sep 17 00:00:00 2001 From: Kevin Jones Date: Mon, 24 Jan 2022 12:52:58 -0500 Subject: [PATCH 036/161] Use the static HashData(Stream) method in more places --- .../AsymmetricAlgorithmHelpers.Hash.cs | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/libraries/Common/src/Internal/Cryptography/AsymmetricAlgorithmHelpers.Hash.cs b/src/libraries/Common/src/Internal/Cryptography/AsymmetricAlgorithmHelpers.Hash.cs index dc3e3426596e99..a4c41cfbcac620 100644 --- a/src/libraries/Common/src/Internal/Cryptography/AsymmetricAlgorithmHelpers.Hash.cs +++ b/src/libraries/Common/src/Internal/Cryptography/AsymmetricAlgorithmHelpers.Hash.cs @@ -34,16 +34,21 @@ public static byte[] HashData(byte[] data, int offset, int count, HashAlgorithmN throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithm.Name); } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA5350", Justification = "SHA1 is used when the user asks for it.")] + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA5351", Justification = "MD5 is used when the user asks for it.")] public static byte[] HashData(Stream data, HashAlgorithmName hashAlgorithm) { // The classes that call us are sealed and their base class has checked this already. Debug.Assert(data != null); Debug.Assert(!string.IsNullOrEmpty(hashAlgorithm.Name)); - using (HashAlgorithm hasher = GetHashAlgorithm(hashAlgorithm)) - { - return hasher.ComputeHash(data); - } + return + hashAlgorithm == HashAlgorithmName.SHA256 ? SHA256.HashData(data) : + hashAlgorithm == HashAlgorithmName.SHA1 ? SHA1.HashData(data) : + hashAlgorithm == HashAlgorithmName.SHA512 ? SHA512.HashData(data) : + hashAlgorithm == HashAlgorithmName.SHA384 ? SHA384.HashData(data) : + hashAlgorithm == HashAlgorithmName.MD5 ? MD5.HashData(data) : + throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithm.Name); } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA5350", Justification = "SHA1 is used when the user asks for it.")] @@ -61,15 +66,5 @@ public static bool TryHashData(ReadOnlySpan source, Span destination hashAlgorithm == HashAlgorithmName.MD5 ? MD5.TryHashData(source, destination, out bytesWritten) : throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithm.Name); } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA5350", Justification = "SHA1 is used when the user asks for it.")] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA5351", Justification = "MD5 is used when the user asks for it.")] - private static HashAlgorithm GetHashAlgorithm(HashAlgorithmName hashAlgorithmName) => - hashAlgorithmName == HashAlgorithmName.SHA256 ? SHA256.Create() : - hashAlgorithmName == HashAlgorithmName.SHA1 ? SHA1.Create() : - hashAlgorithmName == HashAlgorithmName.SHA512 ? SHA512.Create() : - hashAlgorithmName == HashAlgorithmName.SHA384 ? SHA384.Create() : - hashAlgorithmName == HashAlgorithmName.MD5 ? MD5.Create() : - throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithmName.Name); } } From 02eaf5f1bb8f8eac1c7528a1b223087a1b76a7d4 Mon Sep 17 00:00:00 2001 From: Gleb Balykov Date: Mon, 24 Jan 2022 21:21:44 +0300 Subject: [PATCH 037/161] Add executable bit to tizen sh files (#64216) --- eng/common/cross/arm/tizen-build-rootfs.sh | 0 eng/common/cross/arm/tizen-fetch.sh | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 eng/common/cross/arm/tizen-build-rootfs.sh mode change 100644 => 100755 eng/common/cross/arm/tizen-fetch.sh diff --git a/eng/common/cross/arm/tizen-build-rootfs.sh b/eng/common/cross/arm/tizen-build-rootfs.sh old mode 100644 new mode 100755 diff --git a/eng/common/cross/arm/tizen-fetch.sh b/eng/common/cross/arm/tizen-fetch.sh old mode 100644 new mode 100755 From b923e9929d7a7e723e21817cd2f307aa44e3f20b Mon Sep 17 00:00:00 2001 From: Carlos Sanchez <1175054+carlossanlop@users.noreply.github.com> Date: Mon, 24 Jan 2022 10:40:18 -0800 Subject: [PATCH 038/161] Bump Intellisensense package version to latest from `dotnet7-transport` (#63352) --- NuGet.config | 1 + eng/Versions.props | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/NuGet.config b/NuGet.config index f74e0c4a70248a..01da6689762612 100644 --- a/NuGet.config +++ b/NuGet.config @@ -15,6 +15,7 @@ + diff --git a/eng/Versions.props b/eng/Versions.props index 85e7bdd4cdc822..6484ee772cec7c 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -114,7 +114,7 @@ 4.3.0 4.3.0 4.3.0 - 6.0.0-rc.2.21454.1 + 6.0.0 4.3.1 5.0.0 5.0.0 @@ -175,7 +175,7 @@ 7.0.100-alpha.1.21528.1 1.1.1-beta1.21467.5 - 6.0.0-preview-20211019.1 + 6.0.0-preview-20220104.1 7.0.100-1.22063.2 $(MicrosoftNETILLinkTasksVersion) From 0ef4f467482c1404b01d1f6ada0b2968ac219fc5 Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Mon, 24 Jan 2022 11:01:19 -0800 Subject: [PATCH 039/161] Ensure that we aren't accidentally generating instructions for unsupported ISAs (#64140) * Assert that the ISA of the set intrinsic ID is supported * Ensure gtNewSimdCmpOpAllNode and gtNewSimdCmpOpAnyNode don't generate AVX2 instructions when not supported * Ensure codegen for Vector128.Dot when SSSE3 is disabled is correct * Update src/coreclr/jit/hwintrinsiccodegenarm64.cpp Co-authored-by: Jan Kotas * Ensure Vector256.Sum has a check for AVX2 Co-authored-by: Jan Kotas --- src/coreclr/jit/gentree.cpp | 61 ++++++++++++++------- src/coreclr/jit/hwintrinsiccodegenarm64.cpp | 3 + src/coreclr/jit/hwintrinsiccodegenxarch.cpp | 3 + src/coreclr/jit/hwintrinsicxarch.cpp | 25 +++++---- src/coreclr/jit/lowerxarch.cpp | 2 +- 5 files changed, 64 insertions(+), 30 deletions(-) diff --git a/src/coreclr/jit/gentree.cpp b/src/coreclr/jit/gentree.cpp index 678a2a60409db7..8c9450cfbf5649 100644 --- a/src/coreclr/jit/gentree.cpp +++ b/src/coreclr/jit/gentree.cpp @@ -19294,20 +19294,22 @@ GenTree* Compiler::gtNewSimdCmpOpAllNode(genTreeOps op, NamedIntrinsic intrinsic = NI_Illegal; -#if defined(TARGET_XARCH) - if (simdSize == 32) - { - assert(compIsaSupportedDebugOnly(InstructionSet_AVX)); - assert(varTypeIsFloating(simdBaseType) || compIsaSupportedDebugOnly(InstructionSet_AVX2)); - } -#endif // TARGET_XARCH - switch (op) { #if defined(TARGET_XARCH) case GT_EQ: { - intrinsic = (simdSize == 32) ? NI_Vector256_op_Equality : NI_Vector128_op_Equality; + if (simdSize == 32) + { + assert(compIsaSupportedDebugOnly(InstructionSet_AVX)); + assert(varTypeIsFloating(simdBaseType) || compIsaSupportedDebugOnly(InstructionSet_AVX2)); + + intrinsic = NI_Vector256_op_Equality; + } + else + { + intrinsic = NI_Vector128_op_Equality; + } break; } @@ -19323,6 +19325,12 @@ GenTree* Compiler::gtNewSimdCmpOpAllNode(genTreeOps op, if (simdSize == 32) { + // TODO-XArch-CQ: It's a non-trivial amount of work to support these + // for floating-point while only utilizing AVX. It would require, among + // other things, inverting the comparison and potentially support for a + // new Avx.TestNotZ intrinsic to ensure the codegen remains efficient. + assert(compIsaSupportedDebugOnly(InstructionSet_AVX2)); + intrinsic = NI_Vector256_op_Equality; getAllBitsSet = NI_Vector256_get_AllBitsSet; } @@ -19433,14 +19441,6 @@ GenTree* Compiler::gtNewSimdCmpOpAnyNode(genTreeOps op, NamedIntrinsic intrinsic = NI_Illegal; -#if defined(TARGET_XARCH) - if (simdSize == 32) - { - assert(compIsaSupportedDebugOnly(InstructionSet_AVX)); - assert(varTypeIsFloating(simdBaseType) || compIsaSupportedDebugOnly(InstructionSet_AVX2)); - } -#endif // TARGET_XARCH - switch (op) { #if defined(TARGET_XARCH) @@ -19453,7 +19453,20 @@ GenTree* Compiler::gtNewSimdCmpOpAnyNode(genTreeOps op, // We want to generate a comparison along the lines of // GT_XX(op1, op2).As() != Vector128.Zero - intrinsic = (simdSize == 32) ? NI_Vector256_op_Inequality : NI_Vector128_op_Inequality; + if (simdSize == 32) + { + // TODO-XArch-CQ: It's a non-trivial amount of work to support these + // for floating-point while only utilizing AVX. It would require, among + // other things, inverting the comparison and potentially support for a + // new Avx.TestNotZ intrinsic to ensure the codegen remains efficient. + assert(compIsaSupportedDebugOnly(InstructionSet_AVX2)); + + intrinsic = NI_Vector256_op_Inequality; + } + else + { + intrinsic = NI_Vector128_op_Inequality; + } op1 = gtNewSimdCmpOpNode(op, simdType, op1, op2, simdBaseJitType, simdSize, /* isSimdAsHWIntrinsic */ false); @@ -19475,7 +19488,17 @@ GenTree* Compiler::gtNewSimdCmpOpAnyNode(genTreeOps op, case GT_NE: { - intrinsic = (simdSize == 32) ? NI_Vector256_op_Inequality : NI_Vector128_op_Inequality; + if (simdSize == 32) + { + assert(compIsaSupportedDebugOnly(InstructionSet_AVX)); + assert(varTypeIsFloating(simdBaseType) || compIsaSupportedDebugOnly(InstructionSet_AVX2)); + + intrinsic = NI_Vector256_op_Inequality; + } + else + { + intrinsic = NI_Vector128_op_Inequality; + } break; } #elif defined(TARGET_ARM64) diff --git a/src/coreclr/jit/hwintrinsiccodegenarm64.cpp b/src/coreclr/jit/hwintrinsiccodegenarm64.cpp index e4b9a1326680c0..6dfe48047c094e 100644 --- a/src/coreclr/jit/hwintrinsiccodegenarm64.cpp +++ b/src/coreclr/jit/hwintrinsiccodegenarm64.cpp @@ -206,6 +206,9 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node) { const HWIntrinsic intrin(node); + // We need to validate that other phases of the compiler haven't introduced unsupported intrinsics + assert(compiler->compIsaSupportedDebugOnly(HWIntrinsicInfo::lookupIsa(intrin.id))); + regNumber targetReg = node->GetRegNum(); regNumber op1Reg = REG_NA; diff --git a/src/coreclr/jit/hwintrinsiccodegenxarch.cpp b/src/coreclr/jit/hwintrinsiccodegenxarch.cpp index d6490c59b2e360..10c8dcaedb197a 100644 --- a/src/coreclr/jit/hwintrinsiccodegenxarch.cpp +++ b/src/coreclr/jit/hwintrinsiccodegenxarch.cpp @@ -86,6 +86,9 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node) HWIntrinsicCategory category = HWIntrinsicInfo::lookupCategory(intrinsicId); size_t numArgs = node->GetOperandCount(); + // We need to validate that other phases of the compiler haven't introduced unsupported intrinsics + assert(compiler->compIsaSupportedDebugOnly(isa)); + int ival = HWIntrinsicInfo::lookupIval(intrinsicId, compiler->compOpportunisticallyDependsOn(InstructionSet_AVX)); assert(HWIntrinsicInfo::RequiresCodegen(intrinsicId)); diff --git a/src/coreclr/jit/hwintrinsicxarch.cpp b/src/coreclr/jit/hwintrinsicxarch.cpp index f1b84825f21762..aec1be705f3db8 100644 --- a/src/coreclr/jit/hwintrinsicxarch.cpp +++ b/src/coreclr/jit/hwintrinsicxarch.cpp @@ -1024,7 +1024,7 @@ GenTree* Compiler::impBaseIntrinsic(NamedIntrinsic intrinsic, { assert(sig->numArgs == 2); - if ((simdSize != 32) || varTypeIsFloating(simdBaseType) || compExactlyDependsOn(InstructionSet_AVX2)) + if ((simdSize != 32) || compExactlyDependsOn(InstructionSet_AVX2)) { var_types simdType = getSIMDTypeForSize(simdSize); @@ -1287,7 +1287,7 @@ GenTree* Compiler::impBaseIntrinsic(NamedIntrinsic intrinsic, { assert(sig->numArgs == 2); - if ((simdSize != 32) || varTypeIsFloating(simdBaseType) || compExactlyDependsOn(InstructionSet_AVX2)) + if ((simdSize != 32) || compExactlyDependsOn(InstructionSet_AVX2)) { var_types simdType = getSIMDTypeForSize(simdSize); @@ -1305,7 +1305,7 @@ GenTree* Compiler::impBaseIntrinsic(NamedIntrinsic intrinsic, { assert(sig->numArgs == 2); - if ((simdSize != 32) || varTypeIsFloating(simdBaseType) || compExactlyDependsOn(InstructionSet_AVX2)) + if ((simdSize != 32) || compExactlyDependsOn(InstructionSet_AVX2)) { var_types simdType = getSIMDTypeForSize(simdSize); @@ -1339,7 +1339,7 @@ GenTree* Compiler::impBaseIntrinsic(NamedIntrinsic intrinsic, { assert(sig->numArgs == 2); - if ((simdSize != 32) || varTypeIsFloating(simdBaseType) || compExactlyDependsOn(InstructionSet_AVX2)) + if ((simdSize != 32) || compExactlyDependsOn(InstructionSet_AVX2)) { var_types simdType = getSIMDTypeForSize(simdSize); @@ -1357,7 +1357,7 @@ GenTree* Compiler::impBaseIntrinsic(NamedIntrinsic intrinsic, { assert(sig->numArgs == 2); - if ((simdSize != 32) || varTypeIsFloating(simdBaseType) || compExactlyDependsOn(InstructionSet_AVX2)) + if ((simdSize != 32) || compExactlyDependsOn(InstructionSet_AVX2)) { var_types simdType = getSIMDTypeForSize(simdSize); @@ -1391,7 +1391,7 @@ GenTree* Compiler::impBaseIntrinsic(NamedIntrinsic intrinsic, { assert(sig->numArgs == 2); - if ((simdSize != 32) || varTypeIsFloating(simdBaseType) || compExactlyDependsOn(InstructionSet_AVX2)) + if ((simdSize != 32) || compExactlyDependsOn(InstructionSet_AVX2)) { var_types simdType = getSIMDTypeForSize(simdSize); @@ -1409,7 +1409,7 @@ GenTree* Compiler::impBaseIntrinsic(NamedIntrinsic intrinsic, { assert(sig->numArgs == 2); - if ((simdSize != 32) || varTypeIsFloating(simdBaseType) || compExactlyDependsOn(InstructionSet_AVX2)) + if ((simdSize != 32) || compExactlyDependsOn(InstructionSet_AVX2)) { var_types simdType = getSIMDTypeForSize(simdSize); @@ -1443,7 +1443,7 @@ GenTree* Compiler::impBaseIntrinsic(NamedIntrinsic intrinsic, { assert(sig->numArgs == 2); - if ((simdSize != 32) || varTypeIsFloating(simdBaseType) || compExactlyDependsOn(InstructionSet_AVX2)) + if ((simdSize != 32) || compExactlyDependsOn(InstructionSet_AVX2)) { var_types simdType = getSIMDTypeForSize(simdSize); @@ -1461,7 +1461,7 @@ GenTree* Compiler::impBaseIntrinsic(NamedIntrinsic intrinsic, { assert(sig->numArgs == 2); - if ((simdSize != 32) || varTypeIsFloating(simdBaseType) || compExactlyDependsOn(InstructionSet_AVX2)) + if ((simdSize != 32) || compExactlyDependsOn(InstructionSet_AVX2)) { var_types simdType = getSIMDTypeForSize(simdSize); @@ -2024,7 +2024,12 @@ GenTree* Compiler::impBaseIntrinsic(NamedIntrinsic intrinsic, assert(sig->numArgs == 1); var_types simdType = getSIMDTypeForSize(simdSize); - if (varTypeIsFloating(simdBaseType)) + if ((simdSize == 32) && !compOpportunisticallyDependsOn(InstructionSet_AVX2)) + { + // Vector256 for integer types requires AVX2 + break; + } + else if (varTypeIsFloating(simdBaseType)) { if (!compOpportunisticallyDependsOn(InstructionSet_SSE3)) { diff --git a/src/coreclr/jit/lowerxarch.cpp b/src/coreclr/jit/lowerxarch.cpp index a6b0ceb91ba955..1331644a0a992b 100644 --- a/src/coreclr/jit/lowerxarch.cpp +++ b/src/coreclr/jit/lowerxarch.cpp @@ -3456,7 +3456,7 @@ void Lowering::LowerHWIntrinsicDot(GenTreeHWIntrinsic* node) // e6, e7, e4, e5 | e2, e3, e0, e1 // e7, e6, e5, e4 | e3, e2, e1, e0 - shuffleConst = 0x4D; + shuffleConst = 0x4E; break; } From 29cc2a2c23ce15469575a0b25c8b8b453a1d975f Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Mon, 24 Jan 2022 20:32:43 +0100 Subject: [PATCH 040/161] Don't reference .NETFramework shims in libraries product or test composition (#64193) * Don't reference .NETFramework shims Stop referencing .NETFramework shims in libraries ref or source projects as those are supplementary and shouldn't impact the product composition. --- src/libraries/System.Data.Odbc/src/System.Data.Odbc.csproj | 1 - .../System.Formats.Cbor/src/System.Formats.Cbor.csproj | 1 - src/libraries/System.IO.FileSystem/tests/File/EncryptDecrypt.cs | 2 -- .../tests/FunctionalTests/SocketDuplicationTests.cs | 1 - 4 files changed, 5 deletions(-) diff --git a/src/libraries/System.Data.Odbc/src/System.Data.Odbc.csproj b/src/libraries/System.Data.Odbc/src/System.Data.Odbc.csproj index 9cc4d09bf298b6..2005ee7715654e 100644 --- a/src/libraries/System.Data.Odbc/src/System.Data.Odbc.csproj +++ b/src/libraries/System.Data.Odbc/src/System.Data.Odbc.csproj @@ -176,7 +176,6 @@ System.Data.Odbc.OdbcTransaction - diff --git a/src/libraries/System.Formats.Cbor/src/System.Formats.Cbor.csproj b/src/libraries/System.Formats.Cbor/src/System.Formats.Cbor.csproj index 29b98e85415777..c4783ca29c1670 100644 --- a/src/libraries/System.Formats.Cbor/src/System.Formats.Cbor.csproj +++ b/src/libraries/System.Formats.Cbor/src/System.Formats.Cbor.csproj @@ -49,7 +49,6 @@ System.Formats.Cbor.CborWriter - diff --git a/src/libraries/System.IO.FileSystem/tests/File/EncryptDecrypt.cs b/src/libraries/System.IO.FileSystem/tests/File/EncryptDecrypt.cs index c4d34c320668ef..d4965d1dbedb60 100644 --- a/src/libraries/System.IO.FileSystem/tests/File/EncryptDecrypt.cs +++ b/src/libraries/System.IO.FileSystem/tests/File/EncryptDecrypt.cs @@ -3,9 +3,7 @@ using Microsoft.DotNet.XUnitExtensions; using System.Diagnostics; -using System.Diagnostics.Eventing.Reader; using System.Security; -using System.ServiceProcess; using Xunit; using Xunit.Abstractions; diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketDuplicationTests.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketDuplicationTests.cs index 8e257352fd18c3..b59c5ebd92a33e 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketDuplicationTests.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketDuplicationTests.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics; -using System.Drawing.Drawing2D; using System.IO; using System.IO.Pipes; using System.Runtime.Serialization.Formatters.Binary; From 1c509934921d6a8b52cc9cb48e983b56da759580 Mon Sep 17 00:00:00 2001 From: Mitchell Hwang <16830051+mdh1418@users.noreply.github.com> Date: Mon, 24 Jan 2022 15:06:56 -0500 Subject: [PATCH 041/161] [Android][libs] Enable Internal.Console.Write in System.Private.CoreLib (#63949) * [Android][libs] Enable Internal.Console.Write in System.Private.CoreLib * [docs] Add debugging System.Private.CoreLib Internal.Console.Write * Elaborate on debugging corelib log * Address feedback --- .../debugging/libraries/debugging-corelib.md | 7 ++++++ .../src/Internal/Console.Android.cs | 24 +++++++++++++++++++ .../System.Private.CoreLib.Shared.projitems | 9 ++++++- 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 docs/workflow/debugging/libraries/debugging-corelib.md create mode 100644 src/libraries/System.Private.CoreLib/src/Internal/Console.Android.cs diff --git a/docs/workflow/debugging/libraries/debugging-corelib.md b/docs/workflow/debugging/libraries/debugging-corelib.md new file mode 100644 index 00000000000000..9dd817d5bf7ff7 --- /dev/null +++ b/docs/workflow/debugging/libraries/debugging-corelib.md @@ -0,0 +1,7 @@ +Debugging System.Private.CoreLib +========================== + +`System.Console.Write`/`System.Console.WriteLine` cannot be used in `System.Private.CoreLib`. Instead, use `Internal.Console.Write` to add temporary logging for printf-style debugging. + +### Android +The logs can be found through the generated Android Debug Bridge log or viewed directly through ADB logcat. diff --git a/src/libraries/System.Private.CoreLib/src/Internal/Console.Android.cs b/src/libraries/System.Private.CoreLib/src/Internal/Console.Android.cs new file mode 100644 index 00000000000000..a1f427d0af7f11 --- /dev/null +++ b/src/libraries/System.Private.CoreLib/src/Internal/Console.Android.cs @@ -0,0 +1,24 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Runtime.InteropServices; + +namespace Internal +{ + public static partial class Console + { + public static unsafe void Write(string s) + { + Interop.Logcat.AndroidLogPrint(Interop.Logcat.LogLevel.Debug, "DOTNET", s ?? string.Empty); + } + + public static partial class Error + { + public static unsafe void Write(string s) + { + Interop.Logcat.AndroidLogPrint(Interop.Logcat.LogLevel.Error, "DOTNET", s ?? string.Empty); + } + } + } +} \ No newline at end of file diff --git a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems index ebbc2d77b6a93a..d5ce32af96642c 100644 --- a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems +++ b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems @@ -2120,7 +2120,14 @@ Common\System\IO\PathInternal.Unix.cs - + + + + Common\Interop\Android\Interop.Logcat.cs + + + Common\Interop\Android\Interop.Libraries.cs + From ae755ab3c7f838f7dccd2a4c2d5934a9d7d82c69 Mon Sep 17 00:00:00 2001 From: Fan Yang <52458914+fanyang-mono@users.noreply.github.com> Date: Mon, 24 Jan 2022 15:10:22 -0500 Subject: [PATCH 042/161] Install v8 and Prebuild wasm (#64100) --- .devcontainer/Dockerfile | 9 +++++++++ .devcontainer/scripts/onCreateCommand.sh | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 31ff731b029117..2634a9528f1eea 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -10,3 +10,12 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ build-essential python curl git lldb-6.0 liblldb-6.0-dev \ libunwind8 libunwind8-dev gettext libicu-dev liblttng-ust-dev \ libssl-dev libnuma-dev libkrb5-dev zlib1g-dev ninja-build + +# Install V8 Engine +SHELL ["/bin/bash", "-c"] + +RUN curl -sSL "https://netcorenativeassets.blob.core.windows.net/resource-packages/external/linux/chromium-v8/v8-linux64-rel-8.5.183.zip" -o ./v8.zip \ + && unzip ./v8.zip -d /usr/local/v8 \ + && echo $'#!/usr/bin/env bash\n\ +"/usr/local/v8/d8" --snapshot_blob="/usr/local/v8/snapshot_blob.bin" "$@"\n' > /usr/local/bin/v8 \ + && chmod +x /usr/local/bin/v8 \ No newline at end of file diff --git a/.devcontainer/scripts/onCreateCommand.sh b/.devcontainer/scripts/onCreateCommand.sh index faf7cb08d1afae..9a7e6718ba32d4 100755 --- a/.devcontainer/scripts/onCreateCommand.sh +++ b/.devcontainer/scripts/onCreateCommand.sh @@ -7,5 +7,10 @@ set -e # restore libs tests so that the project is ready to be loaded by OmniSharp ./build.sh libs.tests -restore +# prebuild for WASM, so it is ready for wasm development +make -C src/mono/wasm provision-wasm +export EMSDK_PATH=$PWD/src/mono/wasm/emsdk +./build.sh mono+libs -os Browser -c release + # save the commit hash of the currently built assemblies, so developers know which version was built git rev-parse HEAD > ./artifacts/prebuild.sha From df69293bdbe75bf5903583c472fcd257119dbda4 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Mon, 24 Jan 2022 16:29:57 -0500 Subject: [PATCH 043/161] Port Mono to Raspberry Pi, ship as new linux-armv6 RID (#62594) * Initial ARMv6 arch addition. Builds mono runtime, not CoreCLR (Mono already supports the CPU arch subset used by Raspberry Pi, whilst porting CoreCLR to e.g. VFPv2 would be major work) * Build small clr subset on ARMv6, it's needed for SDK and we want to check it works --- Directory.Build.props | 1 + eng/Subsets.props | 2 +- eng/build.sh | 6 +-- eng/native/build-commons.sh | 6 ++- eng/native/configurecompiler.cmake | 19 +++++++++ eng/native/configureplatform.cmake | 13 ++++++ eng/native/configuretools.cmake | 4 +- eng/native/functions.cmake | 6 ++- eng/native/init-os-and-arch.sh | 4 ++ eng/native/tryrun.cmake | 6 +-- eng/pipelines/common/platform-matrix.yml | 25 ++++++++++++ .../libraries/helix-queues-setup.yml | 5 +++ eng/pipelines/runtime-staging.yml | 40 +++++++++++++++++++ eng/targetingpacks.targets | 4 +- src/coreclr/inc/volatile.h | 5 ++- src/coreclr/jit/CMakeLists.txt | 20 +++++++++- src/coreclr/pal/inc/unixasmmacros.inc | 2 + src/coreclr/pal/inc/unixasmmacrosarm.inc | 4 ++ src/coreclr/pal/src/CMakeLists.txt | 3 ++ .../src/arch/arm/callsignalhandlerwrapper.S | 2 + src/coreclr/pal/src/arch/arm/context2.S | 2 + src/coreclr/pal/src/arch/arm/debugbreak.S | 2 + .../pal/src/arch/arm/exceptionhelper.S | 2 + src/coreclr/pal/src/libunwind/CMakeLists.txt | 11 ++++- .../pal/src/libunwind/src/CMakeLists.txt | 10 +++++ .../pkg/projects/netcoreappRIDs.props | 3 ++ .../src/runtime.compatibility.json | 16 +++++++- .../src/runtime.json | 13 +++++- .../src/runtimeGroups.props | 4 +- .../Runtime/InteropServices/Architecture.cs | 3 +- .../RuntimeInformation.ProcessArchitecture.cs | 2 + .../tests/CheckArchitectureTests.cs | 4 ++ .../System.Runtime/ref/System.Runtime.cs | 1 + src/libraries/externals.csproj | 2 +- src/libraries/tests.proj | 2 +- src/mono/CMakeLists.txt | 13 +++++- .../System.Private.CoreLib.csproj | 6 ++- src/mono/mono.proj | 14 ++++++- .../corehost/fxr/standalone/CMakeLists.txt | 4 ++ src/native/corehost/hostmisc/utils.cpp | 2 + .../corehost/test/nativehost/CMakeLists.txt | 4 ++ src/native/eventpipe/ep-event-source.c | 2 + .../System.Native/pal_runtimeinformation.h | 3 +- 43 files changed, 272 insertions(+), 30 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index e9e6fc4e362346..d862ee091fe81b 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -29,6 +29,7 @@ <_hostArch>$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant) $(_hostArch) arm + armv6 armel arm64 loongarch64 diff --git a/eng/Subsets.props b/eng/Subsets.props index 5ce54174451364..fbe6f9712686ed 100644 --- a/eng/Subsets.props +++ b/eng/Subsets.props @@ -27,7 +27,7 @@ flavor is used to decide when to build the hosts and installers. --> CoreCLR - Mono + Mono diff --git a/eng/build.sh b/eng/build.sh index ea8e3089e95f4d..167f8e2014182e 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -17,7 +17,7 @@ scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" usage() { echo "Common settings:" - echo " --arch (-a) Target platform: x86, x64, arm, armel, arm64, loongarch64, s390x or wasm." + echo " --arch (-a) Target platform: x86, x64, arm, armv6, armel, arm64, loongarch64, s390x or wasm." echo " [Default: Your machine's architecture.]" echo " --binaryLog (-bl) Output binary log." echo " --cross Optional argument to signify cross compilation." @@ -206,12 +206,12 @@ while [[ $# > 0 ]]; do fi passedArch="$(echo "$2" | tr "[:upper:]" "[:lower:]")" case "$passedArch" in - x64|x86|arm|armel|arm64|loongarch64|s390x|wasm) + x64|x86|arm|armv6|armel|arm64|loongarch64|s390x|wasm) arch=$passedArch ;; *) echo "Unsupported target architecture '$2'." - echo "The allowed values are x86, x64, arm, armel, arm64, loongarch64, s390x, and wasm." + echo "The allowed values are x86, x64, arm, armv6, armel, arm64, loongarch64, s390x, and wasm." exit 1 ;; esac diff --git a/eng/native/build-commons.sh b/eng/native/build-commons.sh index 373091b13a0014..294e9832ad3105 100755 --- a/eng/native/build-commons.sh +++ b/eng/native/build-commons.sh @@ -197,7 +197,7 @@ usage() echo "" echo "Common Options:" echo "" - echo "BuildArch can be: -arm, -armel, -arm64, -loongarch64, -s390x, x64, x86, -wasm" + echo "BuildArch can be: -arm, -armv6, -armel, -arm64, -loongarch64, -s390x, x64, x86, -wasm" echo "BuildType can be: -debug, -checked, -release" echo "-os: target OS (defaults to running OS)" echo "-bindir: output directory (defaults to $__ProjectRoot/artifacts)" @@ -270,6 +270,10 @@ while :; do __BuildArch=arm ;; + armv6|-armv6) + __BuildArch=armv6 + ;; + arm64|-arm64) __BuildArch=arm64 ;; diff --git a/eng/native/configurecompiler.cmake b/eng/native/configurecompiler.cmake index fad1ac58d39c88..b67594cb60fb2a 100644 --- a/eng/native/configurecompiler.cmake +++ b/eng/native/configurecompiler.cmake @@ -213,6 +213,9 @@ elseif (CLR_CMAKE_HOST_ARCH_I386) elseif (CLR_CMAKE_HOST_ARCH_ARM) set(ARCH_HOST_NAME arm) add_definitions(-DHOST_ARM) +elseif (CLR_CMAKE_HOST_ARCH_ARMV6) + set(ARCH_HOST_NAME armv6) + add_definitions(-DHOST_ARMV6) elseif (CLR_CMAKE_HOST_ARCH_ARM64) set(ARCH_HOST_NAME arm64) add_definitions(-DHOST_ARM64 -DHOST_64BIT) @@ -238,6 +241,8 @@ if (CLR_CMAKE_HOST_UNIX) message("Detected Linux x86_64") elseif(CLR_CMAKE_HOST_UNIX_ARM) message("Detected Linux ARM") + elseif(CLR_CMAKE_HOST_UNIX_ARMV6) + message("Detected Linux ARMv6") elseif(CLR_CMAKE_HOST_UNIX_ARM64) message("Detected Linux ARM64") elseif(CLR_CMAKE_HOST_UNIX_LOONGARCH64) @@ -301,6 +306,12 @@ elseif (CLR_CMAKE_TARGET_ARCH_ARM) set(ARCH_TARGET_NAME arm) add_compile_definitions($<$>>:TARGET_ARM>) add_compile_definitions($<$>>:TARGET_32BIT>) +elseif (CLR_CMAKE_TARGET_ARCH_ARMV6) + set(ARCH_SOURCES_DIR arm) + set(ARCH_TARGET_NAME armv6) + add_compile_definitions($<$>>:TARGET_ARM>) + add_compile_definitions($<$>>:TARGET_ARMV6>) + add_compile_definitions($<$>>:TARGET_32BIT>) elseif (CLR_CMAKE_TARGET_ARCH_I386) set(ARCH_TARGET_NAME x86) set(ARCH_SOURCES_DIR i386) @@ -507,6 +518,14 @@ if(CLR_CMAKE_HOST_UNIX_ARM) endif(ARM_SOFTFP) endif(CLR_CMAKE_HOST_UNIX_ARM) +if(CLR_CMAKE_HOST_UNIX_ARMV6) + add_compile_options(-mfpu=vfp) + add_definitions(-DCLR_ARM_FPU_CAPABILITY=0x0) + add_compile_options(-march=armv6zk) + add_compile_options(-mcpu=arm1176jzf-s) + add_compile_options(-mfloat-abi=hard) +endif(CLR_CMAKE_HOST_UNIX_ARMV6) + if(CLR_CMAKE_HOST_UNIX_X86) add_compile_options(-msse2) endif() diff --git a/eng/native/configureplatform.cmake b/eng/native/configureplatform.cmake index cdf33430b49f11..ecf10a8d4c39ef 100644 --- a/eng/native/configureplatform.cmake +++ b/eng/native/configureplatform.cmake @@ -41,6 +41,8 @@ if(CLR_CMAKE_HOST_OS STREQUAL Linux) set(CLR_CMAKE_HOST_UNIX_ARMV7L 1) elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL arm OR CMAKE_SYSTEM_PROCESSOR STREQUAL armv7-a) set(CLR_CMAKE_HOST_UNIX_ARM 1) + elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL armv6 OR CMAKE_SYSTEM_PROCESSOR STREQUAL armv6l) + set(CLR_CMAKE_HOST_UNIX_ARMV6 1) elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL arm64) set(CLR_CMAKE_HOST_UNIX_ARM64 1) elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL loongarch64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL loongarch64) @@ -217,6 +219,13 @@ if(CLR_CMAKE_HOST_UNIX_ARM) if(CLR_CMAKE_HOST_UNIX_ARMV7L) set(CLR_CMAKE_HOST_ARCH_ARMV7L 1) endif() +elseif(CLR_CMAKE_HOST_UNIX_ARMV6) + set(CLR_CMAKE_HOST_ARCH_ARMV6 1) + set(CLR_CMAKE_HOST_ARCH "armv6") + + if(CLR_CMAKE_HOST_UNIX_ARMV6L) + set(CLR_CMAKE_HOST_ARCH_ARMV6L 1) + endif() elseif(CLR_CMAKE_HOST_UNIX_ARM64) set(CLR_CMAKE_HOST_ARCH_ARM64 1) set(CLR_CMAKE_HOST_ARCH "arm64") @@ -277,6 +286,8 @@ if (CLR_CMAKE_TARGET_ARCH STREQUAL x64) set(CLR_CMAKE_TARGET_ARCH_LOONGARCH64 1) elseif(CLR_CMAKE_TARGET_ARCH STREQUAL arm) set(CLR_CMAKE_TARGET_ARCH_ARM 1) + elseif(CLR_CMAKE_TARGET_ARCH STREQUAL armv6) + set(CLR_CMAKE_TARGET_ARCH_ARMV6 1) elseif(CLR_CMAKE_TARGET_ARCH STREQUAL armel) set(CLR_CMAKE_TARGET_ARCH_ARM 1) set(CLR_CMAKE_TARGET_ARCH_ARMV7L 1) @@ -379,6 +390,8 @@ if(CLR_CMAKE_TARGET_UNIX) set(CLR_CMAKE_TARGET_UNIX_ARM 1) elseif(CLR_CMAKE_TARGET_ARCH STREQUAL arm) set(CLR_CMAKE_TARGET_UNIX_ARM 1) + elseif(CLR_CMAKE_TARGET_ARCH STREQUAL armv6) + set(CLR_CMAKE_TARGET_UNIX_ARMV6 1) elseif(CLR_CMAKE_TARGET_ARCH STREQUAL arm64) set(CLR_CMAKE_TARGET_UNIX_ARM64 1) elseif(CLR_CMAKE_TARGET_ARCH STREQUAL loongarch64) diff --git a/eng/native/configuretools.cmake b/eng/native/configuretools.cmake index 136cd67925d0cb..ad5dc38107c33f 100644 --- a/eng/native/configuretools.cmake +++ b/eng/native/configuretools.cmake @@ -52,8 +52,8 @@ if(NOT WIN32 AND NOT CLR_CMAKE_TARGET_BROWSER) if(CLR_CMAKE_TARGET_ANDROID) set(TOOLSET_PREFIX ${ANDROID_TOOLCHAIN_PREFIX}) - elseif(CMAKE_CROSSCOMPILING AND NOT DEFINED CLR_CROSS_COMPONENTS_BUILD AND (CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l OR - CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL arm OR CMAKE_SYSTEM_PROCESSOR STREQUAL s390x)) + elseif(CMAKE_CROSSCOMPILING AND NOT DEFINED CLR_CROSS_COMPONENTS_BUILD AND + CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv7l|armv6l|aarch64|arm|s390x)$") set(TOOLSET_PREFIX "${TOOLCHAIN}-") else() set(TOOLSET_PREFIX "") diff --git a/eng/native/functions.cmake b/eng/native/functions.cmake index c4af68ba7dc610..0c28f75706de19 100644 --- a/eng/native/functions.cmake +++ b/eng/native/functions.cmake @@ -4,7 +4,7 @@ function(clr_unknown_arch) elseif(CLR_CROSS_COMPONENTS_BUILD) message(FATAL_ERROR "Only AMD64, I386 host are supported for linux cross-architecture component. Found: ${CMAKE_SYSTEM_PROCESSOR}") else() - message(FATAL_ERROR "Only AMD64, ARM64, LOONGARCH64 and ARM are supported. Found: ${CMAKE_SYSTEM_PROCESSOR}") + message(FATAL_ERROR "Only AMD64, ARMV6, ARM64, LOONGARCH64 and ARM are supported. Found: ${CMAKE_SYSTEM_PROCESSOR}") endif() endfunction() @@ -155,6 +155,10 @@ function(find_unwind_libs UnwindLibs) find_library(UNWIND_ARCH NAMES unwind-arm) endif() + if(CLR_CMAKE_HOST_ARCH_ARMV6) + find_library(UNWIND_ARCH NAMES unwind-arm) + endif() + if(CLR_CMAKE_HOST_ARCH_ARM64) find_library(UNWIND_ARCH NAMES unwind-aarch64) endif() diff --git a/eng/native/init-os-and-arch.sh b/eng/native/init-os-and-arch.sh index 586534be1c8aa9..eda07a5feebbdf 100644 --- a/eng/native/init-os-and-arch.sh +++ b/eng/native/init-os-and-arch.sh @@ -53,6 +53,10 @@ case "$CPUName" in fi ;; + armv6l) + arch=armv6 + ;; + i[3-6]86) echo "Unsupported CPU $CPUName detected, build might not succeed!" arch=x86 diff --git a/eng/native/tryrun.cmake b/eng/native/tryrun.cmake index e8a04c5698ad35..fca410fcb4b42f 100644 --- a/eng/native/tryrun.cmake +++ b/eng/native/tryrun.cmake @@ -68,7 +68,7 @@ if(DARWIN) else() message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only arm64 or x64 is supported for OSX cross build!") endif() -elseif(TARGET_ARCH_NAME MATCHES "^(armel|arm|arm64|loongarch64|s390x|x86)$" OR FREEBSD OR ILLUMOS) +elseif(TARGET_ARCH_NAME MATCHES "^(armel|arm|armv6|arm64|loongarch64|s390x|x86)$" OR FREEBSD OR ILLUMOS) set_cache_value(FILE_OPS_CHECK_FERROR_OF_PREVIOUS_CALL_EXITCODE 1) set_cache_value(GETPWUID_R_SETS_ERRNO_EXITCODE 0) set_cache_value(HAS_POSIX_SEMAPHORES_EXITCODE 0) @@ -146,9 +146,9 @@ elseif(TARGET_ARCH_NAME MATCHES "^(armel|arm|arm64|loongarch64|s390x|x86)$" OR F set_cache_value(HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES_EXITCODE 0) endif() else() - message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only armel, arm, arm64, loongarch64, s390x and x86 are supported!") + message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only armel, arm, armv6, arm64, loongarch64, s390x and x86 are supported!") endif() -if(TARGET_ARCH_NAME STREQUAL "x86" OR TARGET_ARCH_NAME STREQUAL "s390x" OR TARGET_ARCH_NAME STREQUAL "loongarch64") +if(TARGET_ARCH_NAME STREQUAL "x86" OR TARGET_ARCH_NAME STREQUAL "s390x" OR TARGET_ARCH_NAME STREQUAL "armv6" OR TARGET_ARCH_NAME STREQUAL "loongarch64") set_cache_value(HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES_EXITCODE 0) endif() diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 282fa567550812..0938ee359b4a47 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -52,6 +52,31 @@ jobs: crossrootfsDir: '/crossrootfs/arm' ${{ insert }}: ${{ parameters.jobParameters }} +# Linux armv6 +- ${{ if or(containsValue(parameters.platforms, 'Linux_armv6'), in(parameters.platformGroup, 'all', 'gcstress')) }}: + - template: xplat-setup.yml + parameters: + jobTemplate: ${{ parameters.jobTemplate }} + helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} + variables: ${{ parameters.variables }} + osGroup: Linux + archType: armv6 + targetRid: linux-armv6 + platform: Linux_armv6 + container: + image: ubuntu-20.04-cross-armv6-raspbian-10-20211208135931-e6e3ac4 + registry: mcr + jobParameters: + runtimeFlavor: ${{ parameters.runtimeFlavor }} + stagedBuild: ${{ parameters.stagedBuild }} + buildConfig: ${{ parameters.buildConfig }} + ${{ if eq(parameters.passPlatforms, true) }}: + platforms: ${{ parameters.platforms }} + helixQueueGroup: ${{ parameters.helixQueueGroup }} + crossBuild: true + crossrootfsDir: '/crossrootfs/armv6' + ${{ insert }}: ${{ parameters.jobParameters }} + # Linux arm64 - ${{ if or(containsValue(parameters.platforms, 'Linux_arm64'), in(parameters.platformGroup, 'all', 'gcstress')) }}: diff --git a/eng/pipelines/libraries/helix-queues-setup.yml b/eng/pipelines/libraries/helix-queues-setup.yml index dec87138ed4563..70161eb7e19684 100644 --- a/eng/pipelines/libraries/helix-queues-setup.yml +++ b/eng/pipelines/libraries/helix-queues-setup.yml @@ -33,6 +33,11 @@ jobs: - (Debian.10.Arm32.Open)Ubuntu.1804.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-10-helix-arm32v7-20210304164340-6616c63 - (Debian.11.Arm32.Open)Ubuntu.1804.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-11-helix-arm32v7-20210304164347-5a7c380 + # Linux armv6 + - ${{ if eq(parameters.platform, 'Linux_armv6') }}: +# - ${{ if eq(parameters.jobParameters.isFullMatrix, true) }}: + - (Raspbian.10.Armv6.Open)Raspbian.9.Arm32.IoT.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:raspbian-10-helix-arm32v6-20211215185610-60748cc + # Linux arm64 - ${{ if eq(parameters.platform, 'Linux_arm64') }}: - ${{ if or(eq(parameters.jobParameters.isExtraPlatforms, true), eq(parameters.jobParameters.includeAllPlatforms, true)) }}: diff --git a/eng/pipelines/runtime-staging.yml b/eng/pipelines/runtime-staging.yml index d49ceeed3ef533..e06a9a6344d9b9 100644 --- a/eng/pipelines/runtime-staging.yml +++ b/eng/pipelines/runtime-staging.yml @@ -234,6 +234,46 @@ jobs: eq(variables['monoContainsChange'], true), eq(variables['isRollingBuild'], true)) +# +# Build the whole product using Mono and run libraries tests +# +- template: /eng/pipelines/common/platform-matrix.yml + parameters: + jobTemplate: /eng/pipelines/common/global-build-job.yml + helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml + buildConfig: Release + runtimeFlavor: mono + platforms: + - Linux_armv6 + variables: + # map dependencies variables to local variables + - name: librariesContainsChange + value: $[ dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'] ] + - name: monoContainsChange + value: $[ dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'] ] + jobParameters: + testScope: innerloop + nameSuffix: AllSubsets_Mono + buildArgs: -s mono+clr+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true + timeoutInMinutes: 120 + condition: >- + or( + eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), + eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true), + eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true), + eq(variables['isManualOrIsNotPR'], true), + eq(variables['isFullMatrix'], true)) + # extra steps, run tests + extraStepsTemplate: /eng/pipelines/libraries/helix.yml + extraStepsParameters: + creator: dotnet-bot + testRunNamePrefixSuffix: Mono_$(_BuildConfig) + condition: >- + or( + eq(variables['librariesContainsChange'], true), + eq(variables['monoContainsChange'], true), + eq(variables['isRollingBuild'], true)) + # # Build the whole product using Mono and run runtime tests with the JIT. # diff --git a/eng/targetingpacks.targets b/eng/targetingpacks.targets index 4213c84e709d9c..150ddf7401c9ea 100644 --- a/eng/targetingpacks.targets +++ b/eng/targetingpacks.targets @@ -43,13 +43,13 @@ RuntimeFrameworkName="$(LocalFrameworkOverrideName)" LatestRuntimeFrameworkVersion="$(ProductVersion)" RuntimePackNamePatterns="$(LocalFrameworkOverrideName).Runtime.Mono.**RID**" - RuntimePackRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-loongarch64;linux-musl-x64;linux-x64;osx-x64;rhel.6-x64;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64;browser-wasm;ios-arm64;ios-arm;iossimulator-arm64;iossimulator-x64;iossimulator-x86;tvos-arm64;tvossimulator-arm64;tvossimulator-x64;android-arm64;android-arm;android-x64;android-x86" + RuntimePackRuntimeIdentifiers="linux-arm;linux-armv6;linux-arm64;linux-musl-arm64;linux-loongarch64;linux-musl-x64;linux-x64;osx-x64;rhel.6-x64;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64;browser-wasm;ios-arm64;ios-arm;iossimulator-arm64;iossimulator-x64;iossimulator-x86;tvos-arm64;tvossimulator-arm64;tvossimulator-x64;android-arm64;android-arm;android-x64;android-x86" RuntimePackLabels="Mono" Condition="'@(KnownRuntimePack)' == '' or !@(KnownRuntimePack->AnyHaveMetadataValue('TargetFramework', '$(NetCoreAppCurrent)'))"/> arm + + armv6 + arm64 diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json b/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json index 25a77800588447..fc0fb68ac6e7e4 100644 --- a/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json +++ b/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json @@ -3760,6 +3760,14 @@ "any", "base" ], + "linux-armv6": [ + "linux-armv6", + "linux", + "unix-armv6", + "unix", + "any", + "base" + ], "linux-mips64": [ "linux-mips64", "linux", @@ -8248,6 +8256,12 @@ "any", "base" ], + "unix-armv6": [ + "unix-armv6", + "unix", + "any", + "base" + ], "unix-mips64": [ "unix-mips64", "unix", @@ -8902,4 +8916,4 @@ "any", "base" ] -} \ No newline at end of file +} diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json b/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json index f8c398707e0bb6..0b71f880e893d5 100644 --- a/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json +++ b/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json @@ -1504,6 +1504,12 @@ "unix-loongarch64" ] }, + "linux-armv6": { + "#import": [ + "linux", + "unix-armv6" + ] + }, "linux-mips64": { "#import": [ "linux", @@ -3444,6 +3450,11 @@ "unix" ] }, + "unix-armv6": { + "#import": [ + "unix" + ] + }, "unix-mips64": { "#import": [ "unix" @@ -3788,4 +3799,4 @@ ] } } -} \ No newline at end of file +} diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props b/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props index d1613c4345b314..da7960a1f57856 100644 --- a/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props +++ b/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props @@ -3,11 +3,11 @@ any - x64;x86;arm;armel;arm64;loongarch64;mips64;s390x + x64;x86;arm;armv6;armel;arm64;loongarch64;mips64;s390x unix - x64;x86;arm;armel;arm64;loongarch64;mips64;s390x + x64;x86;arm;armv6;armel;arm64;loongarch64;mips64;s390x linux diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Architecture.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Architecture.cs index 225fec28c763ac..4dead88ce4c92f 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Architecture.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Architecture.cs @@ -11,6 +11,7 @@ public enum Architecture Arm64, Wasm, S390x, - LoongArch64 + LoongArch64, + Armv6, } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/RuntimeInformation.ProcessArchitecture.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/RuntimeInformation.ProcessArchitecture.cs index 0da595b95e0746..d11391a001ef92 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/RuntimeInformation.ProcessArchitecture.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/RuntimeInformation.ProcessArchitecture.cs @@ -10,6 +10,8 @@ public static Architecture ProcessArchitecture => Architecture.X86; #elif TARGET_AMD64 => Architecture.X64; +#elif TARGET_ARMV6 + => Architecture.Armv6; #elif TARGET_ARM => Architecture.Arm; #elif TARGET_ARM64 diff --git a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/CheckArchitectureTests.cs b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/CheckArchitectureTests.cs index 6f1b289fd00eea..50fe5210c91ad5 100644 --- a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/CheckArchitectureTests.cs +++ b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/CheckArchitectureTests.cs @@ -44,6 +44,10 @@ public void VerifyArchitecture() Assert.Equal(Architecture.LoongArch64, processArch); break; + case Architecture.Armv6: + Assert.Equal(Architecture.Armv6, processArch); + break; + default: Assert.False(true, "Unexpected Architecture."); break; diff --git a/src/libraries/System.Runtime/ref/System.Runtime.cs b/src/libraries/System.Runtime/ref/System.Runtime.cs index 57c9f8368994eb..ea9cc7ecc01808 100644 --- a/src/libraries/System.Runtime/ref/System.Runtime.cs +++ b/src/libraries/System.Runtime/ref/System.Runtime.cs @@ -13452,6 +13452,7 @@ public enum Architecture Wasm = 4, S390x = 5, LoongArch64 = 6, + Armv6 = 7, } public enum CharSet { diff --git a/src/libraries/externals.csproj b/src/libraries/externals.csproj index 54ef0d14897c6f..c04d47d9f897e7 100644 --- a/src/libraries/externals.csproj +++ b/src/libraries/externals.csproj @@ -9,7 +9,7 @@ true false true - true + true diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 8d6a97b157d41a..2e5554df5bc5bc 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -47,7 +47,7 @@ Roslyn4.0.Tests.csproj" /> - + diff --git a/src/mono/CMakeLists.txt b/src/mono/CMakeLists.txt index 79d238e6eeb28a..909e1f72c19dca 100644 --- a/src/mono/CMakeLists.txt +++ b/src/mono/CMakeLists.txt @@ -9,6 +9,7 @@ project(mono) include(../../eng/native/configurepaths.cmake) include(${CLR_ENG_NATIVE_DIR}/functions.cmake) +set(CROSS_ROOTFS $ENV{ROOTFS_DIR}) set(CMAKE_C_FLAGS_CHECKED "") set(CMAKE_CXX_FLAGS_CHECKED "") set(CMAKE_EXE_LINKER_FLAGS_CHECKED "") @@ -420,8 +421,13 @@ elseif(TARGET_ARCH STREQUAL "arm64") elseif(TARGET_ARCH MATCHES "arm") set(TARGET_ARM 1) set(MONO_ARCHITECTURE "\"arm\"") - # FIXME: - add_definitions("-DARM_FPU_VFP=1") + if(MONO_ARM_FPU STREQUAL "none") + add_definitions("-DARM_FPU_NONE=1") + elseif(MONO_ARM_FPU STREQUAL "vfp-hard") + add_definitions("-DARM_FPU_VFP_HARD=1") + else() + add_definitions("-DARM_FPU_VFP=1") + endif() set(TARGET_SIZEOF_VOID_P 4) set(SIZEOF_REGISTER 4) # fixme: use separate defines for host/target @@ -644,6 +650,9 @@ elseif(HOST_ANDROID) set(HAVE_SYS_ICU 1) elseif(HOST_LINUX) include(FindPkgConfig) + if(CROSS_ROOTFS) + set(ENV{PKG_CONFIG_ICU_UC_INCLUDEDIR} "${CROSS_ROOTFS}/usr/include") + endif(CROSS_ROOTFS) pkg_check_modules(ICU icu-uc) set(ICU_FLAGS "-DTARGET_UNIX -DU_DISABLE_RENAMING -Wno-reserved-id-macro -Wno-documentation -Wno-documentation-unknown-command -Wno-switch-enum -Wno-covered-switch-default -Wno-extra-semi-stmt -Wno-unknown-warning-option -Wno-deprecated-declarations") set(HAVE_SYS_ICU 1) diff --git a/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj b/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj index da99b06e81b8ea..d952686ac56b89 100644 --- a/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj +++ b/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj @@ -10,7 +10,7 @@ $(RuntimeBinDir)IL/ Debug;Release;Checked - x64;x86;arm;arm64;s390x;wasm + x64;x86;arm;armv6;arm64;s390x;wasm true @@ -56,6 +56,10 @@ x86 $(DefineConstants);TARGET_X86 + + arm + $(DefineConstants);TARGET_ARMV6 + arm $(DefineConstants);TARGET_ARM diff --git a/src/mono/mono.proj b/src/mono/mono.proj index c7febf933f5c97..bff71d03b47e9c 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -228,12 +228,23 @@ - + <_MonoCMakeArgs Include="-DCMAKE_TOOLCHAIN_FILE=$(CrossToolchainFile)" /> + <_MonoCMakeArgs Condition="'$(TargetOS)' == 'Linux' and ('$(TargetArchitecture)' == 'arm' or '$(TargetArchitecture)' == 'armv6')" Include="-DMONO_ARM_FPU=vfp-hard" /> <_MonoBuildEnv Condition="'$(Platform)' == 'arm64'" Include="TARGET_BUILD_ARCH=arm64" /> <_MonoBuildEnv Condition="'$(Platform)' == 'arm'" Include="TARGET_BUILD_ARCH=arm" /> + <_MonoBuildEnv Condition="'$(Platform)' == 'armv6'" Include="TARGET_BUILD_ARCH=armv6" /> <_MonoBuildEnv Condition="'$(Platform)' == 'arm64'" Include="PKG_CONFIG_PATH=$(MonoCrossDir)/usr/lib/aarch64-linux-gnu/pkgconfig" /> <_MonoBuildEnv Condition="'$(Platform)' == 'arm'" Include="PKG_CONFIG_PATH=$(MonoCrossDir)/usr/lib/arm-linux-gnueabihf/pkgconfig" /> + <_MonoBuildEnv Condition="'$(Platform)' == 'armv6'" Include="PKG_CONFIG_PATH=$(MonoCrossDir)/usr/lib/arm-linux-gnueabihf/pkgconfig" /> + <_MonoCFLAGS Condition="'$(TargetArchitecture)' == 'armv6'" Include="-march=armv6zk" /> + <_MonoCFLAGS Condition="'$(TargetArchitecture)' == 'armv6'" Include="-mcpu=arm1176jzf-s" /> + <_MonoCFLAGS Condition="'$(TargetArchitecture)' == 'armv6'" Include="-mfpu=vfp" /> + <_MonoCFLAGS Condition="'$(TargetArchitecture)' == 'armv6'" Include="-mfloat-abi=hard" /> + <_MonoCXXFLAGS Condition="'$(TargetArchitecture)' == 'armv6'" Include="-march=armv6zk" /> + <_MonoCXXFLAGS Condition="'$(TargetArchitecture)' == 'armv6'" Include="-mcpu=arm1176jzf-s" /> + <_MonoCXXFLAGS Condition="'$(TargetArchitecture)' == 'armv6'" Include="-mfpu=vfp" /> + <_MonoCXXFLAGS Condition="'$(TargetArchitecture)' == 'armv6'" Include="-mfloat-abi=hard" /> @@ -514,6 +525,7 @@ <_LinuxFloatAbi Condition="'$(TargetsAndroid)' != 'true'">hf <_Objcopy>objcopy <_Objcopy Condition="'$(Platform)' == 'arm'">arm-linux-$(_LinuxAbi)eabi$(_LinuxFloatAbi)-$(_Objcopy) + <_Objcopy Condition="'$(Platform)' == 'armv6'">arm-linux-$(_LinuxAbi)eabi$(_LinuxFloatAbi)-$(_Objcopy) <_Objcopy Condition="'$(Platform)' == 'arm64'">aarch64-linux-$(_LinuxAbi)-$(_Objcopy) <_Objcopy Condition="'$(Platform)' == 's390x'">s390x-linux-$(_LinuxAbi)-$(_Objcopy) <_Objcopy Condition="'$(Platform)' == 'x64'">x86_64-linux-$(_LinuxAbi)-$(_Objcopy) diff --git a/src/native/corehost/fxr/standalone/CMakeLists.txt b/src/native/corehost/fxr/standalone/CMakeLists.txt index 42785ac91d4b64..5e30750ab4a607 100644 --- a/src/native/corehost/fxr/standalone/CMakeLists.txt +++ b/src/native/corehost/fxr/standalone/CMakeLists.txt @@ -56,3 +56,7 @@ else() endif(WIN32) target_link_libraries(hostfxr libhostcommon) + +if (CLR_CMAKE_TARGET_ARCH_ARMV6) + target_link_libraries(${DOTNET_PROJECT_NAME} atomic) +endif() diff --git a/src/native/corehost/hostmisc/utils.cpp b/src/native/corehost/hostmisc/utils.cpp index 7f5fdbca40ab03..18e54a3e6d7f86 100644 --- a/src/native/corehost/hostmisc/utils.cpp +++ b/src/native/corehost/hostmisc/utils.cpp @@ -191,6 +191,8 @@ const pal::char_t* get_arch() return _X("x64"); #elif defined(TARGET_X86) return _X("x86"); +#elif defined(TARGET_ARMV6) + return _X("armv6"); #elif defined(TARGET_ARM) return _X("arm"); #elif defined(TARGET_ARM64) diff --git a/src/native/corehost/test/nativehost/CMakeLists.txt b/src/native/corehost/test/nativehost/CMakeLists.txt index c21e95a1c71d9d..d8b23ca12ce568 100644 --- a/src/native/corehost/test/nativehost/CMakeLists.txt +++ b/src/native/corehost/test/nativehost/CMakeLists.txt @@ -58,3 +58,7 @@ endif() if (CLR_CMAKE_TARGET_WIN32 AND (CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_ARM64)) target_link_libraries(${DOTNET_PROJECT_NAME} Ole32.lib OleAut32.lib) endif() + +if (CLR_CMAKE_TARGET_ARCH_ARMV6) + target_link_libraries(${DOTNET_PROJECT_NAME} atomic) +endif() diff --git a/src/native/eventpipe/ep-event-source.c b/src/native/eventpipe/ep-event-source.c index 78d1c4852b991c..0da7ebc50caad0 100644 --- a/src/native/eventpipe/ep-event-source.c +++ b/src/native/eventpipe/ep-event-source.c @@ -34,6 +34,8 @@ const ep_char8_t* _ep_os_info = "Unknown"; const ep_char8_t* _ep_arch_info = "x86"; #elif defined(TARGET_AMD64) const ep_char8_t* _ep_arch_info = "x64"; +#elif defined(TARGET_ARMV6) +const ep_char8_t* _ep_arch_info = "arm32"; #elif defined(TARGET_ARM) const ep_char8_t* _ep_arch_info = "arm32"; #elif defined(TARGET_ARM64) diff --git a/src/native/libs/System.Native/pal_runtimeinformation.h b/src/native/libs/System.Native/pal_runtimeinformation.h index adae223d48339b..da39ac51d55acf 100644 --- a/src/native/libs/System.Native/pal_runtimeinformation.h +++ b/src/native/libs/System.Native/pal_runtimeinformation.h @@ -23,5 +23,6 @@ enum ARCH_ARM64, ARCH_WASM, ARCH_S390X, - ARCH_LOONGARCH64 + ARCH_LOONGARCH64, + ARCH_ARMV6, }; From 9eb1b0c8e52f3a9899b787d425c99a6ddf0eb391 Mon Sep 17 00:00:00 2001 From: Jan Vorlicek Date: Mon, 24 Jan 2022 22:58:47 +0100 Subject: [PATCH 044/161] Fix remote unwind (#64220) The _OOP_find_proc_info was setting only a couple of members of the unw_dyn_info_t instance on stack. So the remaining ones had random values. The load_offset was a recently added member to the struct. When we have updated libunwind, this change came in. The load_offset was random and that has broken unwindign as this offset is subtracted from the IP when looking up unwind info. The fix clears the whole struct. I have verified that the issue we had no longer happens with the fix. --- src/coreclr/pal/src/libunwind/src/oop/_OOP_find_proc_info.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/coreclr/pal/src/libunwind/src/oop/_OOP_find_proc_info.c b/src/coreclr/pal/src/libunwind/src/oop/_OOP_find_proc_info.c index 74d42ffe2abb28..07bd4a73b276cc 100644 --- a/src/coreclr/pal/src/libunwind/src/oop/_OOP_find_proc_info.c +++ b/src/coreclr/pal/src/libunwind/src/oop/_OOP_find_proc_info.c @@ -28,6 +28,8 @@ _OOP_find_proc_info ( int ret = 0; unw_dyn_info_t di; + memset(&di, 0, sizeof(di)); + di.start_ip = start_ip; di.end_ip = end_ip; di.gp = pi->gp; From 070b7d80114354ba9ef5dfb8bd175ca832edb638 Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Mon, 24 Jan 2022 17:05:04 -0500 Subject: [PATCH 045/161] Put back FindCaseSensitivePrefix regex alternation support (#64204) * Put back FindCaseSensitivePrefix alternation support * Fix the bug from the initial version, and add more comments --- .../RegexFindOptimizations.cs | 2 +- .../RegularExpressions/RegexPrefixAnalyzer.cs | 59 ++++++++++++++++++- .../tests/Regex.Match.Tests.cs | 4 ++ 3 files changed, 61 insertions(+), 4 deletions(-) diff --git a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexFindOptimizations.cs b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexFindOptimizations.cs index f3c5552b8404af..e3c760c2728be5 100644 --- a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexFindOptimizations.cs +++ b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexFindOptimizations.cs @@ -50,7 +50,7 @@ public RegexFindOptimizations(RegexTree tree, CultureInfo culture) } // If there's a leading case-sensitive substring, just use IndexOf and inherit all of its optimizations. - string caseSensitivePrefix = RegexPrefixAnalyzer.FindCaseSensitivePrefix(tree); + string caseSensitivePrefix = RegexPrefixAnalyzer.FindCaseSensitivePrefix(tree.Root); if (caseSensitivePrefix.Length > 1) { LeadingCaseSensitivePrefix = caseSensitivePrefix; diff --git a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexPrefixAnalyzer.cs b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexPrefixAnalyzer.cs index 869b5cc5aa285a..692ee7d5557c1a 100644 --- a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexPrefixAnalyzer.cs +++ b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexPrefixAnalyzer.cs @@ -50,11 +50,11 @@ private RegexPrefixAnalyzer(Span intStack) _skipAllChildren = false; } - /// Computes the leading substring in ; may be empty. - public static string FindCaseSensitivePrefix(RegexTree tree) + /// Computes the leading substring in ; may be empty. + public static string FindCaseSensitivePrefix(RegexNode node) { var vsb = new ValueStringBuilder(stackalloc char[64]); - Process(tree.Root, ref vsb); + Process(node, ref vsb); return vsb.ToString(); // Processes the node, adding any prefix text to the builder. @@ -87,6 +87,59 @@ static bool Process(RegexNode node, ref ValueStringBuilder vsb) return !rtl; } + // Alternation: find a string that's a shared prefix of all branches + case RegexNodeKind.Alternate: + { + int childCount = node.ChildCount(); + + // Store the initial branch into the target builder, keeping track + // of how much was appended. Any of this contents that doesn't overlap + // will every other branch will be removed before returning. + int initialLength = vsb.Length; + Process(node.Child(0), ref vsb); + int addedLength = vsb.Length - initialLength; + + // Then explore the rest of the branches, finding the length + // of prefix they all share in common with the initial branch. + if (addedLength != 0) + { + var alternateSb = new ValueStringBuilder(64); + + // Process each branch. If we reach a point where we've proven there's + // no overlap, we can bail early. + for (int i = 1; i < childCount && addedLength != 0; i++) + { + alternateSb.Length = 0; + + // Process the branch into a temporary builder. + Process(node.Child(i), ref alternateSb); + + // Find how much overlap there is between this branch's prefix + // and the smallest amount of prefix that overlapped with all + // the previously seen branches. + addedLength = Math.Min(addedLength, alternateSb.Length); + for (int j = 0; j < addedLength; j++) + { + if (vsb[initialLength + j] != alternateSb[j]) + { + addedLength = j; + break; + } + } + } + + alternateSb.Dispose(); + + // Then cull back on what was added based on the other branches. + vsb.Length = initialLength + addedLength; + } + + // Don't explore anything after the alternation. We could make this work if desirable, + // but it's currently not worth the extra complication. The entire contents of every + // branch would need to be identical other than zero-width anchors/assertions. + return false; + } + // One character case RegexNodeKind.One when (node.Options & RegexOptions.IgnoreCase) == 0: vsb.Append(node.Ch); diff --git a/src/libraries/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs b/src/libraries/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs index 8fd3ea6e32231d..005e9b27bb203a 100644 --- a/src/libraries/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs +++ b/src/libraries/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs @@ -205,6 +205,10 @@ public static IEnumerable Match_MemberData() yield return (@"(^|($|a+))bc", " aabc", RegexOptions.None, 0, 5, true, "aabc"); yield return (@"yz(^|a+)bc", " yzaabc", RegexOptions.None, 0, 7, true, "yzaabc"); yield return (@"(^a|a$) bc", "a bc", RegexOptions.None, 0, 4, true, "a bc"); + yield return (@"(abcdefg|abcdef|abc|a)h", " ah ", RegexOptions.None, 0, 8, true, "ah"); + yield return (@"(^abcdefg|abcdef|^abc|a)h", " abcdefh ", RegexOptions.None, 0, 13, true, "abcdefh"); + yield return (@"(a|^abcdefg|abcdef|^abc)h", " abcdefh ", RegexOptions.None, 0, 13, true, "abcdefh"); + yield return (@"(abcdefg|abcdef)h", " abcdefghij ", RegexOptions.None, 0, 16, true, "abcdefgh"); if (!RegexHelpers.IsNonBacktracking(engine)) { From db21974134ed636c4e6bbd1a24104dd93c1ebc16 Mon Sep 17 00:00:00 2001 From: Elinor Fung Date: Mon, 24 Jan 2022 14:57:42 -0800 Subject: [PATCH 046/161] Update tests to expect RemoteExecutor to check exit code (#64133) --- .../tests/UnitTests/ConsoleLifetimeExitTests.cs | 12 +++++++----- .../tests/FileSystemTests.cs | 3 +-- .../System.Console/tests/CancelKeyPress.Unix.cs | 2 +- .../tests/System/ExitCodeTests.Unix.cs | 1 + .../JsonSerializerContextTests.cs | 5 ++--- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/ConsoleLifetimeExitTests.cs b/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/ConsoleLifetimeExitTests.cs index 55902bd8a3a9bd..9788e6684fc018 100644 --- a/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/ConsoleLifetimeExitTests.cs +++ b/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/ConsoleLifetimeExitTests.cs @@ -105,10 +105,10 @@ await Host.CreateDefaultBuilder() services.AddHostedService(); }) .RunConsoleAsync(); - }); + }, new RemoteInvokeOptions() { ExpectedExitCode = 124 }); + // TODO: Remove once https://github.com/dotnet/arcade/issues/5865 is resolved remoteHandle.Process.WaitForExit(); - Assert.Equal(124, remoteHandle.Process.ExitCode); } @@ -130,6 +130,9 @@ await Task.Run(() => [ActiveIssue("https://github.com/dotnet/runtime/issues/34582", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] public void EnsureEnvironmentExitDoesntHang() { + // SIGTERM is only handled on net6.0+, so the workaround to "clobber" the exit code is still in place on .NET Framework + int expectedExitCode = PlatformDetection.IsNetFramework ? 0 : 125; + using var remoteHandle = RemoteExecutor.Invoke(async () => { await Host.CreateDefaultBuilder() @@ -139,12 +142,11 @@ await Host.CreateDefaultBuilder() services.AddHostedService(); }) .RunConsoleAsync(); - }, new RemoteInvokeOptions() { TimeOut = 30_000 }); // give a 30 second time out, so if this does hang, it doesn't hang for the full timeout + }, new RemoteInvokeOptions() { TimeOut = 30_000, ExpectedExitCode = expectedExitCode }); // give a 30 second time out, so if this does hang, it doesn't hang for the full timeout Assert.True(remoteHandle.Process.WaitForExit(30_000), "The hosted process should have exited within 30 seconds"); - // SIGTERM is only handled on net6.0+, so the workaround to "clobber" the exit code is still in place on NetFramework - int expectedExitCode = PlatformDetection.IsNetFramework ? 0 : 125; + // TODO: Remove once https://github.com/dotnet/arcade/issues/5865 is resolved Assert.Equal(expectedExitCode, remoteHandle.Process.ExitCode); } diff --git a/src/libraries/Microsoft.VisualBasic.Core/tests/FileSystemTests.cs b/src/libraries/Microsoft.VisualBasic.Core/tests/FileSystemTests.cs index d9f981b2425982..a2a8e28e8d17b7 100644 --- a/src/libraries/Microsoft.VisualBasic.Core/tests/FileSystemTests.cs +++ b/src/libraries/Microsoft.VisualBasic.Core/tests/FileSystemTests.cs @@ -620,8 +620,7 @@ static void remoteWrite(string fileName, string text) } }, fileName, - text, - new RemoteInvokeOptions() { ExpectedExitCode = 0 }).Dispose(); + text).Dispose(); } } diff --git a/src/libraries/System.Console/tests/CancelKeyPress.Unix.cs b/src/libraries/System.Console/tests/CancelKeyPress.Unix.cs index e72522bafc58b8..8fd95102c9dbab 100644 --- a/src/libraries/System.Console/tests/CancelKeyPress.Unix.cs +++ b/src/libraries/System.Console/tests/CancelKeyPress.Unix.cs @@ -78,7 +78,7 @@ public void ExitDetectionNotBlockedByHandler() // Release CancelKeyPress mre.Set(); - }).Dispose(); + }, new RemoteInvokeOptions() { ExpectedExitCode = 130 }).Dispose(); } private void HandlerInvokedForSignal(int signalOuter, bool redirectStandardInput) diff --git a/src/libraries/System.Runtime/tests/System/ExitCodeTests.Unix.cs b/src/libraries/System.Runtime/tests/System/ExitCodeTests.Unix.cs index 909f700f5c8da4..9fd7ab4f461a98 100644 --- a/src/libraries/System.Runtime/tests/System/ExitCodeTests.Unix.cs +++ b/src/libraries/System.Runtime/tests/System/ExitCodeTests.Unix.cs @@ -42,6 +42,7 @@ public void SigTermExitCode(int? exitCodeOnSigterm) RemoteInvokeOptions options = new RemoteInvokeOptions(); options.StartInfo.RedirectStandardOutput = true; + options.CheckExitCode = false; using (RemoteInvokeHandle remoteExecution = RemoteExecutor.Invoke(action, exitCodeOnSigterm?.ToString() ?? string.Empty, options)) { Process process = remoteExecution.Process; diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/JsonSerializerContextTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/JsonSerializerContextTests.cs index 7bc91507d9ad53..a9fa26e3279f11 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/JsonSerializerContextTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/JsonSerializerContextTests.cs @@ -24,7 +24,7 @@ public static void VariousNestingAndVisibilityLevelsAreSupported() public static void Converters_AndTypeInfoCreator_NotRooted_WhenMetadataNotPresent() { RemoteExecutor.Invoke( - new Action(() => + () => { object[] objArr = new object[] { new MyStruct() }; @@ -56,8 +56,7 @@ static void AssertFieldNull(string fieldName, JsonSerializerOptions? optionsInst Assert.NotNull(fieldInfo); Assert.Null(fieldInfo.GetValue(optionsInstance)); } - }), - new RemoteInvokeOptions() { ExpectedExitCode = 0 }).Dispose(); + }).Dispose(); } [Fact] From 8bfb725d887ff1673652f1d59f8b2a7f071b659e Mon Sep 17 00:00:00 2001 From: Maoni Stephens Date: Mon, 24 Jan 2022 15:21:21 -0800 Subject: [PATCH 047/161] update generation_allocation_size correctly for SIP regions (#64176) SIP regions need to update the corresponding generation's generation_allocation_size and since this can be more than 1 gen older than the region's gen, we need to make all generation's alloc size get updated. --- src/coreclr/gc/gc.cpp | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/src/coreclr/gc/gc.cpp b/src/coreclr/gc/gc.cpp index 9ab892a5ad338d..bc4c11771f2b13 100644 --- a/src/coreclr/gc/gc.cpp +++ b/src/coreclr/gc/gc.cpp @@ -20423,23 +20423,33 @@ void gc_heap::gc1() if (n < max_generation) { - compute_promoted_allocation (1 + n); + int highest_gen_number = +#ifdef USE_REGIONS + max_generation; +#else //USE_REGIONS + 1 + n; +#endif //USE_REGIONS + + for (int older_gen_idx = (1 + n); older_gen_idx <= highest_gen_number; older_gen_idx++) + { + compute_promoted_allocation (older_gen_idx); - dynamic_data* dd = dynamic_data_of (1 + n); - size_t new_fragmentation = generation_free_list_space (generation_of (1 + n)) + - generation_free_obj_space (generation_of (1 + n)); + dynamic_data* dd = dynamic_data_of (older_gen_idx); + size_t new_fragmentation = generation_free_list_space (generation_of (older_gen_idx)) + + generation_free_obj_space (generation_of (older_gen_idx)); #ifdef BACKGROUND_GC - if (current_c_gc_state != c_gc_state_planning) + if (current_c_gc_state != c_gc_state_planning) #endif //BACKGROUND_GC - { - if (settings.promotion) - { - dd_fragmentation (dd) = new_fragmentation; - } - else { - //assert (dd_fragmentation (dd) == new_fragmentation); + if (settings.promotion) + { + dd_fragmentation (dd) = new_fragmentation; + } + else + { + //assert (dd_fragmentation (dd) == new_fragmentation); + } } } } @@ -30125,6 +30135,11 @@ void gc_heap::sweep_region_in_plan (heap_segment* region, heap_segment_saved_allocated (region) = heap_segment_allocated (region); heap_segment_allocated (region) = last_marked_obj_end; heap_segment_plan_allocated (region) = heap_segment_allocated (region); + + int plan_gen_num = heap_segment_plan_gen_num (region); + generation_allocation_size (generation_of (plan_gen_num)) += heap_segment_survived (region); + dprintf (REGIONS_LOG, ("sip: g%d alloc size is now %Id", plan_gen_num, + generation_allocation_size (generation_of (plan_gen_num)))); } inline From 74d8d0dea0099da8898953b7b094acc3df62741d Mon Sep 17 00:00:00 2001 From: Mitchell Hwang <16830051+mdh1418@users.noreply.github.com> Date: Mon, 24 Jan 2022 18:46:52 -0500 Subject: [PATCH 048/161] Android remove backward timezones (#64028) Fixes #63693 It was discovered that Android produces duplicate TimeZone DisplayNames among all timezone IDs in GetSystemTimeZones. These duplicate DisplayNames occur across TimeZone IDs that are aliases, where all except one are backward timezone IDs. If a name is changed, put its old spelling in the 'backward' file From the Android TimeZone data file tzdata, it isn't obvious which TimeZone IDs are backward (I find it strange that they're included in the first place), however we discovered that on some versions of Android, there is an adjacent file tzlookup.xml that can aid us in determining which TimeZone IDs are "current" (not backward). This PR aims to utilize tzlookup.xml when it exists and post-filter's the Populated TimeZone IDs in the AndroidTzData instance by removing IDs and their associated information (byteoffset and length) from the AndroidTzData instance if it is not found in tzlookup.xml. This is using the assumption that all non-backward TimeZone IDs make it to the tzlookup.xml file. This PR also adds a new TimeZoneInfo Test to check whether or not there are duplicate DisplayNames in GetSystemTimeZones --- .../src/System/TimeZoneInfo.Unix.Android.cs | 92 +++++++++++++++++-- .../tests/System/TimeZoneInfoTests.cs | 14 +++ 2 files changed, 97 insertions(+), 9 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.Unix.Android.cs b/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.Unix.Android.cs index 53baf4eb65111f..23c1044e1983cd 100644 --- a/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.Unix.Android.cs +++ b/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.Unix.Android.cs @@ -193,6 +193,7 @@ private sealed class AndroidTzData private string[] _ids; private int[] _byteOffsets; private int[] _lengths; + private bool[] _isBackwards; private string _tzFileDir; private string _tzFilePath; @@ -230,7 +231,7 @@ public AndroidTzData() foreach (var tzFileDir in tzFileDirList) { string tzFilePath = Path.Combine(tzFileDir, TimeZoneFileName); - if (LoadData(tzFilePath)) + if (LoadData(tzFileDir, tzFilePath)) { _tzFileDir = tzFileDir; _tzFilePath = tzFilePath; @@ -241,10 +242,62 @@ public AndroidTzData() throw new TimeZoneNotFoundException(SR.TimeZoneNotFound_ValidTimeZoneFileMissing); } + // On some versions of Android, the tzdata file may still contain backward timezone ids. + // We attempt to use tzlookup.xml, which is available on some versions of Android to help + // validate non-backward timezone ids + // tzlookup.xml is an autogenerated file that contains timezone ids in this form: + // + // + // + // + // Australia/Sydney + // ... + // ... + // Australia/Eucla + // + // + // ... + // ... + // ... + // + // + // + // + // Once the timezone cache is populated with the IDs, we reference tzlookup id tags + // to determine if an id is backwards and label it as such if they are. + private void FilterBackwardIDs(string tzFileDir, out HashSet tzLookupIDs) + { + tzLookupIDs = new HashSet(); + try + { + using (StreamReader sr = File.OpenText(Path.Combine(tzFileDir, "tzlookup.xml"))) + { + string? tzLookupLine; + while (sr.Peek() >= 0) + { + if (!(tzLookupLine = sr.ReadLine())!.AsSpan().TrimStart().StartsWith("') + 1; + int idLength = tzLookupLine.LastIndexOf(" or the end tag are not found + continue; + } + string id = tzLookupLine.Substring(idStart, idLength); + tzLookupIDs.Add(id); + } + } + } + catch {} + } + [MemberNotNullWhen(true, nameof(_ids))] [MemberNotNullWhen(true, nameof(_byteOffsets))] [MemberNotNullWhen(true, nameof(_lengths))] - private bool LoadData(string path) + [MemberNotNullWhen(true, nameof(_isBackwards))] + private bool LoadData(string tzFileDir, string path) { if (!File.Exists(path)) { @@ -254,7 +307,7 @@ private bool LoadData(string path) { using (FileStream fs = File.OpenRead(path)) { - LoadTzFile(fs); + LoadTzFile(tzFileDir, fs); } return true; } @@ -266,7 +319,8 @@ private bool LoadData(string path) [MemberNotNull(nameof(_ids))] [MemberNotNull(nameof(_byteOffsets))] [MemberNotNull(nameof(_lengths))] - private void LoadTzFile(Stream fs) + [MemberNotNull(nameof(_isBackwards))] + private void LoadTzFile(string tzFileDir, Stream fs) { const int HeaderSize = 24; Span buffer = stackalloc byte[HeaderSize]; @@ -274,7 +328,7 @@ private void LoadTzFile(Stream fs) ReadTzDataIntoBuffer(fs, 0, buffer); LoadHeader(buffer, out int indexOffset, out int dataOffset); - ReadIndex(fs, indexOffset, dataOffset); + ReadIndex(tzFileDir, fs, indexOffset, dataOffset); } private void LoadHeader(Span buffer, out int indexOffset, out int dataOffset) @@ -303,16 +357,17 @@ private void LoadHeader(Span buffer, out int indexOffset, out int dataOffs [MemberNotNull(nameof(_ids))] [MemberNotNull(nameof(_byteOffsets))] [MemberNotNull(nameof(_lengths))] - private void ReadIndex(Stream fs, int indexOffset, int dataOffset) + [MemberNotNull(nameof(_isBackwards))] + private void ReadIndex(string tzFileDir, Stream fs, int indexOffset, int dataOffset) { int indexSize = dataOffset - indexOffset; const int entrySize = 52; // Data entry size int entryCount = indexSize / entrySize; - _byteOffsets = new int[entryCount]; _ids = new string[entryCount]; _lengths = new int[entryCount]; - + _isBackwards = new bool[entryCount]; + FilterBackwardIDs(tzFileDir, out HashSet tzLookupIDs); for (int i = 0; i < entryCount; ++i) { LoadEntryAt(fs, indexOffset + (entrySize*i), out string id, out int byteOffset, out int length); @@ -320,6 +375,7 @@ private void ReadIndex(Stream fs, int indexOffset, int dataOffset) _byteOffsets[i] = byteOffset + dataOffset; _ids[i] = id; _lengths[i] = length; + _isBackwards[i] = !tzLookupIDs.Contains(id); if (length < 24) // Header Size { @@ -372,7 +428,25 @@ private void LoadEntryAt(Stream fs, long position, out string id, out int byteOf public string[] GetTimeZoneIds() { - return _ids; + int numTimeZoneIDs = 0; + for (int i = 0; i < _ids.Length; i++) + { + if (!_isBackwards[i]) + { + numTimeZoneIDs++; + } + } + string[] nonBackwardsTZIDs = new string[numTimeZoneIDs]; + var index = 0; + for (int i = 0; i < _ids.Length; i++) + { + if (!_isBackwards[i]) + { + nonBackwardsTZIDs[index] = _ids[i]; + index++; + } + } + return nonBackwardsTZIDs; } public string GetTimeZoneDirectory() diff --git a/src/libraries/System.Runtime/tests/System/TimeZoneInfoTests.cs b/src/libraries/System.Runtime/tests/System/TimeZoneInfoTests.cs index fb7b8292b03f9d..e3e5bdd4564f30 100644 --- a/src/libraries/System.Runtime/tests/System/TimeZoneInfoTests.cs +++ b/src/libraries/System.Runtime/tests/System/TimeZoneInfoTests.cs @@ -2922,6 +2922,20 @@ public static void AdjustmentRuleBaseUtcOffsetDeltaTest() Assert.Equal(new TimeSpan(2, 0, 0), customTimeZone.GetUtcOffset(new DateTime(2021, 3, 10, 2, 0, 0))); } + [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/64111", TestPlatforms.Linux)] + public static void NoBackwardTimeZones() + { + ReadOnlyCollection tzCollection = TimeZoneInfo.GetSystemTimeZones(); + HashSet tzDisplayNames = new HashSet(); + + foreach (TimeZoneInfo timezone in tzCollection) + { + tzDisplayNames.Add(timezone.DisplayName); + } + Assert.Equal(tzCollection.Count, tzDisplayNames.Count); + } + private static bool IsEnglishUILanguage => CultureInfo.CurrentUICulture.Name.Length == 0 || CultureInfo.CurrentUICulture.TwoLetterISOLanguageName == "en"; private static bool IsEnglishUILanguageAndRemoteExecutorSupported => IsEnglishUILanguage && RemoteExecutor.IsSupported; From a5cf724aa2c9a67eb45827b56d6315acd4edea84 Mon Sep 17 00:00:00 2001 From: Santiago Fernandez Madero Date: Mon, 24 Jan 2022 17:28:03 -0800 Subject: [PATCH 049/161] Update main branding to preview2 (#64219) --- eng/Versions.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 6484ee772cec7c..e9d607da85bfca 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -7,8 +7,8 @@ 0 0 7.0.100 - alpha - 1 + preview + 2 $(MajorVersion).$(MinorVersion).0.0 From 341c3941ad4065686f7a9f627b773b8e4e3c0999 Mon Sep 17 00:00:00 2001 From: Kunal Pathak Date: Mon, 24 Jan 2022 21:49:56 -0800 Subject: [PATCH 050/161] Catch UnicodeEncodeErrors (#64251) --- src/coreclr/scripts/jitutil.py | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/coreclr/scripts/jitutil.py b/src/coreclr/scripts/jitutil.py index 9552869dffa979..5df464da5fc0cb 100644 --- a/src/coreclr/scripts/jitutil.py +++ b/src/coreclr/scripts/jitutil.py @@ -85,12 +85,31 @@ def set_pipeline_variable(name, value): print(define_variable_format.format(name, value)) # set variable + ################################################################################ ## ## Helper functions ## ################################################################################ +def decode_string(str_to_decode): + """Decode a UTF-8 encoded bytes to string. + + Args: + str_to_decode (byte stream): Byte stream to decode + + Returns: + String output. If there any encoding/decoding errors, it will replace it with + UnicodeEncodeError. + """ + try: + output = str_to_decode.decode("utf-8", errors='replace') + except UnicodeEncodeError: + output = "UnicodeEncodeError" + except UnicodeDecodeError: + output = "UnicodeDecodeError" + return output + def run_command(command_to_run, _cwd=None, _exit_on_fail=False, _output_file=None): """ Runs the command. @@ -119,15 +138,15 @@ def run_command(command_to_run, _cwd=None, _exit_on_fail=False, _output_file=Non if proc.poll() is not None: break if output: - output_str = output.strip().decode("utf-8", errors='replace') + output_str = decode_string(output.strip()) print(output_str) of.write(output_str + "\n") else: command_stdout, command_stderr = proc.communicate() if len(command_stdout) > 0: - print(command_stdout.decode("utf-8", errors='replace')) + print(decode_string(command_stdout)) if len(command_stderr) > 0: - print(command_stderr.decode("utf-8", errors='replace')) + print(decode_string(command_stderr)) return_code = proc.returncode if _exit_on_fail and return_code != 0: From a5a645313d41332fcb6f90ece69c8c8738c5b93c Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Tue, 25 Jan 2022 08:15:27 +0100 Subject: [PATCH 051/161] Make XmlSerializer.Generator targets incremental (#64191) * Make XmlSerializer.Generator targets incremental Adding inputs and outputs to make XmlSerializer.Generator incremental --- .../src/GenerateNupkgProps.targets | 6 ++++-- .../src/GenerateThisAssemblyCs.targets | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/libraries/Microsoft.XmlSerializer.Generator/src/GenerateNupkgProps.targets b/src/libraries/Microsoft.XmlSerializer.Generator/src/GenerateNupkgProps.targets index 6a402a0cfeb096..74fd8ebb92b2cd 100644 --- a/src/libraries/Microsoft.XmlSerializer.Generator/src/GenerateNupkgProps.targets +++ b/src/libraries/Microsoft.XmlSerializer.Generator/src/GenerateNupkgProps.targets @@ -10,7 +10,9 @@ Pack="true" /> - + <Project> @@ -25,4 +27,4 @@ Lines="$(PropsFileContents)" Overwrite="true" /> - \ No newline at end of file + diff --git a/src/libraries/Microsoft.XmlSerializer.Generator/src/GenerateThisAssemblyCs.targets b/src/libraries/Microsoft.XmlSerializer.Generator/src/GenerateThisAssemblyCs.targets index 31fe16ae8c6f1a..aa5b94b12c7a6c 100644 --- a/src/libraries/Microsoft.XmlSerializer.Generator/src/GenerateThisAssemblyCs.targets +++ b/src/libraries/Microsoft.XmlSerializer.Generator/src/GenerateThisAssemblyCs.targets @@ -4,6 +4,8 @@ @@ -44,6 +46,6 @@ namespace Microsoft.XmlSerializer.Generator File="$(IntermediateOutputPath)ThisAssembly.cs" Lines="$(ThisAssemblyCsContents)" Overwrite="true" - Encoding="Unicode"/> + Encoding="Unicode" /> From 9c938f726b7ca6d432114dae0504a5c164e8fbd6 Mon Sep 17 00:00:00 2001 From: Adam Sitnik Date: Tue, 25 Jan 2022 08:15:55 +0100 Subject: [PATCH 052/161] Make sure that shared memory object name meets the length requirements (#64099) Co-authored-by: Stephen Toub --- .../MemoryMappedFile.Unix.cs | 52 +++++++++++++------ .../tests/MemoryMappedFile.CreateNew.Tests.cs | 1 - .../tests/MemoryMappedViewAccessor.Tests.cs | 1 - .../tests/MemoryMappedViewStream.Tests.cs | 1 - .../MemoryMappedViewStreamConformanceTests.cs | 1 - src/native/libs/System.Native/pal_io.c | 6 +++ 6 files changed, 42 insertions(+), 20 deletions(-) diff --git a/src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.Unix.cs b/src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.Unix.cs index 389ab072d9a6c9..6882527cecc8de 100644 --- a/src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.Unix.cs +++ b/src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.Unix.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Diagnostics; using Microsoft.Win32.SafeHandles; namespace System.IO.MemoryMappedFiles @@ -173,9 +174,6 @@ private static FileStream CreateSharedBackingObject(Interop.Sys.MemoryMappedProt private static FileStream? CreateSharedBackingObjectUsingMemory( Interop.Sys.MemoryMappedProtections protections, long capacity, HandleInheritability inheritability) { - // The POSIX shared memory object name must begin with '/'. After that we just want something short and unique. - string mapName = string.Create(null, stackalloc char[128], $"/corefx_map_{Guid.NewGuid():N}"); - // Determine the flags to use when creating the shared memory object Interop.Sys.OpenFlags flags = (protections & Interop.Sys.MemoryMappedProtections.PROT_WRITE) != 0 ? Interop.Sys.OpenFlags.O_RDWR : @@ -191,22 +189,32 @@ private static FileStream CreateSharedBackingObject(Interop.Sys.MemoryMappedProt if ((protections & Interop.Sys.MemoryMappedProtections.PROT_EXEC) != 0) perms |= Interop.Sys.Permissions.S_IXUSR; - // Create the shared memory object. - SafeFileHandle fd = Interop.Sys.ShmOpen(mapName, flags, (int)perms); - if (fd.IsInvalid) + string mapName; + SafeFileHandle fd; + + do { - Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo(); - if (errorInfo.Error == Interop.Error.ENOTSUP) + mapName = GenerateMapName(); + fd = Interop.Sys.ShmOpen(mapName, flags, (int)perms); // Create the shared memory object. + + if (fd.IsInvalid) { - // If ShmOpen is not supported, fall back to file backing object. - // Note that the System.Native shim will force this failure on platforms where - // the result of native shm_open does not work well with our subsequent call - // to mmap. - return null; - } + Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo(); + fd.Dispose(); - throw Interop.GetExceptionForIoErrno(errorInfo); - } + if (errorInfo.Error == Interop.Error.ENOTSUP) + { + // If ShmOpen is not supported, fall back to file backing object. + // Note that the System.Native shim will force this failure on platforms where + // the result of native shm_open does not work well with our subsequent call to mmap. + return null; + } + else if (errorInfo.Error != Interop.Error.EEXIST) // map with same name already existed + { + throw Interop.GetExceptionForIoErrno(errorInfo); + } + } + } while (fd.IsInvalid); try { @@ -236,6 +244,18 @@ private static FileStream CreateSharedBackingObject(Interop.Sys.MemoryMappedProt fd.Dispose(); throw; } + + static string GenerateMapName() + { + const int MaxSharedMemoryObjectNameLength = 32; // SHM_NAME_MAX on OSX ARM64, on other systems it's equal PATH_MAX (250) + // The POSIX shared memory object name must begin with '/'. After that we just want something short (32) and unique. + return string.Create(MaxSharedMemoryObjectNameLength, 0, (span, state) => + { + Guid.NewGuid().TryFormat(span, out int charsWritten, "N"); + Debug.Assert(charsWritten == MaxSharedMemoryObjectNameLength); + "/dotnet_".CopyTo(span); + }); + } } private static FileStream CreateSharedBackingObjectUsingFile(Interop.Sys.MemoryMappedProtections protections, long capacity, HandleInheritability inheritability) diff --git a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedFile.CreateNew.Tests.cs b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedFile.CreateNew.Tests.cs index 4336ce74d6a223..70b82398301d56 100644 --- a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedFile.CreateNew.Tests.cs +++ b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedFile.CreateNew.Tests.cs @@ -11,7 +11,6 @@ namespace System.IO.MemoryMappedFiles.Tests /// /// Tests for MemoryMappedFile.CreateNew. /// - [ActiveIssue("https://github.com/dotnet/runtime/issues/63240", typeof(PlatformDetection), nameof(PlatformDetection.IsOSX), nameof(PlatformDetection.IsArm64Process), nameof(PlatformDetection.IsNotMonoRuntime))] public class MemoryMappedFileTests_CreateNew : MemoryMappedFilesTestBase { /// diff --git a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewAccessor.Tests.cs b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewAccessor.Tests.cs index adcfb0e9d4cc42..8fe35396ae8044 100644 --- a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewAccessor.Tests.cs +++ b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewAccessor.Tests.cs @@ -11,7 +11,6 @@ namespace System.IO.MemoryMappedFiles.Tests /// /// Tests for MemoryMappedViewAccessor. /// - [ActiveIssue("https://github.com/dotnet/runtime/issues/63240", typeof(PlatformDetection), nameof(PlatformDetection.IsOSX), nameof(PlatformDetection.IsArm64Process), nameof(PlatformDetection.IsNotMonoRuntime))] public class MemoryMappedViewAccessorTests : MemoryMappedFilesTestBase { /// diff --git a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStream.Tests.cs b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStream.Tests.cs index 3a950662e5d498..f279b8c33f98f7 100644 --- a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStream.Tests.cs +++ b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStream.Tests.cs @@ -11,7 +11,6 @@ namespace System.IO.MemoryMappedFiles.Tests /// /// Tests for MemoryMappedViewStream. /// - [ActiveIssue("https://github.com/dotnet/runtime/issues/63240", typeof(PlatformDetection), nameof(PlatformDetection.IsOSX), nameof(PlatformDetection.IsArm64Process), nameof(PlatformDetection.IsNotMonoRuntime))] public class MemoryMappedViewStreamTests : MemoryMappedFilesTestBase { /// diff --git a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStreamConformanceTests.cs b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStreamConformanceTests.cs index 1ec0b14fb8a15e..c190d329a00fe6 100644 --- a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStreamConformanceTests.cs +++ b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStreamConformanceTests.cs @@ -45,7 +45,6 @@ private Task CreateStream(byte[] initialData, FileAccess access) } } - [ActiveIssue("https://github.com/dotnet/runtime/issues/63240", typeof(PlatformDetection), nameof(PlatformDetection.IsOSX), nameof(PlatformDetection.IsArm64Process), nameof(PlatformDetection.IsNotMonoRuntime))] public class AnonymousMemoryMappedViewStreamConformanceTests : MemoryMappedViewStreamConformanceTests { protected override MemoryMappedFile CreateFile(int length) => diff --git a/src/native/libs/System.Native/pal_io.c b/src/native/libs/System.Native/pal_io.c index d11ce950f12460..f6cf0d2aa23eac 100644 --- a/src/native/libs/System.Native/pal_io.c +++ b/src/native/libs/System.Native/pal_io.c @@ -332,6 +332,12 @@ int32_t SystemNative_Unlink(const char* path) intptr_t SystemNative_ShmOpen(const char* name, int32_t flags, int32_t mode) { +#if defined(SHM_NAME_MAX) // macOS + assert(strlen(name) <= SHM_NAME_MAX); +#elif defined(PATH_MAX) // other Unixes + assert(strlen(name) <= PATH_MAX); +#endif + #if HAVE_SHM_OPEN_THAT_WORKS_WELL_ENOUGH_WITH_MMAP flags = ConvertOpenFlags(flags); if (flags == -1) From 0d1049fd11d2e2154ce852970cace53b4b296746 Mon Sep 17 00:00:00 2001 From: Adeel Mujahid <3840695+am11@users.noreply.github.com> Date: Tue, 25 Jan 2022 12:00:20 +0200 Subject: [PATCH 053/161] Fix PAL_wprintf for wide characters (#64181) --- src/coreclr/pal/src/cruntime/printfcpp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/pal/src/cruntime/printfcpp.cpp b/src/coreclr/pal/src/cruntime/printfcpp.cpp index d7e992c090a00b..fee79c91df12b4 100644 --- a/src/coreclr/pal/src/cruntime/printfcpp.cpp +++ b/src/coreclr/pal/src/cruntime/printfcpp.cpp @@ -86,7 +86,7 @@ static int Internal_Convertfwrite(CPalThread *pthrCurrent, const void *buffer, s free(newBuff); return -1; } - ret = InternalFwrite(newBuff, 1, count, stream, &iError); + ret = InternalFwrite(newBuff, 1, nsize, stream, &iError); if (iError != 0) { ERROR("InternalFwrite did not write the whole buffer. Error is %d\n", iError); From 8d0c3d1ab1f16c3a1d15b8d9eb25cc920d936694 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 25 Jan 2022 12:11:58 +0100 Subject: [PATCH 054/161] [main] Update dependencies from dotnet/runtime dotnet/llvm-project (#64205) * Update dependencies from https://github.com/dotnet/runtime build 20220123.5 Microsoft.NETCore.ILAsm , Microsoft.NETCore.DotNetHostPolicy , Microsoft.NETCore.DotNetHost , Microsoft.NETCore.App.Runtime.win-x64 , System.Runtime.CompilerServices.Unsafe , runtime.native.System.IO.Ports , Microsoft.NET.Sdk.IL , System.Text.Json From Version 7.0.0-alpha.1.22066.4 -> To Version 7.0.0-alpha.1.22073.5 * Update dependencies from https://github.com/dotnet/llvm-project build 20220123.1 runtime.win-x64.Microsoft.NETCore.Runtime.ObjWriter , runtime.win-arm64.Microsoft.NETCore.Runtime.ObjWriter , runtime.osx.10.12-x64.Microsoft.NETCore.Runtime.ObjWriter , runtime.osx.11.0-arm64.Microsoft.NETCore.Runtime.ObjWriter , runtime.linux-x64.Microsoft.NETCore.Runtime.ObjWriter , runtime.linux-musl-x64.Microsoft.NETCore.Runtime.ObjWriter , runtime.linux-musl-arm64.Microsoft.NETCore.Runtime.ObjWriter , runtime.linux-arm64.Microsoft.NETCore.Runtime.ObjWriter From Version 1.0.0-alpha.1.22070.1 -> To Version 1.0.0-alpha.1.22073.1 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 64 ++++++++++++++++++++--------------------- eng/Versions.props | 30 +++++++++---------- global.json | 2 +- 3 files changed, 48 insertions(+), 48 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ee709f74031a46..b01aa4c37ed5bd 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -16,37 +16,37 @@ https://github.com/dotnet/wcf 7f504aabb1988e9a093c1e74d8040bd52feb2f01 - + https://github.com/dotnet/llvm-project - fe77708023f3d8a51c1548b86487a692897227ec + afc9070f64d110ce2bf029a4a624b9dd1c6dbffd - + https://github.com/dotnet/llvm-project - fe77708023f3d8a51c1548b86487a692897227ec + afc9070f64d110ce2bf029a4a624b9dd1c6dbffd - + https://github.com/dotnet/llvm-project - fe77708023f3d8a51c1548b86487a692897227ec + afc9070f64d110ce2bf029a4a624b9dd1c6dbffd - + https://github.com/dotnet/llvm-project - fe77708023f3d8a51c1548b86487a692897227ec + afc9070f64d110ce2bf029a4a624b9dd1c6dbffd - + https://github.com/dotnet/llvm-project - fe77708023f3d8a51c1548b86487a692897227ec + afc9070f64d110ce2bf029a4a624b9dd1c6dbffd - + https://github.com/dotnet/llvm-project - fe77708023f3d8a51c1548b86487a692897227ec + afc9070f64d110ce2bf029a4a624b9dd1c6dbffd - + https://github.com/dotnet/llvm-project - fe77708023f3d8a51c1548b86487a692897227ec + afc9070f64d110ce2bf029a4a624b9dd1c6dbffd - + https://github.com/dotnet/llvm-project - fe77708023f3d8a51c1548b86487a692897227ec + afc9070f64d110ce2bf029a4a624b9dd1c6dbffd @@ -202,37 +202,37 @@ https://github.com/dotnet/llvm-project 79a6d232058e2c2f1d9e833355b72f07fe342a3b - + https://github.com/dotnet/runtime - ae2f60c950cc021921fce83c796cbcb5ff96c658 + 09ff1acdad2e7789908b5db9bb89896144c13042 - + https://github.com/dotnet/runtime - ae2f60c950cc021921fce83c796cbcb5ff96c658 + 09ff1acdad2e7789908b5db9bb89896144c13042 - + https://github.com/dotnet/runtime - ae2f60c950cc021921fce83c796cbcb5ff96c658 + 09ff1acdad2e7789908b5db9bb89896144c13042 - + https://github.com/dotnet/runtime - ae2f60c950cc021921fce83c796cbcb5ff96c658 + 09ff1acdad2e7789908b5db9bb89896144c13042 - + https://github.com/dotnet/runtime - ae2f60c950cc021921fce83c796cbcb5ff96c658 + 09ff1acdad2e7789908b5db9bb89896144c13042 - + https://github.com/dotnet/runtime - ae2f60c950cc021921fce83c796cbcb5ff96c658 + 09ff1acdad2e7789908b5db9bb89896144c13042 - + https://github.com/dotnet/runtime - ae2f60c950cc021921fce83c796cbcb5ff96c658 + 09ff1acdad2e7789908b5db9bb89896144c13042 - + https://github.com/dotnet/runtime - ae2f60c950cc021921fce83c796cbcb5ff96c658 + 09ff1acdad2e7789908b5db9bb89896144c13042 https://github.com/dotnet/linker diff --git a/eng/Versions.props b/eng/Versions.props index e9d607da85bfca..535f0f7e4f01e4 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -72,20 +72,20 @@ 6.0.0-preview.1.102 - 7.0.0-alpha.1.22066.4 - 7.0.0-alpha.1.22066.4 - 7.0.0-alpha.1.22066.4 + 7.0.0-alpha.1.22073.5 + 7.0.0-alpha.1.22073.5 + 7.0.0-alpha.1.22073.5 3.1.0 - 7.0.0-alpha.1.22066.4 - 1.0.0-alpha.1.22070.1 - 1.0.0-alpha.1.22070.1 - 1.0.0-alpha.1.22070.1 - 1.0.0-alpha.1.22070.1 - 1.0.0-alpha.1.22070.1 - 1.0.0-alpha.1.22070.1 - 1.0.0-alpha.1.22070.1 - 1.0.0-alpha.1.22070.1 + 7.0.0-alpha.1.22073.5 + 1.0.0-alpha.1.22073.1 + 1.0.0-alpha.1.22073.1 + 1.0.0-alpha.1.22073.1 + 1.0.0-alpha.1.22073.1 + 1.0.0-alpha.1.22073.1 + 1.0.0-alpha.1.22073.1 + 1.0.0-alpha.1.22073.1 + 1.0.0-alpha.1.22073.1 5.0.0 4.3.0 @@ -120,11 +120,11 @@ 5.0.0 5.0.0 4.9.0-rc2.21473.1 - 7.0.0-alpha.1.22066.4 - 7.0.0-alpha.1.22066.4 + 7.0.0-alpha.1.22073.5 + 7.0.0-alpha.1.22073.5 4.5.4 4.5.0 - 7.0.0-alpha.1.22066.4 + 7.0.0-alpha.1.22073.5 7.0.0-beta.22060.1 7.0.0-beta.22060.1 diff --git a/global.json b/global.json index e0d86ef423d93f..f32ffc29ff09d7 100644 --- a/global.json +++ b/global.json @@ -18,6 +18,6 @@ "Microsoft.DotNet.SharedFramework.Sdk": "7.0.0-beta.22071.6", "Microsoft.Build.NoTargets": "3.1.0", "Microsoft.Build.Traversal": "3.0.23", - "Microsoft.NET.Sdk.IL": "7.0.0-alpha.1.22066.4" + "Microsoft.NET.Sdk.IL": "7.0.0-alpha.1.22073.5" } } From 4d16d0934259b2b1b056823986bb0ad08578c5c0 Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Tue, 25 Jan 2022 13:09:57 +0100 Subject: [PATCH 055/161] Delete unused ApiCompat baseline files (#64190) * Delete unused ApiCompat baseline files * Delete ApiCompatBaseline.netfx.netstandardOnly.txt * Remove manual .NETFramework baseline validation * Delete ApiCompatBaseline.netcoreapp.netfx461.ignore.txt * Delete ApiCompatBaseline.netcoreapp.netfx461.txt --- src/libraries/shims/ApiCompat.proj | 20 +- ...patBaseline.netcoreapp.netfx461.ignore.txt | 2709 ----------------- .../ApiCompatBaseline.netcoreapp.netfx461.txt | 614 ---- .../ApiCompatBaseline.netfx.netstandard.txt | 102 - ...piCompatBaseline.netfx.netstandardOnly.txt | 870 ------ 5 files changed, 1 insertion(+), 4314 deletions(-) delete mode 100644 src/libraries/shims/ApiCompatBaseline.netcoreapp.netfx461.ignore.txt delete mode 100644 src/libraries/shims/ApiCompatBaseline.netcoreapp.netfx461.txt delete mode 100644 src/libraries/shims/ApiCompatBaseline.netfx.netstandard.txt delete mode 100644 src/libraries/shims/ApiCompatBaseline.netfx.netstandardOnly.txt diff --git a/src/libraries/shims/ApiCompat.proj b/src/libraries/shims/ApiCompat.proj index 3b2c6ceae57c06..e27786ccb1a54c 100644 --- a/src/libraries/shims/ApiCompat.proj +++ b/src/libraries/shims/ApiCompat.proj @@ -1,12 +1,5 @@ - - - - - - - @@ -16,8 +9,6 @@ - $(MSBuildThisFileDirectory)ApiCompatBaseline.netcoreapp.netfx461.txt - $(MSBuildThisFileDirectory)ApiCompatBaseline.netcoreapp.netfx461.ignore.txt $(MSBuildThisFileDirectory)ApiCompatBaseline.netcoreapp.netstandard.txt $(MSBuildThisFileDirectory)ApiCompatBaseline.netcoreapp.netstandardOnly.txt $(MSBuildThisFileDirectory)ApiCompatBaseline.PreviousNetCoreApp.txt @@ -32,7 +23,7 @@ @@ -46,15 +37,6 @@ Lines="$(ApiCompatArgs)" Overwrite="true" /> - - - - - $([MSBuild]::NormalizeDirectory('$(NuGetPackageRoot)', 'netstandard.library', '$(NetStandardLibraryVersion)', 'build', 'netstandard2.0', 'ref')) diff --git a/src/libraries/shims/ApiCompatBaseline.netcoreapp.netfx461.ignore.txt b/src/libraries/shims/ApiCompatBaseline.netcoreapp.netfx461.ignore.txt deleted file mode 100644 index b0420059f5aae9..00000000000000 --- a/src/libraries/shims/ApiCompatBaseline.netcoreapp.netfx461.ignore.txt +++ /dev/null @@ -1,2709 +0,0 @@ -// HttpVersion changed to static class intentionally. See here: https://github.com/dotnet/standard/issues/91 -CannotMakeTypeAbstract : Type 'System.Net.HttpVersion' is abstract in the implementation but is not abstract in the contract. -CannotSealType : Type 'System.Net.HttpVersion' is sealed in the implementation but not sealed in the contract. -MembersMustExist : Member 'System.Net.HttpVersion..ctor()' does not exist in the implementation but it does exist in the contract. - -// RuntimeEnvironment changed to static class intentionally. See here: https://github.com/dotnet/standard/commit/d5fbcbeeeb7f15102fdac111bc8d7d5d72c32036#diff-2856a41639a1f4feb4e95ae667e069b7R10012 -CannotMakeTypeAbstract : Type 'System.Runtime.InteropServices.RuntimeEnvironment' is abstract in the implementation but is not abstract in the contract. -CannotSealType : Type 'System.Runtime.InteropServices.RuntimeEnvironment' is sealed in the implementation but not sealed in the contract. -MembersMustExist : Member 'System.Runtime.InteropServices.RuntimeEnvironment..ctor()' does not exist in the implementation but it does exist in the contract. - -// Activator changed to static class intentionally. See here: https://github.com/dotnet/runtime/issues/18630 -CannotMakeTypeAbstract : Type 'System.Activator' is abstract in the implementation but is not abstract in the contract. - -// System.Drawing types changed to static intentionally. Change is source and binary compatible. https://github.com/dotnet/corefx/commit/ad215be2fa28a7d2f19a90c1ba04c50c3b677253 -CannotMakeTypeAbstract : Type 'System.Drawing.Brushes' is abstract in the implementation but is not abstract in the contract. -CannotMakeTypeAbstract : Type 'System.Drawing.Pens' is abstract in the implementation but is not abstract in the contract. -CannotMakeTypeAbstract : Type 'System.Drawing.SystemBrushes' is abstract in the implementation but is not abstract in the contract. -CannotMakeTypeAbstract : Type 'System.Drawing.SystemColors' is abstract in the implementation but is not abstract in the contract. -CannotMakeTypeAbstract : Type 'System.Drawing.SystemFonts' is abstract in the implementation but is not abstract in the contract. -CannotMakeTypeAbstract : Type 'System.Drawing.SystemIcons' is abstract in the implementation but is not abstract in the contract. -CannotMakeTypeAbstract : Type 'System.Drawing.SystemPens' is abstract in the implementation but is not abstract in the contract. -CannotMakeTypeAbstract : Type 'System.Drawing.BufferedGraphicsManager' is abstract in the implementation but is not abstract in the contract. - -// Won't came back into netcoreapp. See here: https://github.com/dotnet/runtime/issues/20974 -MembersMustExist : Member 'System.ComponentModel.DataAnnotations.ValidationContext.ServiceContainer.get()' does not exist in the implementation but it does exist in the contract. - -// Debugger changed to static class intentionally. See here: https://github.com/dotnet/standard/commit/d5fbcbeeeb7f15102fdac111bc8d7d5d72c32036#diff-2856a41639a1f4feb4e95ae667e069b7R10012 -CannotMakeTypeAbstract : Type 'System.Diagnostics.Debugger' is abstract in the implementation but is not abstract in the contract. -MembersMustExist : Member 'System.Diagnostics.Debugger..ctor()' does not exist in the implementation but it does exist in the contract. - -// IRemotingFormatter won't be implemented in netcore20 -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.Serialization.Formatters.Binary.BinaryFormatter' does not implement interface 'System.Runtime.Remoting.Messaging.IRemotingFormatter' in the implementation but it does in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Messaging.IRemotingFormatter' does not exist in the implementation but it does exist in the contract. - -// SchemaImporter won't be implemented in netcore20 -TypesMustExist : Type 'System.Xml.Serialization.SchemaImporter' does not exist in the implementation but it does exist in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlSchemaImporter' does not inherit from base type 'System.Xml.Serialization.SchemaImporter' in the implementation but it does in the contract. - -// IServiceProvider won't be implemented by SqlClientFactory. See here: https://github.com/dotnet/runtime/issues/20832 -CannotRemoveBaseTypeOrInterface : Type 'System.Data.SqlClient.SqlClientFactory' does not implement interface 'System.IServiceProvider' in the implementation but it does in the contract. - -// DynData Win9x only. Not going to be implemented in any netcore versions. See here: https://github.com/dotnet/runtime/issues/19972 -MembersMustExist : Member 'Microsoft.Win32.RegistryKey Microsoft.Win32.Registry.DynData' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'Microsoft.Win32.RegistryHive Microsoft.Win32.RegistryHive.DynData' does not exist in the implementation but it does exist in the contract. - -// AppDomain.SetupInformation not going to be implemented in netcore20 as no remoting support: -MembersMustExist : Member 'System.AppDomain.SetupInformation.get()' does not exist in the implementation but it does exist in the contract. - -// SetAccessControl in FileStream not going to be implemented in netcore20 as no ACL support: -MembersMustExist : Member 'System.IO.FileStream.SetAccessControl(System.Security.AccessControl.FileSecurity)' does not exist in the implementation but it does exist in the contract. - -// StackTrace ctor deprecated in net472 and won't be implemented in any netcoreapp versions: -MembersMustExist : Member 'System.Diagnostics.StackTrace..ctor(System.Threading.Thread, System.Boolean)' does not exist in the implementation but it does exist in the contract. - -// Dan said there is a reason for those in System.Resrouces to ignore: -MembersMustExist : Member 'System.String System.Resources.ResourceManager.BaseNameField' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Collections.Hashtable System.Resources.ResourceSet.Table' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Resources.IResourceReader System.Resources.ResourceSet.Reader' does not exist in the implementation but it does exist in the contract. - -// Thread.CurrentContext is not supported because of remoting: -MembersMustExist : Member 'System.Threading.Thread.CurrentContext.get()' does not exist in the implementation but it does exist in the contract. - -// Debug.Listeners won't be implemented in netstandard20 and netcoreapp20. See here: https://github.com/dotnet/standard/issues/84 -MembersMustExist : Member 'System.Diagnostics.Debug.Listeners.get()' does not exist in the implementation but it does exist in the contract. - -// IsolatedStorage methods won't be implemented in netstandard20 and netcoreapp20. See here: https://github.com/dotnet/runtime/issues/20970 -MembersMustExist : Member 'System.IO.IsolatedStorage.IsolatedStorage.GetPermission(System.Security.PermissionSet)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.IsolatedStorage.IsolatedStorageFile.GetPermission(System.Security.PermissionSet)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.IsolatedStorage.IsolatedStorageFile.GetStore(System.IO.IsolatedStorage.IsolatedStorageScope, System.Security.Policy.Evidence, System.Type, System.Security.Policy.Evidence, System.Type)' does not exist in the implementation but it does exist in the contract. - -// Crypto types and members are sealed in netstandard and netcoreapp because they are sealed in Xamarin. https://github.com/dotnet/runtime/issues/20870 -CannotSealType : Type 'System.Security.Cryptography.SHA1Managed' is sealed in the implementation but not sealed in the contract. -CannotMakeMemberNonVirtual : Member 'System.Security.Cryptography.SHA1Managed.HashCore(System.Byte[], System.Int32, System.Int32)' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'System.Security.Cryptography.SHA1Managed.HashFinal()' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'System.Security.Cryptography.SHA1Managed.Initialize()' is non-virtual in the implementation but is virtual in the contract. -CannotSealType : Type 'System.Security.Cryptography.SHA256Managed' is sealed in the implementation but not sealed in the contract. -CannotMakeMemberNonVirtual : Member 'System.Security.Cryptography.SHA256Managed.HashCore(System.Byte[], System.Int32, System.Int32)' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'System.Security.Cryptography.SHA256Managed.HashFinal()' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'System.Security.Cryptography.SHA256Managed.Initialize()' is non-virtual in the implementation but is virtual in the contract. -CannotSealType : Type 'System.Security.Cryptography.SHA384Managed' is sealed in the implementation but not sealed in the contract. -CannotMakeMemberNonVirtual : Member 'System.Security.Cryptography.SHA384Managed.HashCore(System.Byte[], System.Int32, System.Int32)' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'System.Security.Cryptography.SHA384Managed.HashFinal()' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'System.Security.Cryptography.SHA384Managed.Initialize()' is non-virtual in the implementation but is virtual in the contract. -CannotSealType : Type 'System.Security.Cryptography.SHA512Managed' is sealed in the implementation but not sealed in the contract. -CannotMakeMemberNonVirtual : Member 'System.Security.Cryptography.SHA512Managed.HashCore(System.Byte[], System.Int32, System.Int32)' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'System.Security.Cryptography.SHA512Managed.HashFinal()' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'System.Security.Cryptography.SHA512Managed.Initialize()' is non-virtual in the implementation but is virtual in the contract. - -// Can't build WindowsIdentities or WindowsPrincipals on non-Windows OSes. https://github.com/dotnet/runtime/issues/20972 -MembersMustExist : Member 'System.Security.Principal.IdentityReferenceCollection.IsReadOnly.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WindowsIdentity..ctor(System.Security.Principal.WindowsIdentity)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WindowsIdentity..ctor(System.String, System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WindowsIdentity.DeviceClaims.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WindowsIdentity.Impersonate()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WindowsIdentity.Impersonate(System.IntPtr)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WindowsIdentity.UserClaims.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WindowsPrincipal.DeviceClaims.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WindowsPrincipal.UserClaims.get()' does not exist in the implementation but it does exist in the contract. - -// Reflection.Emit future unclear and won't be implemented till netcoreapp20. See here: https://github.com/dotnet/runtime/issues/20971 -MembersMustExist : Member 'System.Reflection.Emit.AssemblyBuilder.AddResourceFile(System.String, System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.AssemblyBuilder.AddResourceFile(System.String, System.String, System.Reflection.ResourceAttributes)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.AssemblyBuilder.DefineDynamicModule(System.String, System.Boolean)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.AssemblyBuilder.DefineDynamicModule(System.String, System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.AssemblyBuilder.DefineDynamicModule(System.String, System.String, System.Boolean)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.AssemblyBuilder.DefineResource(System.String, System.String, System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.AssemblyBuilder.DefineResource(System.String, System.String, System.String, System.Reflection.ResourceAttributes)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.AssemblyBuilder.DefineUnmanagedResource(System.Byte[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.AssemblyBuilder.DefineUnmanagedResource(System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.AssemblyBuilder.DefineVersionInfoResource()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.AssemblyBuilder.DefineVersionInfoResource(System.String, System.String, System.String, System.String, System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.AssemblyBuilder.Evidence.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.AssemblyBuilder.PermissionSet.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.AssemblyBuilder.Save(System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.AssemblyBuilder.Save(System.String, System.Reflection.PortableExecutableKinds, System.Reflection.ImageFileMachine)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.AssemblyBuilder.SetEntryPoint(System.Reflection.MethodInfo)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.AssemblyBuilder.SetEntryPoint(System.Reflection.MethodInfo, System.Reflection.Emit.PEFileKinds)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.AssemblyBuilderAccess System.Reflection.Emit.AssemblyBuilderAccess.ReflectionOnly' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.AssemblyBuilderAccess System.Reflection.Emit.AssemblyBuilderAccess.RunAndSave' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.AssemblyBuilderAccess System.Reflection.Emit.AssemblyBuilderAccess.Save' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ConstructorBuilder.AddDeclarativeSecurity(System.Security.Permissions.SecurityAction, System.Security.PermissionSet)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ConstructorBuilder.GetModule()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ConstructorBuilder.GetToken()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ConstructorBuilder.ReturnType.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ConstructorBuilder.SetMethodBody(System.Byte[], System.Int32, System.Byte[], System.Collections.Generic.IEnumerable, System.Collections.Generic.IEnumerable)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ConstructorBuilder.SetSymCustomAttribute(System.String, System.Byte[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ConstructorBuilder.Signature.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.EnumBuilder.CreateType()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.EnumBuilder.TypeToken.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.EventBuilder.GetEventToken()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.FieldBuilder.GetToken()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.FieldBuilder.SetMarshal(System.Reflection.Emit.UnmanagedMarshal)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ILGenerator.EmitCalli(System.Reflection.Emit.OpCode, System.Runtime.InteropServices.CallingConvention, System.Type, System.Type[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ILGenerator.MarkSequencePoint(System.Diagnostics.SymbolStore.ISymbolDocumentWriter, System.Int32, System.Int32, System.Int32, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.MethodBuilder.AddDeclarativeSecurity(System.Security.Permissions.SecurityAction, System.Security.PermissionSet)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.MethodBuilder.CreateMethodBody(System.Byte[], System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.MethodBuilder.GetModule()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.MethodBuilder.GetToken()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.MethodBuilder.SetMarshal(System.Reflection.Emit.UnmanagedMarshal)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.MethodBuilder.SetMethodBody(System.Byte[], System.Int32, System.Byte[], System.Collections.Generic.IEnumerable, System.Collections.Generic.IEnumerable)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.MethodBuilder.SetSymCustomAttribute(System.String, System.Byte[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.MethodBuilder.Signature.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ModuleBuilder.DefineDocument(System.String, System.Guid, System.Guid, System.Guid)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ModuleBuilder.DefineManifestResource(System.String, System.IO.Stream, System.Reflection.ResourceAttributes)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ModuleBuilder.DefinePInvokeMethod(System.String, System.String, System.Reflection.MethodAttributes, System.Reflection.CallingConventions, System.Type, System.Type[], System.Runtime.InteropServices.CallingConvention, System.Runtime.InteropServices.CharSet)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ModuleBuilder.DefinePInvokeMethod(System.String, System.String, System.String, System.Reflection.MethodAttributes, System.Reflection.CallingConventions, System.Type, System.Type[], System.Runtime.InteropServices.CallingConvention, System.Runtime.InteropServices.CharSet)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ModuleBuilder.DefineResource(System.String, System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ModuleBuilder.DefineResource(System.String, System.String, System.Reflection.ResourceAttributes)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ModuleBuilder.DefineUnmanagedResource(System.Byte[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ModuleBuilder.DefineUnmanagedResource(System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ModuleBuilder.GetArrayMethodToken(System.Type, System.String, System.Reflection.CallingConventions, System.Type, System.Type[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ModuleBuilder.GetConstructorToken(System.Reflection.ConstructorInfo)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ModuleBuilder.GetConstructorToken(System.Reflection.ConstructorInfo, System.Collections.Generic.IEnumerable)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ModuleBuilder.GetFieldToken(System.Reflection.FieldInfo)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ModuleBuilder.GetMethodToken(System.Reflection.MethodInfo)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ModuleBuilder.GetMethodToken(System.Reflection.MethodInfo, System.Collections.Generic.IEnumerable)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ModuleBuilder.GetSignatureToken(System.Byte[], System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ModuleBuilder.GetSignatureToken(System.Reflection.Emit.SignatureHelper)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ModuleBuilder.GetSignerCertificate()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ModuleBuilder.GetStringConstant(System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ModuleBuilder.GetSymWriter()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ModuleBuilder.GetTypeToken(System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ModuleBuilder.GetTypeToken(System.Type)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ModuleBuilder.IsTransient()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ModuleBuilder.SetSymCustomAttribute(System.String, System.Byte[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ModuleBuilder.SetUserEntryPoint(System.Reflection.MethodInfo)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ParameterBuilder.GetToken()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.ParameterBuilder.SetMarshal(System.Reflection.Emit.UnmanagedMarshal)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.PropertyBuilder.PropertyToken.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.SignatureHelper.GetMethodSigHelper(System.Reflection.Module, System.Runtime.InteropServices.CallingConvention, System.Type)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.SignatureHelper.GetMethodSigHelper(System.Runtime.InteropServices.CallingConvention, System.Type)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.TypeBuilder.AddDeclarativeSecurity(System.Security.Permissions.SecurityAction, System.Security.PermissionSet)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.TypeBuilder.DefinePInvokeMethod(System.String, System.String, System.Reflection.MethodAttributes, System.Reflection.CallingConventions, System.Type, System.Type[], System.Runtime.InteropServices.CallingConvention, System.Runtime.InteropServices.CharSet)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.TypeBuilder.DefinePInvokeMethod(System.String, System.String, System.String, System.Reflection.MethodAttributes, System.Reflection.CallingConventions, System.Type, System.Type[], System.Runtime.InteropServices.CallingConvention, System.Runtime.InteropServices.CharSet)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.TypeBuilder.DefinePInvokeMethod(System.String, System.String, System.String, System.Reflection.MethodAttributes, System.Reflection.CallingConventions, System.Type, System.Type[], System.Type[], System.Type[], System.Type[][], System.Type[][], System.Runtime.InteropServices.CallingConvention, System.Runtime.InteropServices.CharSet)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Emit.TypeBuilder.TypeToken.get()' does not exist in the implementation but it does exist in the contract. - -// Consciously are not bringing to core -TypesMustExist : Type 'System.Security.Cryptography.CryptoAPITransform' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Cryptography.HMACRIPEMD160' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Cryptography.MACTripleDES' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Cryptography.RijndaelManagedTransform' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Cryptography.RIPEMD160' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Cryptography.RIPEMD160Managed' does not exist in the implementation but it does exist in the contract. - -// Too coupled to ACLs -TypesMustExist : Type 'System.Security.AccessControl.CryptoKeyAccessRule' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.AccessControl.CryptoKeyAuditRule' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.AccessControl.CryptoKeyRights' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.AccessControl.CryptoKeySecurity' does not exist in the implementation but it does exist in the contract. - -// Interfaces were intentional removals -CannotRemoveBaseTypeOrInterface : Type 'System.Windows.Markup.ValueSerializerAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.DirectoryServices.DirectoryServicesCOMException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ServiceProcess.ServiceControllerPermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ServiceProcess.ServiceProcessDescriptionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'Microsoft.SqlServer.Server.SqlMethodAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'Microsoft.SqlServer.Server.SqlUserDefinedAggregateAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'Microsoft.SqlServer.Server.SqlUserDefinedTypeAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Configuration.RegexStringValidatorAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Text.RegularExpressions.RegexMatchTimeoutException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'Microsoft.SqlServer.Server.InvalidUdtException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'Microsoft.SqlServer.Server.SqlFunctionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ServiceProcess.TimeoutException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Net.NetworkInformation.PingException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.AccessViolationException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Activator' does not implement interface 'System.Runtime.InteropServices._Activator' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.AggregateException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.AppDomain' does not implement interface 'System._AppDomain' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.DataMisalignedException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.DivideByZeroException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.DllNotFoundException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.DuplicateWaitObjectException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.EntryPointNotFoundException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Exception' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ExecutionEngineException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.FieldAccessException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.FlagsAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.FormatException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.AppDomainUnloadedException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ApplicationException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ArgumentException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ArgumentNullException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ArgumentOutOfRangeException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ArithmeticException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ArrayTypeMismatchException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Attribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.AttributeUsageAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.BadImageFormatException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.CannotUnloadAppDomainException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.CLSCompliantAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ContextMarshalException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ContextStaticAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.IndexOutOfRangeException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.InsufficientExecutionStackException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.InsufficientMemoryException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.InvalidCastException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.InvalidOperationException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.InvalidProgramException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.InvalidTimeZoneException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.LoaderOptimizationAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.MemberAccessException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.MethodAccessException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.MissingFieldException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.MissingMemberException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.MissingMethodException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.MTAThreadAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.MulticastNotSupportedException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.NonSerializedAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.NotFiniteNumberException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.NotImplementedException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.NotSupportedException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.NullReferenceException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ObjectDisposedException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ObsoleteAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.OperationCanceledException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.OutOfMemoryException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.OverflowException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ParamArrayAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.PlatformNotSupportedException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.RankException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.SerializableAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.StackOverflowException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.STAThreadAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.SystemException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ThreadStaticAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.TimeoutException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.TimeZoneNotFoundException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Type' does not implement interface 'System.Runtime.InteropServices._Type' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.TypeAccessException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.TypeInitializationException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.TypeLoadException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.TypeUnloadedException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.UnauthorizedAccessException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Collections.Generic.KeyNotFoundException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.ConditionalAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.DebuggableAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.DebuggerBrowsableAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.DebuggerDisplayAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.DebuggerHiddenAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.DebuggerNonUserCodeAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.DebuggerStepperBoundaryAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.DebuggerStepThroughAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.DebuggerTypeProxyAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.DebuggerVisualizerAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.CodeAnalysis.SuppressMessageAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.Contracts.ContractAbbreviatorAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.Contracts.ContractArgumentValidatorAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.Contracts.ContractClassAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.Contracts.ContractClassForAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.Contracts.ContractInvariantMethodAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.Contracts.ContractOptionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.Contracts.ContractPublicPropertyNameAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.Contracts.ContractReferenceAssemblyAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.Contracts.ContractRuntimeIgnoredAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.Contracts.ContractVerificationAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.Contracts.PureAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.Tracing.EventAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.Tracing.EventDataAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.Tracing.EventFieldAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.Tracing.EventIgnoreAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.Tracing.EventSourceAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.Tracing.EventSourceException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.Tracing.NonEventAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Globalization.CultureNotFoundException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.IO.DirectoryNotFoundException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.IO.DriveNotFoundException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.IO.EndOfStreamException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.IO.FileLoadException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.IO.FileNotFoundException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.IO.IOException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.IO.PathTooLongException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.IO.IsolatedStorage.IsolatedStorageException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.AmbiguousMatchException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.Assembly' does not implement interface 'System.Runtime.InteropServices._Assembly' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.AssemblyAlgorithmIdAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.AssemblyCompanyAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.AssemblyConfigurationAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.AssemblyCopyrightAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.AssemblyCultureAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.AssemblyDefaultAliasAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.AssemblyDelaySignAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.AssemblyDescriptionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.AssemblyFileVersionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.AssemblyFlagsAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.AssemblyInformationalVersionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.AssemblyKeyFileAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.AssemblyKeyNameAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.AssemblyMetadataAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.AssemblyName' does not implement interface 'System.Runtime.InteropServices._AssemblyName' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.AssemblyProductAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.AssemblySignatureKeyAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.AssemblyTitleAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.AssemblyTrademarkAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.AssemblyVersionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.ConstructorInfo' does not implement interface 'System.Runtime.InteropServices._ConstructorInfo' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.CustomAttributeFormatException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.DefaultMemberAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.EventInfo' does not implement interface 'System.Runtime.InteropServices._EventInfo' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.FieldInfo' does not implement interface 'System.Runtime.InteropServices._FieldInfo' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.InvalidFilterCriteriaException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.MemberInfo' does not implement interface 'System.Runtime.InteropServices._MemberInfo' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.MethodBase' does not implement interface 'System.Runtime.InteropServices._MethodBase' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.MethodInfo' does not implement interface 'System.Runtime.InteropServices._MethodInfo' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.Module' does not implement interface 'System.Runtime.InteropServices._Module' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.ObfuscateAssemblyAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.ObfuscationAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.ParameterInfo' does not implement interface 'System.Runtime.InteropServices._ParameterInfo' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.PropertyInfo' does not implement interface 'System.Runtime.InteropServices._PropertyInfo' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.ReflectionTypeLoadException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.TargetException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.TargetInvocationException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.TargetParameterCountException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.TypeDelegator' does not implement interface 'System.Runtime.InteropServices._Type' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.TypeInfo' does not implement interface 'System.Runtime.InteropServices._Type' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.Emit.AssemblyBuilder' does not implement interface 'System.Runtime.InteropServices._AssemblyBuilder' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.Emit.ConstructorBuilder' does not implement interface 'System.Runtime.InteropServices._ConstructorBuilder' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.Emit.CustomAttributeBuilder' does not implement interface 'System.Runtime.InteropServices._CustomAttributeBuilder' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.Emit.DynamicMethod' does not implement interface 'System.Runtime.InteropServices._MethodInfo' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.Emit.EventBuilder' does not implement interface 'System.Runtime.InteropServices._EventBuilder' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.Emit.FieldBuilder' does not implement interface 'System.Runtime.InteropServices._FieldBuilder' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.Emit.ILGenerator' does not implement interface 'System.Runtime.InteropServices._ILGenerator' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.Emit.LocalBuilder' does not implement interface 'System.Runtime.InteropServices._LocalBuilder' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.Emit.MethodBuilder' does not implement interface 'System.Runtime.InteropServices._MethodBuilder' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.Emit.ModuleBuilder' does not implement interface 'System.Runtime.InteropServices._ModuleBuilder' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.Emit.ParameterBuilder' does not implement interface 'System.Runtime.InteropServices._ParameterBuilder' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.Emit.PropertyBuilder' does not implement interface 'System.Runtime.InteropServices._PropertyBuilder' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.Emit.SignatureHelper' does not implement interface 'System.Runtime.InteropServices._SignatureHelper' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Resources.MissingManifestResourceException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Resources.MissingSatelliteAssemblyException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Resources.NeutralResourcesLanguageAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Resources.SatelliteContractVersionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.AssemblyTargetedPatchBandAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.TargetedPatchingOptOutAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.AccessedThroughPropertyAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.AsyncStateMachineAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.CallerFilePathAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.CallerLineNumberAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.CallerMemberNameAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.CompilationRelaxationsAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.CompilerGeneratedAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.CompilerGlobalScopeAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.CustomConstantAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.DateTimeConstantAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.DecimalConstantAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.DefaultDependencyAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.DependencyAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.DisablePrivateReflectionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.DiscardableAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.ExtensionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.FixedAddressValueTypeAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.FixedBufferAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.HasCopySemanticsAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.IndexerNameAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.InternalsVisibleToAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.IteratorStateMachineAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.IUnknownConstantAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.MethodImplAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.NativeCppClassAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.ReferenceAssemblyAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.RequiredAttributeAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.RuntimeCompatibilityAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.RuntimeWrappedException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.ScopelessEnumAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.SpecialNameAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.StateMachineAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.StringFreezingAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.SuppressIldasmAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.TypeForwardedFromAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.TypeForwardedToAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.UnsafeValueTypeAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.ConstrainedExecution.PrePrepareMethodAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.ConstrainedExecution.ReliabilityContractAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.ExceptionServices.HandleProcessCorruptedStateExceptionsAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.AllowReversePInvokeCallsAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.AutomationProxyAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.BestFitMappingAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.ClassInterfaceAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.CoClassAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.ComAliasNameAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.ComCompatibleVersionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.ComConversionLossAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.ComDefaultInterfaceAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.ComEventInterfaceAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.COMException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.ComImportAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.ComRegisterFunctionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.ComSourceInterfacesAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.ComUnregisterFunctionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.ComVisibleAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.DefaultCharSetAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.DispIdAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.DllImportAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.ExternalException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.FieldOffsetAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.GuidAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.InAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.InterfaceTypeAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.InvalidComObjectException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.InvalidOleVariantTypeException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.LCIDConversionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.ManagedToNativeComInteropStubAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.MarshalAsAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.MarshalDirectiveException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.OptionalAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.OutAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.PreserveSigAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.PrimaryInteropAssemblyAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.ProgIdAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.SafeArrayRankMismatchException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.SafeArrayTypeMismatchException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.SEHException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.StructLayoutAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.TypeIdentifierAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.WindowsRuntime.DefaultInterfaceAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.WindowsRuntime.InterfaceImplementedInVersionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.WindowsRuntime.ReadOnlyArrayAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.WindowsRuntime.ReturnValueNameAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.WindowsRuntime.WriteOnlyArrayAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.Serialization.OnDeserializedAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.Serialization.OnDeserializingAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.Serialization.OnSerializedAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.Serialization.OnSerializingAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.Serialization.OptionalFieldAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.Serialization.SerializationException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.Serialization.Formatters.Binary.BinaryFormatter' does not implement interface 'System.Runtime.Remoting.Messaging.IRemotingFormatter' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.Versioning.ComponentGuaranteesAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.Versioning.ResourceConsumptionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.Versioning.ResourceExposureAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.Versioning.TargetFrameworkAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.AllowPartiallyTrustedCallersAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.HostProtectionException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.SecurityCriticalAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.SecurityException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.SecurityRulesAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.SecuritySafeCriticalAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.SecurityTransparentAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.SecurityTreatAsSafeAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.SuppressUnmanagedCodeSecurityAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.UnverifiableCodeAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.VerificationException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.XmlSyntaxException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.AccessControl.PrivilegeNotHeldException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.Cryptography.CryptographicException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.Cryptography.CryptographicUnexpectedOperationException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.Permissions.CodeAccessSecurityAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.Permissions.EnvironmentPermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.Permissions.FileDialogPermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.Permissions.FileIOPermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.Permissions.GacIdentityPermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.Permissions.HostProtectionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.Permissions.IsolatedStorageFilePermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.Permissions.IsolatedStoragePermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.Permissions.KeyContainerPermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.Permissions.PermissionSetAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.Permissions.PrincipalPermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.Permissions.PublisherIdentityPermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.Permissions.ReflectionPermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.Permissions.RegistryPermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.Permissions.SecurityAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.Permissions.SecurityPermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.Permissions.SiteIdentityPermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.Permissions.StrongNameIdentityPermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.Permissions.UIPermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.Permissions.UrlIdentityPermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.Permissions.ZoneIdentityPermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.Policy.PolicyException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.Principal.IdentityNotMappedException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Text.DecoderFallbackException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Text.EncoderFallbackException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Threading.AbandonedMutexException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Threading.LockRecursionException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Threading.SemaphoreFullException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Threading.SynchronizationLockException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Threading.Thread' does not implement interface 'System.Runtime.InteropServices._Thread' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Threading.ThreadAbortException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Threading.ThreadInterruptedException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Threading.ThreadStartException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Threading.ThreadStateException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Threading.WaitHandleCannotBeOpenedException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Threading.Tasks.TaskCanceledException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Threading.Tasks.TaskSchedulerException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.UriFormatException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.CodeDom.Compiler.GeneratedCodeAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.AmbientValueAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.AttributeProviderAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.BindableAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.BrowsableAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.CategoryAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.ComplexBindingPropertiesAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataObjectAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataObjectFieldAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataObjectMethodAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DefaultBindingPropertyAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DefaultEventAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DefaultPropertyAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DefaultValueAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DescriptionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DesignerAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DesignerCategoryAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DesignerSerializationVisibilityAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DesignOnlyAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DesignTimeVisibleAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DisplayNameAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.EditorAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.EditorBrowsableAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.ExtenderProvidedPropertyAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.ImmutableObjectAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.InheritanceAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.InitializationEventAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.InstallerTypeAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.InvalidAsynchronousStateException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.InvalidEnumArgumentException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.LicenseException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.LicenseProviderAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.ListBindableAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.LocalizableAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.LookupBindingPropertiesAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.MergablePropertyAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.NotifyParentPropertyAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.ParenthesizePropertyNameAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.PasswordPropertyTextAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.PropertyTabAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.ProvidePropertyAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.ReadOnlyAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.RecommendedAsConfigurableAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.RefreshPropertiesAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.RunInstallerAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.SettingsBindableAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.ToolboxItemAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.ToolboxItemFilterAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.TypeConverterAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.TypeDescriptionProviderAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.WarningException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.Win32Exception' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.Design.CheckoutException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.Design.HelpKeywordAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.Design.Serialization.DefaultSerializationProviderAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.Design.Serialization.DesignerSerializerAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.Design.Serialization.RootDesignerSerializerAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Configuration.ApplicationScopedSettingAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Configuration.ConfigurationException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Configuration.DefaultSettingValueAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Configuration.NoSettingsVersionUpgradeAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Configuration.SettingAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Configuration.SettingsDescriptionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Configuration.SettingsGroupDescriptionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Configuration.SettingsGroupNameAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Configuration.SettingsManageabilityAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Configuration.SettingsPropertyIsReadOnlyException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Configuration.SettingsPropertyNotFoundException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Configuration.SettingsPropertyWrongTypeException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Configuration.SettingsProviderAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Configuration.SettingsSerializeAsAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Configuration.SpecialSettingAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Configuration.UserScopedSettingAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.MonitoringDescriptionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.SwitchAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.SwitchLevelAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.IO.InternalBufferOverflowException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.IO.InvalidDataException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Net.CookieException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Net.HttpListenerException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Net.ProtocolViolationException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Net.WebException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Net.Mail.SmtpException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Net.Mail.SmtpFailedRecipientException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Net.Mail.SmtpFailedRecipientsException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Net.NetworkInformation.NetworkInformationException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Net.Sockets.SocketException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Net.WebSockets.WebSocketException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.DefaultParameterValueAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.Authentication.AuthenticationException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.Authentication.InvalidCredentialException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.Permissions.StorePermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.Permissions.TypeDescriptorPermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Threading.BarrierPostPhaseException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Threading.SemaphoreFullException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Timers.TimersDescriptionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.AssociationAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.CompareAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.ConcurrencyCheckAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.CreditCardAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.CustomValidationAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.DataTypeAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.DisplayAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.DisplayColumnAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.DisplayFormatAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.EditableAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.EmailAddressAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.EnumDataTypeAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.FileExtensionsAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.FilterUIHintAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.KeyAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.MaxLengthAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.MinLengthAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.PhoneAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.RangeAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.RegularExpressionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.RequiredAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.ScaffoldColumnAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.StringLengthAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.TimestampAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.UIHintAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.UrlAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.ValidationAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.ValidationException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.Schema.ColumnAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.Schema.ComplexTypeAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.Schema.ForeignKeyAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.Schema.InversePropertyAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.Schema.NotMappedAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.ComponentModel.DataAnnotations.Schema.TableAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.InvalidTimeZoneException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.TimeZoneNotFoundException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.DynamicAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.ExtensionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.ComAwareEventInfo' does not implement interface 'System.Runtime.InteropServices._EventInfo' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Threading.LockRecursionException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Data.ConstraintException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Data.DataException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Data.DataSysDescriptionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Data.DBConcurrencyException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Data.DeletedRowInaccessibleException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Data.DuplicateNameException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Data.EvaluateException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Data.InRowChangingEventException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Data.InvalidConstraintException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Data.InvalidExpressionException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Data.MissingPrimaryKeyException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Data.NoNullAllowedException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Data.OperationAbortedException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Data.ReadOnlyException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Data.RowNotInTableException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Data.StrongTypingException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Data.SyntaxErrorException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Data.VersionNotFoundException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Data.Common.DbException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Data.Common.DbProviderSpecificTypePropertyAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Data.Common.DBDataPermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Data.Odbc.OdbcException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Data.SqlClient.SqlException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Data.SqlTypes.SqlAlreadyFilledException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Data.SqlTypes.SqlNotFilledException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Data.SqlTypes.SqlNullValueException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Data.SqlTypes.SqlTruncateException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Data.SqlTypes.SqlTypeException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Net.CookieException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Net.WebException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Net.Sockets.SocketException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.Serialization.CollectionDataContractAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.Serialization.ContractNamespaceAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.Serialization.DataContractAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.Serialization.DataMemberAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.Serialization.EnumMemberAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.Serialization.IgnoreDataMemberAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.Serialization.InvalidDataContractException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.Serialization.KnownTypeAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Transactions.TransactionAbortedException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Transactions.TransactionException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Transactions.TransactionInDoubtException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Transactions.TransactionManagerCommunicationException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Transactions.TransactionPromotionException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.XmlException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Schema.XmlSchemaException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Schema.XmlSchemaInferenceException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Schema.XmlSchemaValidationException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.SoapAttributeAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.SoapElementAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.SoapEnumAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.SoapIgnoreAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.SoapIncludeAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.SoapTypeAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlAnyAttributeAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlAnyElementAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlArrayAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlArrayItemAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlAttributeAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlChoiceIdentifierAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlElementAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlEnumAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlIgnoreAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlIncludeAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlNamespaceDeclarationsAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlRootAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlSchemaProviderAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlSerializerAssemblyAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlSerializerVersionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlTextAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlTypeAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.XPath.XPathException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Xsl.XsltCompileException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Xsl.XsltException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlAnyAttributeAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlAnyElementAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlArrayAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlArrayItemAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlAttributeAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlChoiceIdentifierAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlElementAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlEnumAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlIgnoreAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlIncludeAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlNamespaceDeclarationsAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlRootAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlSchemaProviderAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlTextAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlTypeAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.ImportedFromTypeLibAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.TypeLibFuncAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.TypeLibImportClassAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.TypeLibTypeAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.TypeLibVarAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.TypeLibVersionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.PerformanceCounterPermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.EventLogPermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Net.DnsPermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Net.SocketPermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Net.WebPermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Net.Mail.SmtpPermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Net.NetworkInformation.NetworkInformationPermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Data.Odbc.OdbcPermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Drawing.Printing.PrintingPermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Net.PeerToPeer.PnrpPermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Net.PeerToPeer.Collaboration.PeerCollaborationPermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Transactions.DistributedTransactionPermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Data.SqlClient.SqlClientPermissionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Configuration.CallbackValidatorAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Configuration.ConfigurationCollectionAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Configuration.ConfigurationErrorsException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Configuration.ConfigurationPropertyAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Configuration.ConfigurationValidatorAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Configuration.IntegerValidatorAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Configuration.LongValidatorAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Configuration.PositiveTimeSpanValidatorAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Configuration.StringValidatorAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Configuration.SubclassTypeValidatorAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Configuration.TimeSpanValidatorAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Configuration.Provider.ProviderException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Drawing.BitmapSuffixInSameAssemblyAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Drawing.BitmapSuffixInSatelliteAssemblyAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Drawing.ToolboxBitmapAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Drawing.Printing.InvalidPrinterException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.IO.FileFormatException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.DirectoryServices.ActiveDirectory.ActiveDirectoryObjectExistsException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.DirectoryServices.ActiveDirectory.ActiveDirectoryObjectNotFoundException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.DirectoryServices.ActiveDirectory.ActiveDirectoryOperationException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.DirectoryServices.ActiveDirectory.ActiveDirectoryServerDownException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.DirectoryServices.ActiveDirectory.ForestTrustCollisionException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.DirectoryServices.ActiveDirectory.SyncFromAllServersOperationException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.DirectoryServices.AccountManagement.DirectoryObjectClassAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.DirectoryServices.AccountManagement.DirectoryPropertyAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.DirectoryServices.AccountManagement.DirectoryRdnPrefixAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.DirectoryServices.AccountManagement.MultipleMatchesException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.DirectoryServices.AccountManagement.NoMatchingPrincipalException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.DirectoryServices.AccountManagement.PasswordException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.DirectoryServices.AccountManagement.PrincipalException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.DirectoryServices.AccountManagement.PrincipalExistsException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.DirectoryServices.AccountManagement.PrincipalOperationException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.DirectoryServices.AccountManagement.PrincipalServerDownException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.DirectoryServices.Protocols.BerConversionException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.DirectoryServices.Protocols.DirectoryException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.DirectoryServices.Protocols.DirectoryOperationException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.DirectoryServices.Protocols.LdapException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.DirectoryServices.Protocols.TlsOperationException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract. - - - -// Types we currently don't plan to port: -TypesMustExist : Type 'System._AppDomain' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ActivationContext' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.AppDomainInitializer' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.AppDomainManager' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.AppDomainManagerInitializationOptions' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.AppDomainSetup' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.CrossAppDomainDelegate' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.IAppDomainSetup' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Deployment.Internal.InternalActivationContextHelper' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Deployment.Internal.InternalApplicationIdentityHelper' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Contracts.Internal.ContractHelper' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.DesignerServices.WindowsRuntimeDesignerContext' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Hosting.ActivationArguments' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Hosting.ApplicationActivator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices._Activator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices._Assembly' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices._AssemblyBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices._AssemblyName' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices._Attribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices._ConstructorBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices._ConstructorInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices._CustomAttributeBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices._EnumBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices._EventBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices._EventInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices._Exception' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices._FieldBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices._FieldInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices._ILGenerator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices._LocalBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices._MemberInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices._MethodBase' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices._MethodBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices._MethodInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices._MethodRental' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices._Module' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices._ModuleBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices._ParameterBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices._ParameterInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices._PropertyBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices._PropertyInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices._SignatureHelper' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices._Thread' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices._Type' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices._TypeBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.AssemblyRegistrationFlags' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.BIND_OPTS' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.BINDPTR' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.CALLCONV' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.CONNECTDATA' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.DESCKIND' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.DISPPARAMS' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.ELEMDESC' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.EXCEPINFO' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.ExporterEventKind' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.ExtensibleClassFactory' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.FILETIME' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.FUNCDESC' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.FUNCFLAGS' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.FUNCKIND' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.IDispatchImplAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.IDispatchImplType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.IDLDESC' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.IDLFLAG' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.IMPLTYPEFLAGS' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.ImporterEventKind' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.INVOKEKIND' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.IRegistrationServices' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.ITypeLibConverter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.ITypeLibExporterNameProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.ITypeLibExporterNotifySink' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.ITypeLibImporterNotifySink' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.LIBFLAGS' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.ObjectCreationDelegate' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.PARAMDESC' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.PARAMFLAG' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.RegistrationClassContext' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.RegistrationConnectionType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.RegistrationServices' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.SetWin32ContextInIDispatchAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.STATSTG' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.SYSKIND' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.TYPEATTR' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.TYPEDESC' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.TYPEFLAGS' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.TYPEKIND' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.TYPELIBATTR' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.TypeLibConverter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.TypeLibExporterFlags' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.TypeLibImporterFlags' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.UCOMIBindCtx' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.UCOMIConnectionPoint' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.UCOMIConnectionPointContainer' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.UCOMIEnumConnectionPoints' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.UCOMIEnumConnections' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.UCOMIEnumMoniker' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.UCOMIEnumString' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.UCOMIEnumVARIANT' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.UCOMIMoniker' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.UCOMIPersistFile' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.UCOMIRunningObjectTable' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.UCOMIStream' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.UCOMITypeComp' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.UCOMITypeInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.UCOMITypeLib' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.VARDESC' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.VARFLAGS' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.Expando.IExpando' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.WindowsRuntime.DesignerNamespaceResolveEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.WindowsRuntime.NamespaceResolveEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.WindowsRuntime.WindowsRuntimeMetadata' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.ActivatedClientTypeEntry' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.ActivatedServiceTypeEntry' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.CustomErrorsModes' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.IChannelInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.IEnvoyInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.InternalRemotingServices' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.IObjectHandle' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.IRemotingTypeInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.ObjectHandle' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.ObjRef' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.RemotingConfiguration' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.RemotingException' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.RemotingServices' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.RemotingTimeoutException' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.ServerException' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.SoapServices' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.TypeEntry' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.WellKnownClientTypeEntry' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.WellKnownObjectMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.WellKnownServiceTypeEntry' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Activation.ActivatorLevel' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Activation.IActivator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Activation.IConstructionCallMessage' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Activation.IConstructionReturnMessage' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Activation.UrlAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Channels.BaseChannelObjectWithProperties' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Channels.BaseChannelSinkWithProperties' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Channels.BaseChannelWithProperties' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Channels.ChannelDataStore' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Channels.ChannelServices' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Channels.ClientChannelSinkStack' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Channels.IChannel' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Channels.IChannelDataStore' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Channels.IChannelReceiver' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Channels.IChannelReceiverHook' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Channels.IChannelSender' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Channels.IChannelSinkBase' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Channels.IClientChannelSink' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Channels.IClientChannelSinkProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Channels.IClientChannelSinkStack' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Channels.IClientFormatterSink' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Channels.IClientFormatterSinkProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Channels.IClientResponseChannelSinkStack' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Channels.ISecurableChannel' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Channels.IServerChannelSink' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Channels.IServerChannelSinkProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Channels.IServerChannelSinkStack' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Channels.IServerFormatterSinkProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Channels.IServerResponseChannelSinkStack' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Channels.ITransportHeaders' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Channels.ServerChannelSinkStack' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Channels.ServerProcessing' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Channels.SinkProviderData' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Channels.TransportHeaders' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Contexts.Context' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Contexts.ContextAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Contexts.ContextProperty' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Contexts.CrossContextDelegate' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Contexts.IContextAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Contexts.IContextProperty' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Contexts.IContextPropertyActivator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Contexts.IContributeClientContextSink' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Contexts.IContributeDynamicSink' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Contexts.IContributeEnvoySink' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Contexts.IContributeObjectSink' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Contexts.IContributeServerContextSink' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Contexts.IDynamicMessageSink' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Contexts.IDynamicProperty' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Contexts.SynchronizationAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Lifetime.ClientSponsor' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Lifetime.ILease' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Lifetime.ISponsor' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Lifetime.LeaseState' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Lifetime.LifetimeServices' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Messaging.AsyncResult' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Messaging.CallContext' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Messaging.ConstructionCall' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Messaging.ConstructionResponse' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Messaging.Header' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Messaging.HeaderHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Messaging.ILogicalThreadAffinative' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Messaging.IMessage' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Messaging.IMessageCtrl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Messaging.IMessageSink' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Messaging.IMethodCallMessage' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Messaging.IMethodMessage' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Messaging.IMethodReturnMessage' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Messaging.InternalMessageWrapper' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Messaging.LogicalCallContext' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Messaging.MessageSurrogateFilter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Messaging.MethodCall' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Messaging.MethodCallMessageWrapper' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Messaging.MethodResponse' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Messaging.MethodReturnMessageWrapper' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Messaging.OneWayAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Messaging.RemotingSurrogateSelector' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Messaging.ReturnMessage' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.SoapAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.SoapFieldAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.SoapMethodAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.SoapOption' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.SoapParameterAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.SoapTypeAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.XmlFieldOrderOption' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.W3cXsd2001.ISoapXsd' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapAnyUri' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapBase64Binary' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDate' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDateTime' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDay' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDuration' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapEntities' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapEntity' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapHexBinary' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapId' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapIdref' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapIdrefs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapInteger' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapLanguage' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonth' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonthDay' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapName' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNcName' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNegativeInteger' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNmtoken' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNmtokens' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonNegativeInteger' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonPositiveInteger' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNormalizedString' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNotation' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapPositiveInteger' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapQName' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapTime' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapToken' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYear' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYearMonth' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Proxies.ProxyAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Proxies.RealProxy' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Services.EnterpriseServicesHelper' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Services.ITrackingHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Remoting.Services.TrackingServices' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.ReadOnlyPermissionSet' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'Microsoft.Win32.IntranetZoneCredentialPolicy' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Media.SoundPlayer' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Media.SystemSound' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Media.SystemSounds' does not exist in the implementation but it does exist in the contract. -Compat issues with assembly System.Web: -TypesMustExist : Type 'System.Web.ApplicationShutdownReason' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.BeginEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.DefaultHttpHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.EndEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.EventHandlerTaskAsyncHelper' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HtmlString' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpApplication' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpApplicationState' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpApplicationStateBase' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpApplicationStateWrapper' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpBrowserCapabilities' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpBrowserCapabilitiesBase' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpBrowserCapabilitiesWrapper' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpCacheability' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpCachePolicy' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpCachePolicyBase' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpCachePolicyWrapper' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpCacheRevalidation' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpCacheValidateHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpCacheVaryByContentEncodings' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpCacheVaryByHeaders' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpCacheVaryByParams' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpClientCertificate' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpCompileException' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpContext' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpContextBase' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpContextWrapper' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpCookie' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpCookieCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpCookieMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpException' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpFileCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpFileCollectionBase' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpFileCollectionWrapper' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpModuleCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpParseException' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpPostedFile' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpPostedFileBase' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpPostedFileWrapper' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpRequest' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpRequestBase' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpRequestValidationException' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpRequestWrapper' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpResponse' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpResponseBase' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpResponseSubstitutionCallback' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpResponseWrapper' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpRuntime' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpServerUtility' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpServerUtilityBase' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpServerUtilityWrapper' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpSessionStateBase' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpSessionStateWrapper' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpStaticObjectsCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpStaticObjectsCollectionBase' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpStaticObjectsCollectionWrapper' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpTaskAsyncHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpUnhandledException' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpValidationStatus' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpWorkerRequest' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.HttpWriter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.IHtmlString' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.IHttpAsyncHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.IHttpHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.IHttpHandlerFactory' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.IHttpModule' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.IisTraceListener' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.IPartitionResolver' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ISubscriptionToken' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ITlsTokenBindingInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.MimeMapping' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ParserError' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ParserErrorCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.PreApplicationStartMethodAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ProcessInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ProcessModelInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ProcessShutdownReason' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ProcessStatus' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ReadEntityBodyMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.RequestNotification' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.RequestNotificationStatus' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.SiteMap' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.SiteMapNode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.SiteMapNodeCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.SiteMapProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.SiteMapProviderCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.SiteMapResolveEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.SiteMapResolveEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.StaticSiteMapProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.TaskEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.TraceContext' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.TraceContextEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.TraceContextEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.TraceContextRecord' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.TraceMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UnvalidatedRequestValues' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UnvalidatedRequestValuesBase' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UnvalidatedRequestValuesWrapper' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.VirtualPathUtility' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.WebPageTraceListener' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.XmlSiteMapProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Caching.AggregateCacheDependency' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Caching.Cache' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Caching.CacheDependency' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Caching.CacheItemPriority' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Caching.CacheItemRemovedCallback' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Caching.CacheItemRemovedReason' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Caching.CacheItemUpdateCallback' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Caching.CacheItemUpdateReason' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Caching.DatabaseNotEnabledForNotificationException' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Caching.FileResponseElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Caching.HeaderElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Caching.IOutputCacheEntry' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Caching.MemoryResponseElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Caching.OutputCache' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Caching.OutputCacheProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Caching.OutputCacheProviderCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Caching.ResponseElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Caching.SqlCacheDependency' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Caching.SqlCacheDependencyAdmin' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Caching.SubstitutionResponseElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Caching.TableNotEnabledForNotificationException' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.AppSettingsExpressionBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.AssemblyBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.BuildDependencySet' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.BuildManager' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.BuildManagerHostUnloadEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.BuildManagerHostUnloadEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.BuildProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.BuildProviderAppliesTo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.BuildProviderAppliesToAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.BuildProviderResultFlags' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.ClientBuildManager' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.ClientBuildManagerCallback' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.ClientBuildManagerParameter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.CompilerType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.ConnectionStringsExpressionBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.ControlBuilderInterceptor' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.DesignTimeResourceProviderFactoryAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.ExpressionBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.ExpressionBuilderContext' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.ExpressionEditorAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.ExpressionPrefixAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.FolderLevelBuildProviderAppliesTo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.FolderLevelBuildProviderAppliesToAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.IAssemblyPostProcessor' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.IImplicitResourceProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.ImplicitResourceKey' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.IResourceProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.LinePragmaCodeInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.PrecompilationFlags' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.ResourceExpressionBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.ResourceExpressionFields' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.ResourceProviderFactory' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.RouteUrlExpressionBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Compilation.RouteValueExpressionBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.AdapterDictionary' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.AnonymousIdentificationSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.AssemblyCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.AssemblyInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.AsyncPreloadModeFlags' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.AuthenticationMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.AuthenticationSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.AuthorizationRule' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.AuthorizationRuleAction' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.AuthorizationRuleCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.AuthorizationSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.BrowserCapabilitiesCodeGenerator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.BrowserCapabilitiesFactory' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.BrowserCapabilitiesFactoryBase' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.BufferModesCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.BufferModeSettings' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.BuildProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.BuildProviderCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.CacheSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.ClientTarget' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.ClientTargetCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.ClientTargetSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.CodeSubDirectoriesCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.CodeSubDirectory' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.CompilationSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.Compiler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.CompilerCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.CustomError' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.CustomErrorCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.CustomErrorsMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.CustomErrorsRedirectMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.CustomErrorsSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.DeploymentSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.EventMappingSettings' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.EventMappingSettingsCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.ExpressionBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.ExpressionBuilderCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.FcnMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.FolderLevelBuildProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.FolderLevelBuildProviderCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.FormsAuthenticationConfiguration' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.FormsAuthenticationCredentials' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.FormsAuthenticationUser' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.FormsAuthenticationUserCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.FormsAuthPasswordFormat' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.FormsProtectionEnum' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.FullTrustAssembliesSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.FullTrustAssembly' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.FullTrustAssemblyCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.GlobalizationSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.HealthMonitoringSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.HostingEnvironmentSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.HttpCapabilitiesBase' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.HttpCapabilitiesDefaultProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.HttpCapabilitiesProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.HttpCapabilitiesSectionHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.HttpConfigurationContext' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.HttpCookiesSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.HttpHandlerAction' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.HttpHandlerActionCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.HttpHandlersSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.HttpModuleAction' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.HttpModuleActionCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.HttpModulesSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.HttpRuntimeSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.IConfigMapPath' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.IConfigMapPathFactory' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.IdentitySection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.IgnoreDeviceFilterElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.IgnoreDeviceFilterElementCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.IRemoteWebConfigurationHostServer' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.LowerCaseStringConverter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.MachineKeyCompatibilityMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.MachineKeySection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.MachineKeyValidation' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.MachineKeyValidationConverter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.MembershipSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.NamespaceCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.NamespaceInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.OutputCacheProfile' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.OutputCacheProfileCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.OutputCacheSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.OutputCacheSettingsSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.PagesEnableSessionState' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.PagesSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.PartialTrustVisibleAssembliesSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.PartialTrustVisibleAssembly' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.PartialTrustVisibleAssemblyCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.PassportAuthentication' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.ProcessModelComAuthenticationLevel' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.ProcessModelComImpersonationLevel' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.ProcessModelLogLevel' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.ProcessModelSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.ProfileGroupSettings' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.ProfileGroupSettingsCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.ProfileGuidedOptimizationsFlags' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.ProfilePropertySettings' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.ProfilePropertySettingsCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.ProfileSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.ProfileSettings' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.ProfileSettingsCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.ProtocolCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.ProtocolElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.ProtocolsConfigurationHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.ProtocolsSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.ProvidersHelper' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.RegexWorker' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.RemoteWebConfigurationHostServer' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.RoleManagerSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.RootProfilePropertySettingsCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.RuleSettings' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.RuleSettingsCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.SecurityPolicySection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.SerializationMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.SessionPageStateSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.SessionStateSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.SiteMapSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.SqlCacheDependencyDatabase' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.SqlCacheDependencyDatabaseCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.SqlCacheDependencySection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.SystemWebCachingSectionGroup' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.SystemWebSectionGroup' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.TagMapCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.TagMapInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.TagPrefixCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.TagPrefixInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.TicketCompatibilityMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.TraceDisplayMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.TraceSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.TransformerInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.TransformerInfoCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.TrustLevel' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.TrustLevelCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.TrustSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.UrlMapping' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.UrlMappingCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.UrlMappingsSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.UserMapPath' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.VirtualDirectoryMapping' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.VirtualDirectoryMappingCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.WebApplicationLevel' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.WebConfigurationFileMap' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.WebConfigurationManager' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.WebContext' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.WebControlsSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.WebPartsPersonalization' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.WebPartsPersonalizationAuthorization' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.WebPartsSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.XhtmlConformanceMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.XhtmlConformanceSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Configuration.Internal.IInternalConfigWebHost' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Handlers.AssemblyResourceLoader' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Handlers.TraceHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.AppDomainFactory' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.AppDomainInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.AppDomainInfoEnum' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.AppDomainProtocolHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.ApplicationHost' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.ApplicationInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.ApplicationManager' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.AppManagerAppDomainFactory' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.HostingEnvironment' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.HostSecurityPolicyResolver' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.HostSecurityPolicyResults' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.IAdphManager' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.IAppDomainFactory' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.IAppDomainInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.IAppDomainInfoEnum' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.IApplicationHost' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.IApplicationPreloadManager' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.IApplicationPreloadUtil' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.IAppManagerAppDomainFactory' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.IISAPIRuntime' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.IListenerChannelCallback' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.IPphManager' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.IProcessHost' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.IProcessHostFactoryHelper' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.IProcessHostIdleAndHealthCheck' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.IProcessHostPreloadClient' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.IProcessHostSupportFunctions' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.IProcessPingCallback' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.IRegisteredObject' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.ISAPIRuntime' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.IStopListeningRegisteredObject' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.ISuspendibleRegisteredObject' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.ProcessHost' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.ProcessHostFactoryHelper' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.ProcessProtocolHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.SimpleWorkerRequest' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.VirtualDirectory' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.VirtualFile' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.VirtualFileBase' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Hosting.VirtualPathProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Instrumentation.PageExecutionContext' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Instrumentation.PageExecutionListener' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Instrumentation.PageInstrumentationService' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Mail.MailAttachment' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Mail.MailEncoding' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Mail.MailFormat' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Mail.MailMessage' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Mail.MailPriority' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Mail.SmtpMail' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.BufferedWebEventProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.EventLogWebEventProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.EventNotificationType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.IisTraceWebEventProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.IRegiisUtility' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.IWebEventCustomEvaluator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.MailEventNotificationInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.MailWebEventProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.RegiisUtility' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.RuleFiringRecord' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.SessionStateType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.SimpleMailWebEventProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.SqlExecutionException' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.SqlFeatures' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.SqlServices' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.SqlWebEventProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.TemplatedMailWebEventProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.TraceWebEventProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.WebApplicationInformation' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.WebApplicationLifetimeEvent' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.WebAuditEvent' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.WebAuthenticationFailureAuditEvent' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.WebAuthenticationSuccessAuditEvent' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.WebBaseErrorEvent' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.WebBaseEvent' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.WebBaseEventCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.WebErrorEvent' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.WebEventBufferFlushInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.WebEventCodes' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.WebEventFormatter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.WebEventManager' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.WebEventProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.WebFailureAuditEvent' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.WebHeartbeatEvent' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.WebManagementEvent' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.WebProcessInformation' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.WebProcessStatistics' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.WebRequestErrorEvent' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.WebRequestEvent' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.WebRequestInformation' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.WebSuccessAuditEvent' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.WebThreadInformation' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.WebViewStateFailureAuditEvent' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Management.WmiWebEventProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ArrayModelBinder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ArrayModelBinderProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.AssociatedMetadataProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.AssociatedValidatorProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.BinaryDataModelBinderProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.BindingBehavior' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.BindingBehaviorAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.BindNeverAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.BindRequiredAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.CollectionModelBinder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.CollectionModelBinderProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ComplexModel' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ComplexModelBinder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ComplexModelBinderProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ComplexModelResult' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ControlAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ControlValueProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.CookieAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.CookieValueProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.DataAnnotationsModelMetadata' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.DataAnnotationsModelMetadataProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.DataAnnotationsModelValidationFactory' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.DataAnnotationsModelValidator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.DataAnnotationsModelValidator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.DataAnnotationsModelValidatorProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.DataAnnotationsValidatableObjectAdapterFactory' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.DefaultModelBinder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.DictionaryModelBinder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.DictionaryModelBinderProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.DictionaryValueProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.EmptyModelMetadataProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ExtensibleModelBinderAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.FormAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.FormValueProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.GenericModelBinderProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.IMetadataAware' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.IModelBinder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.IModelNameProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.IUnvalidatedValueProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.IUnvalidatedValueProviderSource' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.IValueProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.IValueProviderSource' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.KeyValuePairModelBinder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.KeyValuePairModelBinderProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ModelBinderDictionary' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ModelBinderErrorMessageProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ModelBinderErrorMessageProviders' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ModelBinderProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ModelBinderProviderCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ModelBinderProviderOptionsAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ModelBinderProviders' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ModelBinders' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ModelBindingContext' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ModelBindingExecutionContext' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ModelError' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ModelErrorCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ModelMetadata' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ModelMetadataProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ModelMetadataProviders' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ModelState' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ModelStateDictionary' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ModelValidatedEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ModelValidatingEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ModelValidationNode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ModelValidationResult' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ModelValidator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ModelValidatorProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ModelValidatorProviderCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ModelValidatorProviders' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.MutableObjectModelBinder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.MutableObjectModelBinderProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.NameValueCollectionValueProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ProfileAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ProfileValueProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.QueryStringAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.QueryStringValueProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.RangeAttributeAdapter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.RegularExpressionAttributeAdapter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.RequiredAttributeAdapter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.RouteDataAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.RouteDataValueProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.SessionAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.SimpleModelBinderProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.SimpleValueProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.StringLengthAttributeAdapter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.TypeConverterModelBinder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.TypeConverterModelBinderProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.TypeMatchModelBinder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.TypeMatchModelBinderProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.UserProfileAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.UserProfileValueProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ValidatableObjectAdapter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ValueProviderCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ValueProviderResult' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ValueProviderSourceAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ViewStateAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.ModelBinding.ViewStateValueProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Profile.CustomProviderDataAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Profile.DefaultProfile' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Profile.ProfileAuthenticationOption' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Profile.ProfileAutoSaveEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Profile.ProfileAutoSaveEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Profile.ProfileBase' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Profile.ProfileEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Profile.ProfileEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Profile.ProfileGroupBase' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Profile.ProfileInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Profile.ProfileInfoCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Profile.ProfileManager' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Profile.ProfileMigrateEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Profile.ProfileMigrateEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Profile.ProfileModule' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Profile.ProfileProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Profile.ProfileProviderAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Profile.ProfileProviderCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Profile.SettingsAllowAnonymousAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Profile.SqlProfileProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Routing.HttpMethodConstraint' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Routing.IRouteConstraint' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Routing.IRouteHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Routing.PageRouteHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Routing.RequestContext' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Routing.Route' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Routing.RouteBase' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Routing.RouteCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Routing.RouteData' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Routing.RouteDirection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Routing.RouteTable' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Routing.RouteValueDictionary' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Routing.StopRoutingHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Routing.UrlRoutingHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Routing.UrlRoutingModule' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Routing.VirtualPathData' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.ActiveDirectoryConnectionProtection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.ActiveDirectoryMembershipProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.ActiveDirectoryMembershipUser' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.AnonymousIdentificationEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.AnonymousIdentificationEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.AnonymousIdentificationModule' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.AuthorizationStoreRoleProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.CookieProtection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.DefaultAuthenticationEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.DefaultAuthenticationEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.DefaultAuthenticationModule' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.FileAuthorizationModule' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.FormsAuthentication' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.FormsAuthenticationEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.FormsAuthenticationEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.FormsAuthenticationModule' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.FormsAuthenticationTicket' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.FormsIdentity' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.MachineKey' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.MachineKeyProtection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.Membership' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.MembershipPasswordAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.PassportAuthenticationEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.PassportAuthenticationEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.PassportAuthenticationModule' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.PassportIdentity' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.PassportPrincipal' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.RoleManagerEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.RoleManagerEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.RoleManagerModule' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.RolePrincipal' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.RoleProviderCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.Roles' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.SqlMembershipProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.SqlRoleProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.UrlAuthorizationModule' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.WindowsAuthenticationEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.WindowsAuthenticationEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.WindowsAuthenticationModule' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.WindowsTokenRoleProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.AntiXss.AntiXssEncoder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.AntiXss.LowerCodeCharts' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.AntiXss.LowerMidCodeCharts' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.AntiXss.MidCodeCharts' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.AntiXss.UpperCodeCharts' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Security.AntiXss.UpperMidCodeCharts' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.SessionState.HttpSessionState' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.SessionState.HttpSessionStateContainer' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.SessionState.IHttpSessionState' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.SessionState.IPartialSessionState' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.SessionState.IReadOnlySessionState' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.SessionState.IRequiresSessionState' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.SessionState.ISessionIDManager' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.SessionState.ISessionStateItemCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.SessionState.IStateRuntime' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.SessionState.SessionIDManager' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.SessionState.SessionStateActions' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.SessionState.SessionStateBehavior' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.SessionState.SessionStateItemCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.SessionState.SessionStateItemExpireCallback' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.SessionState.SessionStateMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.SessionState.SessionStateModule' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.SessionState.SessionStateStoreData' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.SessionState.SessionStateStoreProviderBase' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.SessionState.SessionStateUtility' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.SessionState.StateRuntime' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.AttributeCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.BaseParser' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.BasePartialCachingControl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.BaseTemplateParser' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.BindableTemplateBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.BoundPropertyEntry' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.BuilderPropertyEntry' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.BuildMethod' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.BuildTemplateMethod' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ChtmlTextWriter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ClientIDMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ClientScriptManager' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.CodeBlockType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.CodeConstructType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.CodeStatementBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.CompilationMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.CompiledBindableTemplateBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.CompiledTemplateBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ComplexPropertyEntry' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ConflictOptions' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ConstructorNeedsTagAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.Control' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ControlBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ControlBuilderAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ControlCachePolicy' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ControlCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ControlSkin' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ControlSkinDelegate' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ControlValuePropertyAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.CssClassPropertyAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.CssStyleCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.DataBinder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.DataBinding' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.DataBindingCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.DataBindingHandlerAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.DataBoundLiteralControl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.DataKeyPropertyAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.DataSourceCacheDurationConverter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.DataSourceCacheExpiry' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.DataSourceCapabilities' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.DataSourceControl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.DataSourceControlBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.DataSourceOperation' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.DataSourceSelectArguments' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.DataSourceView' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.DataSourceViewOperationCallback' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.DataSourceViewSelectCallback' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.DesignerDataBoundLiteralControl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.DesignTimeParseData' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.DesignTimeTemplateParser' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.EmptyControlCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.EventEntry' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ExpressionBinding' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ExpressionBindingCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ExtractTemplateValuesMethod' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.FileLevelControlBuilderAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.FileLevelMasterPageControlBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.FileLevelPageControlBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.FileLevelUserControlBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.FilterableAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HiddenFieldPageStatePersister' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HierarchicalDataSourceControl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HierarchicalDataSourceView' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.Html32TextWriter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlTextWriter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlTextWriterAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlTextWriterStyle' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlTextWriterTag' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.IAttributeAccessor' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.IAutoFieldGenerator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.IBindableControl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.IBindableTemplate' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ICallbackEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ICheckBoxControl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ICodeBlockTypeAccessor' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.IControlBuilderAccessor' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.IControlDesignerAccessor' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.IDataBindingsAccessor' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.IDataItemContainer' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.IDataKeysControl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.IDataSource' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.IDataSourceViewSchemaAccessor' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.IDReferencePropertyAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.IEditableTextControl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.IExpressionsAccessor' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.IFilterResolutionService' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.IHierarchicalDataSource' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.IHierarchicalEnumerable' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.IHierarchyData' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ImageClickEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ImageClickEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.INamingContainer' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.INavigateUIData' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.IndexedString' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.IParserAccessor' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.IPostBackDataHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.IPostBackEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.IResourceUrlGenerator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.IStateFormatter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.IStateManager' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.IStyleSheet' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ITemplate' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ITextControl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.IThemeResolutionService' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.IUrlResolutionService' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.IUserControlDesignerAccessor' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.IUserControlTypeResolutionService' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.IValidator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ListSourceHelper' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.LiteralControl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.LosFormatter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.MasterPage' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.MasterPageControlBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.NonVisualControlAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ObjectConverter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ObjectPersistData' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ObjectStateFormatter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ObjectTagBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.OutputCacheLocation' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.OutputCacheParameters' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.Page' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.PageAsyncTask' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.PageHandlerFactory' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.PageParser' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.PageParserFilter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.PageStatePersister' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.PageTheme' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.Pair' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ParseChildrenAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ParseRecorder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.PartialCachingAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.PartialCachingControl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.PersistChildrenAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.PersistenceMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.PersistenceModeAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.PostBackOptions' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.PropertyConverter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.PropertyEntry' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.RenderMethod' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.RenderTraceListener' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.RootBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.SessionPageStatePersister' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.SimplePropertyEntry' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.SimpleWebHandlerParser' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.SkinBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.StateBag' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.StateItem' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.StateManagedCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.StaticPartialCachingControl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.SupportsEventValidationAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.TagPrefixAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.TemplateBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.TemplateContainerAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.TemplateControl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.TemplateControlParser' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.TemplateInstance' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.TemplateInstanceAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.TemplateParser' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.TemplatePropertyEntry' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ThemeableAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ThemeProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ToolboxDataAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.Triplet' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.UnobtrusiveValidationMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.UrlPropertyAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.UserControl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.UserControlControlBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ValidateRequestMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ValidationPropertyAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ValidationSettings' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ValidatorCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.VerificationAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.VerificationConditionalOperator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.VerificationReportLevel' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.VerificationRule' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ViewStateEncryptionMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ViewStateException' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ViewStateMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.ViewStateModeByIdAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.VirtualReferenceType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebResourceAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebServiceParser' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.XhtmlMobileDocType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.XhtmlTextWriter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.XPathBinder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.Adapters.ControlAdapter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.Adapters.PageAdapter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlAnchor' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlArea' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlAudio' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlButton' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlContainerControl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlControl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlEmbed' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlEmptyTagControlBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlForm' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlGenericControl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlHead' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlHeadBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlIframe' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlImage' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlInputButton' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlInputCheckBox' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlInputControl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlInputFile' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlInputGenericControl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlInputHidden' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlInputImage' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlInputPassword' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlInputRadioButton' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlInputReset' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlInputSubmit' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlInputText' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlLink' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlMeta' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlSelect' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlSelectBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlSource' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlTable' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlTableCell' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlTableCellCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlTableRow' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlTableRowCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlTextArea' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlTitle' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlTrack' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.HtmlControls.HtmlVideo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.AccessDataSource' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.AccessDataSourceView' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.AdCreatedEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.AdCreatedEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.AdRotator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.AssociatedControlConverter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.AuthenticateEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.AuthenticateEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.AutoCompleteType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.AutoFieldsGenerator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.AutoGeneratedField' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.AutoGeneratedFieldProperties' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.BaseCompareValidator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.BaseDataBoundControl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.BaseDataList' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.BaseValidator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.BorderStyle' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.BoundColumn' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.BoundField' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.BulletedList' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.BulletedListDisplayMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.BulletedListEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.BulletedListEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.BulletStyle' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.Button' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ButtonColumn' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ButtonColumnType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ButtonField' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ButtonFieldBase' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ButtonType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.Calendar' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.CalendarDay' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.CalendarSelectionMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.CallingDataMethodsEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.CallingDataMethodsEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ChangePassword' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.CheckBox' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.CheckBoxField' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.CheckBoxList' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.CircleHotSpot' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.CommandEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.CommandEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.CommandField' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.CompareValidator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.CompleteWizardStep' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.CompositeControl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.CompositeDataBoundControl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.Content' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ContentDirection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ContentPlaceHolder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ControlIDConverter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ControlParameter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ControlPropertyNameConverter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.CookieParameter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.CreateUserErrorEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.CreateUserErrorEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.CreateUserWizard' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.CreateUserWizardStep' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.CreatingModelDataSourceEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.CreatingModelDataSourceEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.CustomValidator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataBoundControl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataBoundControlMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataControlCellType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataControlCommands' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataControlField' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataControlFieldCell' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataControlFieldCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataControlFieldHeaderCell' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataControlRowState' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataControlRowType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataGrid' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataGridColumn' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataGridColumnCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataGridCommandEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataGridCommandEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataGridItem' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataGridItemCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataGridItemEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataGridItemEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataGridPageChangedEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataGridPageChangedEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataGridPagerStyle' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataGridSortCommandEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataGridSortCommandEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataKey' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataKeyArray' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataKeyCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataList' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataListCommandEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataListCommandEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataListItem' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataListItemCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataListItemEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataListItemEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DataSourceSelectResultProcessingOptions' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DayNameFormat' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DayRenderEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DayRenderEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DetailsView' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DetailsViewCommandEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DetailsViewCommandEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DetailsViewDeletedEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DetailsViewDeletedEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DetailsViewDeleteEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DetailsViewDeleteEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DetailsViewInsertedEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DetailsViewInsertedEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DetailsViewInsertEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DetailsViewInsertEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DetailsViewMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DetailsViewModeEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DetailsViewModeEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DetailsViewPageEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DetailsViewPageEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DetailsViewPagerRow' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DetailsViewRow' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DetailsViewRowCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DetailsViewRowsGenerator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DetailsViewUpdatedEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DetailsViewUpdatedEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DetailsViewUpdateEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DetailsViewUpdateEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.DropDownList' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.EditCommandColumn' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.EmbeddedMailObject' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.EmbeddedMailObjectsCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.FileUpload' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.FirstDayOfWeek' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.FontInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.FontNamesConverter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.FontSize' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.FontUnit' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.FontUnitConverter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.FormParameter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.FormView' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.FormViewCommandEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.FormViewCommandEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.FormViewDeletedEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.FormViewDeletedEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.FormViewDeleteEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.FormViewDeleteEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.FormViewInsertedEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.FormViewInsertedEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.FormViewInsertEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.FormViewInsertEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.FormViewMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.FormViewModeEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.FormViewModeEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.FormViewPageEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.FormViewPageEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.FormViewPagerRow' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.FormViewRow' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.FormViewUpdatedEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.FormViewUpdatedEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.FormViewUpdateEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.FormViewUpdateEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.GridLines' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.GridView' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.GridViewCancelEditEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.GridViewCancelEditEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.GridViewColumnsGenerator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.GridViewCommandEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.GridViewCommandEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.GridViewDeletedEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.GridViewDeletedEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.GridViewDeleteEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.GridViewDeleteEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.GridViewEditEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.GridViewEditEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.GridViewPageEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.GridViewPageEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.GridViewRow' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.GridViewRowCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.GridViewRowEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.GridViewRowEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.GridViewSelectEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.GridViewSelectEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.GridViewSortEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.GridViewSortEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.GridViewUpdatedEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.GridViewUpdatedEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.GridViewUpdateEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.GridViewUpdateEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.HiddenField' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.HierarchicalDataBoundControl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.HorizontalAlign' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.HotSpot' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.HotSpotCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.HotSpotMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.HyperLink' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.HyperLinkColumn' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.HyperLinkControlBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.HyperLinkField' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.IButtonControl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ICallbackContainer' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ICompositeControlDesignerAccessor' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.IDataBoundControl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.IDataBoundItemControl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.IDataBoundListControl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.IFieldControl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.Image' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ImageAlign' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ImageButton' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ImageField' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ImageMap' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ImageMapEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ImageMapEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.IPersistedSelector' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.IPostBackContainer' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.IRepeatInfoUser' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.Label' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.LabelControlBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.LinkButton' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.LinkButtonControlBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ListBox' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ListControl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ListItem' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ListItemCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ListItemControlBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ListItemType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ListSelectionMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.Literal' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.LiteralControlBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.LiteralMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.Localize' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.Login' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.LoginCancelEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.LoginCancelEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.LoginFailureAction' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.LoginName' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.LoginStatus' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.LoginTextLayout' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.LoginView' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.LogoutAction' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.MailDefinition' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.MailMessageEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.MailMessageEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.Menu' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.MenuEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.MenuEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.MenuItem' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.MenuItemBinding' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.MenuItemBindingCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.MenuItemCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.MenuItemStyle' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.MenuItemStyleCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.MenuItemTemplateContainer' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.MenuRenderingMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ModelDataMethodResult' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ModelDataSource' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ModelDataSourceMethod' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ModelDataSourceView' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ModelErrorMessage' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ModelMethodContext' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.MonthChangedEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.MonthChangedEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.MultiView' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.MultiViewControlBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.NextPrevFormat' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ObjectDataSource' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ObjectDataSourceDisposingEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ObjectDataSourceDisposingEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ObjectDataSourceEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ObjectDataSourceFilteringEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ObjectDataSourceFilteringEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ObjectDataSourceMethodEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ObjectDataSourceMethodEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ObjectDataSourceObjectEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ObjectDataSourceSelectingEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ObjectDataSourceSelectingEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ObjectDataSourceStatusEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ObjectDataSourceView' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.Orientation' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.PagedDataSource' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.PagerButtons' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.PagerMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.PagerPosition' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.PagerSettings' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.Panel' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.PanelStyle' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.Parameter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ParameterCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ParsingCulture' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.PasswordRecovery' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.PathDirection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.PlaceHolder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.PlaceHolderControlBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.PolygonHotSpot' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ProfileParameter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.QueryExtensions' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.QueryStringParameter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.RadioButton' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.RadioButtonList' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.RangeValidator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.RectangleHotSpot' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.RegularExpressionValidator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.RepeatDirection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.Repeater' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.RepeaterCommandEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.RepeaterCommandEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.RepeaterItem' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.RepeaterItemCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.RepeaterItemEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.RepeaterItemEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.RepeatInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.RepeatLayout' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.RequiredFieldValidator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.RoleGroup' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.RoleGroupCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.RouteParameter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ScrollBars' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.SelectedDatesCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.SelectResult' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.SendMailErrorEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.SendMailErrorEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ServerValidateEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ServerValidateEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.SessionParameter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.SiteMapDataSource' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.SiteMapDataSourceView' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.SiteMapHierarchicalDataSourceView' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.SiteMapNodeItem' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.SiteMapNodeItemEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.SiteMapNodeItemEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.SiteMapNodeItemType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.SiteMapPath' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.SortDirection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.SqlDataSource' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.SqlDataSourceCommandEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.SqlDataSourceCommandEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.SqlDataSourceCommandType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.SqlDataSourceFilteringEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.SqlDataSourceFilteringEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.SqlDataSourceMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.SqlDataSourceSelectingEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.SqlDataSourceStatusEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.SqlDataSourceStatusEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.SqlDataSourceView' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.StringArrayConverter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.Style' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.StyleCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.SubMenuStyle' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.SubMenuStyleCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.Substitution' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.Table' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TableCaptionAlign' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TableCell' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TableCellCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TableCellControlBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TableFooterRow' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TableHeaderCell' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TableHeaderRow' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TableHeaderScope' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TableItemStyle' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TableRow' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TableRowCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TableRowSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TableSectionStyle' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TableStyle' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TargetConverter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TemplateColumn' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TemplatedWizardStep' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TemplateField' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TextAlign' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TextBox' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TextBoxControlBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TextBoxMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TitleFormat' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TreeNode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TreeNodeBinding' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TreeNodeBindingCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TreeNodeCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TreeNodeEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TreeNodeEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TreeNodeSelectAction' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TreeNodeStyle' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TreeNodeStyleCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TreeNodeTypes' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TreeView' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.TreeViewImageSet' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.Unit' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.UnitConverter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.UnitType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ValidatedControlConverter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ValidationCompareOperator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ValidationDataType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ValidationSummary' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ValidationSummaryDisplayMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ValidatorDisplay' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.VerticalAlign' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.View' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.ViewCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebColorConverter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebControl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.Wizard' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WizardNavigationEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WizardNavigationEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WizardStep' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WizardStepBase' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WizardStepCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WizardStepControlBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WizardStepType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.Xml' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.XmlBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.XmlDataSource' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.XmlDataSourceView' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.XmlHierarchicalDataSourceView' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.Adapters.DataBoundControlAdapter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.Adapters.HideDisabledControlAdapter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.Adapters.HierarchicalDataBoundControlAdapter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.Adapters.MenuAdapter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.Adapters.WebControlAdapter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.AppearanceEditorPart' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.BehaviorEditorPart' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.CatalogPart' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.CatalogPartChrome' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.CatalogPartCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.CatalogZone' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.CatalogZoneBase' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.ConnectionConsumerAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.ConnectionInterfaceCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.ConnectionPoint' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.ConnectionProviderAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.ConnectionsZone' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.ConsumerConnectionPoint' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.ConsumerConnectionPointCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.DeclarativeCatalogPart' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.EditorPart' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.EditorPartChrome' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.EditorPartCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.EditorZone' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.EditorZoneBase' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.ErrorWebPart' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.FieldCallback' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.GenericWebPart' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.ImportCatalogPart' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.IPersonalizable' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.ITrackingPersonalizable' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.ITransformerConfigurationControl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.IVersioningPersonalizable' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.IWebActionable' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.IWebEditable' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.IWebPart' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.IWebPartField' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.IWebPartParameters' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.IWebPartRow' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.IWebPartTable' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.LayoutEditorPart' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.PageCatalogPart' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.ParametersCallback' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.Part' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.PartChromeState' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.PartChromeType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.PersonalizableAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.PersonalizationAdministration' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.PersonalizationDictionary' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.PersonalizationEntry' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.PersonalizationProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.PersonalizationProviderCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.PersonalizationScope' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.PersonalizationState' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.PersonalizationStateInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.PersonalizationStateInfoCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.PersonalizationStateQuery' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.PropertyGridEditorPart' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.ProviderConnectionPoint' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.ProviderConnectionPointCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.ProxyWebPart' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.ProxyWebPartConnectionCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.ProxyWebPartManager' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.RowCallback' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.RowToFieldTransformer' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.RowToParametersTransformer' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.SharedPersonalizationStateInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.SqlPersonalizationProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.TableCallback' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.TitleStyle' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.ToolZone' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.TransformerTypeCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.UnauthorizedWebPart' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.UserPersonalizationStateInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebBrowsableAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebDescriptionAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebDisplayNameAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPart' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartAddingEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartAddingEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartAuthorizationEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartAuthorizationEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartCancelEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartCancelEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartChrome' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartConnection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartConnectionCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartConnectionsCancelEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartConnectionsCancelEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartConnectionsEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartConnectionsEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartDescription' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartDescriptionCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartDisplayMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartDisplayModeCancelEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartDisplayModeCancelEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartDisplayModeCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartDisplayModeEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartDisplayModeEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartExportMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartHelpMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartManager' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartManagerInternals' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartMenuStyle' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartMovingEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartMovingEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartPersonalization' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartTracker' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartTransformer' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartTransformerAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartTransformerCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartUserCapability' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartVerb' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartVerbCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartVerbRenderMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartVerbsEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartVerbsEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartZone' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartZoneBase' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebPartZoneCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.UI.WebControls.WebParts.WebZone' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Util.HttpEncoder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Util.IWebObjectFactory' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Util.IWebPropertyAccessor' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Util.RequestValidationSource' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Util.RequestValidator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Util.TransactedCallback' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Util.Transactions' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Util.WorkItem' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.Util.WorkItemCallback' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.WebSockets.AspNetWebSocket' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.WebSockets.AspNetWebSocketContext' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Web.WebSockets.AspNetWebSocketOptions' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Markup.ValueSerializerAttribute' does not exist in the implementation but it does exist in the contract. - -// Members can't be added because types are on NS20 and the missing members required types that are not on NS20 and we are ignoring those for netcore20: -MembersMustExist : Member 'System.Activator.CreateComInstanceFrom(System.String, System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Activator.CreateComInstanceFrom(System.String, System.String, System.Byte[], System.Configuration.Assemblies.AssemblyHashAlgorithm)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Activator.CreateInstance(System.ActivationContext)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Activator.CreateInstance(System.ActivationContext, System.String[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Activator.CreateInstance(System.AppDomain, System.String, System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Activator.CreateInstance(System.AppDomain, System.String, System.String, System.Boolean, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo, System.Object[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Activator.CreateInstance(System.AppDomain, System.String, System.String, System.Boolean, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo, System.Object[], System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Activator.CreateInstance(System.String, System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Activator.CreateInstance(System.String, System.String, System.Boolean, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo, System.Object[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Activator.CreateInstance(System.String, System.String, System.Boolean, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo, System.Object[], System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Activator.CreateInstance(System.String, System.String, System.Object[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Activator.CreateInstanceFrom(System.AppDomain, System.String, System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Activator.CreateInstanceFrom(System.AppDomain, System.String, System.String, System.Boolean, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo, System.Object[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Activator.CreateInstanceFrom(System.AppDomain, System.String, System.String, System.Boolean, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo, System.Object[], System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Activator.CreateInstanceFrom(System.String, System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Activator.CreateInstanceFrom(System.String, System.String, System.Boolean, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo, System.Object[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Activator.CreateInstanceFrom(System.String, System.String, System.Boolean, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo, System.Object[], System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Activator.CreateInstanceFrom(System.String, System.String, System.Object[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Activator.GetObject(System.Type, System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Activator.GetObject(System.Type, System.String, System.Object)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.ActivationContext.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.ApplicationIdentity.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.ApplicationTrust.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.CreateComInstanceFrom(System.String, System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.CreateComInstanceFrom(System.String, System.String, System.Byte[], System.Configuration.Assemblies.AssemblyHashAlgorithm)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.CreateDomain(System.String, System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.CreateDomain(System.String, System.Security.Policy.Evidence, System.AppDomainSetup)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.CreateDomain(System.String, System.Security.Policy.Evidence, System.AppDomainSetup, System.Security.PermissionSet, System.Security.Policy.StrongName[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.CreateDomain(System.String, System.Security.Policy.Evidence, System.String, System.String, System.Boolean)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.CreateDomain(System.String, System.Security.Policy.Evidence, System.String, System.String, System.Boolean, System.AppDomainInitializer, System.String[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.CreateInstance(System.String, System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.CreateInstance(System.String, System.String, System.Boolean, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo, System.Object[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.CreateInstance(System.String, System.String, System.Boolean, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo, System.Object[], System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.CreateInstance(System.String, System.String, System.Object[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.CreateInstanceAndUnwrap(System.String, System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.CreateInstanceAndUnwrap(System.String, System.String, System.Boolean, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo, System.Object[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.CreateInstanceAndUnwrap(System.String, System.String, System.Boolean, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo, System.Object[], System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.CreateInstanceAndUnwrap(System.String, System.String, System.Object[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.CreateInstanceFrom(System.String, System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.CreateInstanceFrom(System.String, System.String, System.Boolean, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo, System.Object[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.CreateInstanceFrom(System.String, System.String, System.Boolean, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo, System.Object[], System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.CreateInstanceFrom(System.String, System.String, System.Object[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.CreateInstanceFromAndUnwrap(System.String, System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.CreateInstanceFromAndUnwrap(System.String, System.String, System.Boolean, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo, System.Object[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.CreateInstanceFromAndUnwrap(System.String, System.String, System.Boolean, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo, System.Object[], System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.CreateInstanceFromAndUnwrap(System.String, System.String, System.Object[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.DefineDynamicAssembly(System.Reflection.AssemblyName, System.Reflection.Emit.AssemblyBuilderAccess)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.DefineDynamicAssembly(System.Reflection.AssemblyName, System.Reflection.Emit.AssemblyBuilderAccess, System.Collections.Generic.IEnumerable)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.DefineDynamicAssembly(System.Reflection.AssemblyName, System.Reflection.Emit.AssemblyBuilderAccess, System.Collections.Generic.IEnumerable, System.Security.SecurityContextSource)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.DefineDynamicAssembly(System.Reflection.AssemblyName, System.Reflection.Emit.AssemblyBuilderAccess, System.Security.PermissionSet, System.Security.PermissionSet, System.Security.PermissionSet)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.DefineDynamicAssembly(System.Reflection.AssemblyName, System.Reflection.Emit.AssemblyBuilderAccess, System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.DefineDynamicAssembly(System.Reflection.AssemblyName, System.Reflection.Emit.AssemblyBuilderAccess, System.Security.Policy.Evidence, System.Security.PermissionSet, System.Security.PermissionSet, System.Security.PermissionSet)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.DefineDynamicAssembly(System.Reflection.AssemblyName, System.Reflection.Emit.AssemblyBuilderAccess, System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.DefineDynamicAssembly(System.Reflection.AssemblyName, System.Reflection.Emit.AssemblyBuilderAccess, System.String, System.Boolean, System.Collections.Generic.IEnumerable)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.DefineDynamicAssembly(System.Reflection.AssemblyName, System.Reflection.Emit.AssemblyBuilderAccess, System.String, System.Security.PermissionSet, System.Security.PermissionSet, System.Security.PermissionSet)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.DefineDynamicAssembly(System.Reflection.AssemblyName, System.Reflection.Emit.AssemblyBuilderAccess, System.String, System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.DefineDynamicAssembly(System.Reflection.AssemblyName, System.Reflection.Emit.AssemblyBuilderAccess, System.String, System.Security.Policy.Evidence, System.Security.PermissionSet, System.Security.PermissionSet, System.Security.PermissionSet)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.DefineDynamicAssembly(System.Reflection.AssemblyName, System.Reflection.Emit.AssemblyBuilderAccess, System.String, System.Security.Policy.Evidence, System.Security.PermissionSet, System.Security.PermissionSet, System.Security.PermissionSet, System.Boolean)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.DefineDynamicAssembly(System.Reflection.AssemblyName, System.Reflection.Emit.AssemblyBuilderAccess, System.String, System.Security.Policy.Evidence, System.Security.PermissionSet, System.Security.PermissionSet, System.Security.PermissionSet, System.Boolean, System.Collections.Generic.IEnumerable)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.DoCallBack(System.CrossAppDomainDelegate)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.DomainManager.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.Evidence.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.ExecuteAssembly(System.String, System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.ExecuteAssembly(System.String, System.Security.Policy.Evidence, System.String[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.ExecuteAssembly(System.String, System.Security.Policy.Evidence, System.String[], System.Byte[], System.Configuration.Assemblies.AssemblyHashAlgorithm)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.ExecuteAssemblyByName(System.Reflection.AssemblyName, System.Security.Policy.Evidence, System.String[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.ExecuteAssemblyByName(System.String, System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.ExecuteAssemblyByName(System.String, System.Security.Policy.Evidence, System.String[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.Load(System.Byte[], System.Byte[], System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.Load(System.Reflection.AssemblyName, System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.Load(System.String, System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.PermissionSet.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.SetAppDomainPolicy(System.Security.Policy.PolicyLevel)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.SetData(System.String, System.Object, System.Security.IPermission)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.AppDomain.SetupInformation.get()' does not exist in the implementation but it does exist in the contract -MembersMustExist : Member 'System.Collections.Hashtable System.Resources.ResourceManager.ResourceSets' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Collections.Hashtable System.Resources.ResourceSet.Table' does not exist in the implementation but it does exist in the contract -MembersMustExist : Member 'System.ComponentModel.AsyncCompletedEventArgs..ctor()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.Common.DbProviderFactory.CreatePermission(System.Security.Permissions.PermissionState)' does not exist in the implementation but it does exist in the contract -MembersMustExist : Member 'System.Diagnostics.Debug.Listeners.get()' does not exist in the implementation but it does exist in the contract -MembersMustExist : Member 'System.IO.Directory.CreateDirectory(System.String, System.Security.AccessControl.DirectorySecurity)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Directory.GetAccessControl(System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Directory.GetAccessControl(System.String, System.Security.AccessControl.AccessControlSections)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Directory.SetAccessControl(System.String, System.Security.AccessControl.DirectorySecurity)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.DirectoryInfo.Create(System.Security.AccessControl.DirectorySecurity)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.DirectoryInfo.CreateSubdirectory(System.String, System.Security.AccessControl.DirectorySecurity)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.DirectoryInfo.GetAccessControl()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.DirectoryInfo.GetAccessControl(System.Security.AccessControl.AccessControlSections)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.DirectoryInfo.SetAccessControl(System.Security.AccessControl.DirectorySecurity)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.File.Create(System.String, System.Int32, System.IO.FileOptions, System.Security.AccessControl.FileSecurity)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.File.GetAccessControl(System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.File.GetAccessControl(System.String, System.Security.AccessControl.AccessControlSections)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.File.SetAccessControl(System.String, System.Security.AccessControl.FileSecurity)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.FileInfo.GetAccessControl()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.FileInfo.GetAccessControl(System.Security.AccessControl.AccessControlSections)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.FileInfo.SetAccessControl(System.Security.AccessControl.FileSecurity)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.FileStream..ctor(System.String, System.IO.FileMode, System.Security.AccessControl.FileSystemRights, System.IO.FileShare, System.Int32, System.IO.FileOptions)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.FileStream..ctor(System.String, System.IO.FileMode, System.Security.AccessControl.FileSystemRights, System.IO.FileShare, System.Int32, System.IO.FileOptions, System.Security.AccessControl.FileSecurity)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.FileStream.GetAccessControl()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.FileStream.SetAccessControl(System.Security.AccessControl.FileSecurity)' does not exist in the implementation but it does exist in the contract -MembersMustExist : Member 'System.IO.MemoryMappedFiles.MemoryMappedFile.CreateFromFile(System.IO.FileStream, System.String, System.Int64, System.IO.MemoryMappedFiles.MemoryMappedFileAccess, System.IO.MemoryMappedFiles.MemoryMappedFileSecurity, System.IO.HandleInheritability, System.Boolean)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.MemoryMappedFiles.MemoryMappedFile.CreateNew(System.String, System.Int64, System.IO.MemoryMappedFiles.MemoryMappedFileAccess, System.IO.MemoryMappedFiles.MemoryMappedFileOptions, System.IO.MemoryMappedFiles.MemoryMappedFileSecurity, System.IO.HandleInheritability)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.MemoryMappedFiles.MemoryMappedFile.CreateOrOpen(System.String, System.Int64, System.IO.MemoryMappedFiles.MemoryMappedFileAccess, System.IO.MemoryMappedFiles.MemoryMappedFileOptions, System.IO.MemoryMappedFiles.MemoryMappedFileSecurity, System.IO.HandleInheritability)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.MemoryMappedFiles.MemoryMappedFile.GetAccessControl()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.MemoryMappedFiles.MemoryMappedFile.SetAccessControl(System.IO.MemoryMappedFiles.MemoryMappedFileSecurity)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Pipes.AnonymousPipeServerStream..ctor(System.IO.Pipes.PipeDirection, System.IO.HandleInheritability, System.Int32, System.IO.Pipes.PipeSecurity)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Pipes.NamedPipeClientStream..ctor(System.String, System.String, System.IO.Pipes.PipeAccessRights, System.IO.Pipes.PipeOptions, System.Security.Principal.TokenImpersonationLevel, System.IO.HandleInheritability)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Pipes.NamedPipeServerStream..ctor(System.String, System.IO.Pipes.PipeDirection, System.Int32, System.IO.Pipes.PipeTransmissionMode, System.IO.Pipes.PipeOptions, System.Int32, System.Int32, System.IO.Pipes.PipeSecurity)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Pipes.NamedPipeServerStream..ctor(System.String, System.IO.Pipes.PipeDirection, System.Int32, System.IO.Pipes.PipeTransmissionMode, System.IO.Pipes.PipeOptions, System.Int32, System.Int32, System.IO.Pipes.PipeSecurity, System.IO.HandleInheritability)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Pipes.NamedPipeServerStream..ctor(System.String, System.IO.Pipes.PipeDirection, System.Int32, System.IO.Pipes.PipeTransmissionMode, System.IO.Pipes.PipeOptions, System.Int32, System.Int32, System.IO.Pipes.PipeSecurity, System.IO.HandleInheritability, System.IO.Pipes.PipeAccessRights)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Pipes.PipeStream.GetAccessControl()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Pipes.PipeStream.SetAccessControl(System.IO.Pipes.PipeSecurity)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Linq.Expressions.LambdaExpression.CompileToMethod(System.Reflection.Emit.MethodBuilder)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Linq.Expressions.LambdaExpression.CompileToMethod(System.Reflection.Emit.MethodBuilder, System.Runtime.CompilerServices.DebugInfoGenerator)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.MarshalByRefObject.CreateObjRef(System.Type)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.HttpVersion..ctor()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.HttpWebRequest..ctor()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.ServicePointManager.CertificatePolicy.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.ServicePointManager.CertificatePolicy.set(System.Net.ICertificatePolicy)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.Sockets.SocketAsyncEventArgs.SocketClientAccessPolicyProtocol.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.Sockets.SocketAsyncEventArgs.SocketClientAccessPolicyProtocol.set(System.Net.Sockets.SocketClientAccessPolicyProtocol)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.Sockets.SocketFlags System.Net.Sockets.SocketFlags.MaxIOVectorLength' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.TransportContext.GetTlsTokenBindings()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.WebRequest.CreatorInstance.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.WebRequest.RegisterPortableWebRequestCreator(System.Net.IWebRequestCreate)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Assembly.Evidence.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Assembly.Load(System.Byte[], System.Byte[], System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Assembly.Load(System.Byte[], System.Byte[], System.Security.SecurityContextSource)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Assembly.Load(System.Reflection.AssemblyName, System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Assembly.Load(System.String, System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Assembly.LoadFile(System.String, System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Assembly.LoadFrom(System.String, System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Assembly.LoadFrom(System.String, System.Security.Policy.Evidence, System.Byte[], System.Configuration.Assemblies.AssemblyHashAlgorithm)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Assembly.LoadWithPartialName(System.String, System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Assembly.PermissionSet.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Module.GetSignerCertificate()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Resources.IResourceReader System.Resources.ResourceSet.Reader' does not exist in the implementation but it does exist in the contract -MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.GetActiveObject(System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.GetComInterfaceForObjectInContext(System.Object, System.Type)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.GetComSlotForMethodInfo(System.Reflection.MemberInfo)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.GetEndComSlot(System.Type)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.GetExceptionPointers()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.GetIDispatchForObjectInContext(System.Object)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.GetITypeInfoForType(System.Type)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.GetIUnknownForObjectInContext(System.Object)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.GetManagedThunkForUnmanagedMethodPtr(System.IntPtr, System.IntPtr, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.GetMethodInfoForComSlot(System.Type, System.Int32, System.Runtime.InteropServices.ComMemberType)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.GetThreadFromFiberCookie(System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.GetTypeForITypeInfo(System.IntPtr)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.GetTypeInfoName(System.Runtime.InteropServices.UCOMITypeInfo)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.GetTypeLibGuid(System.Runtime.InteropServices.ComTypes.ITypeLib)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.GetTypeLibGuid(System.Runtime.InteropServices.UCOMITypeLib)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.GetTypeLibGuidForAssembly(System.Reflection.Assembly)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.GetTypeLibLcid(System.Runtime.InteropServices.ComTypes.ITypeLib)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.GetTypeLibLcid(System.Runtime.InteropServices.UCOMITypeLib)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.GetTypeLibName(System.Runtime.InteropServices.ComTypes.ITypeLib)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.GetTypeLibName(System.Runtime.InteropServices.UCOMITypeLib)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.GetTypeLibVersionForAssembly(System.Reflection.Assembly, System.Int32, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.GetUnmanagedThunkForManagedMethodPtr(System.IntPtr, System.IntPtr, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.IsTypeVisibleFromCom(System.Type)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.NumParamBytes(System.Reflection.MethodInfo)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.ReleaseThreadCache()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.InteropServices.RuntimeEnvironment..ctor()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.Serialization.DataContractSerializer..ctor(System.Type, System.Collections.Generic.IEnumerable, System.Int32, System.Boolean, System.Boolean, System.Runtime.Serialization.IDataContractSurrogate)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.Serialization.DataContractSerializer..ctor(System.Type, System.Collections.Generic.IEnumerable, System.Int32, System.Boolean, System.Boolean, System.Runtime.Serialization.IDataContractSurrogate, System.Runtime.Serialization.DataContractResolver)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.Serialization.DataContractSerializer..ctor(System.Type, System.String, System.String, System.Collections.Generic.IEnumerable, System.Int32, System.Boolean, System.Boolean, System.Runtime.Serialization.IDataContractSurrogate)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.Serialization.DataContractSerializer..ctor(System.Type, System.String, System.String, System.Collections.Generic.IEnumerable, System.Int32, System.Boolean, System.Boolean, System.Runtime.Serialization.IDataContractSurrogate, System.Runtime.Serialization.DataContractResolver)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.Serialization.DataContractSerializer..ctor(System.Type, System.Xml.XmlDictionaryString, System.Xml.XmlDictionaryString, System.Collections.Generic.IEnumerable, System.Int32, System.Boolean, System.Boolean, System.Runtime.Serialization.IDataContractSurrogate)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.Serialization.DataContractSerializer..ctor(System.Type, System.Xml.XmlDictionaryString, System.Xml.XmlDictionaryString, System.Collections.Generic.IEnumerable, System.Int32, System.Boolean, System.Boolean, System.Runtime.Serialization.IDataContractSurrogate, System.Runtime.Serialization.DataContractResolver)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.Serialization.DataContractSerializer.DataContractSurrogate.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.Serialization.DataContractSerializerSettings.DataContractSurrogate.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.Serialization.DataContractSerializerSettings.DataContractSurrogate.set(System.Runtime.Serialization.IDataContractSurrogate)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.Serialization.ExportOptions.DataContractSurrogate.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.Serialization.ExportOptions.DataContractSurrogate.set(System.Runtime.Serialization.IDataContractSurrogate)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(System.IO.Stream, System.Runtime.Remoting.Messaging.HeaderHandler)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.DeserializeMethodResponse(System.IO.Stream, System.Runtime.Remoting.Messaging.HeaderHandler, System.Runtime.Remoting.Messaging.IMethodCallMessage)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(System.IO.Stream, System.Object, System.Runtime.Remoting.Messaging.Header[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.UnsafeDeserialize(System.IO.Stream, System.Runtime.Remoting.Messaging.HeaderHandler)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.UnsafeDeserializeMethodResponse(System.IO.Stream, System.Runtime.Remoting.Messaging.HeaderHandler, System.Runtime.Remoting.Messaging.IMethodCallMessage)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.Serialization.Json.DataContractJsonSerializer..ctor(System.Type, System.Collections.Generic.IEnumerable, System.Int32, System.Boolean, System.Runtime.Serialization.IDataContractSurrogate, System.Boolean)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.Serialization.Json.DataContractJsonSerializer..ctor(System.Type, System.String, System.Collections.Generic.IEnumerable, System.Int32, System.Boolean, System.Runtime.Serialization.IDataContractSurrogate, System.Boolean)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.Serialization.Json.DataContractJsonSerializer..ctor(System.Type, System.Xml.XmlDictionaryString, System.Collections.Generic.IEnumerable, System.Int32, System.Boolean, System.Runtime.Serialization.IDataContractSurrogate, System.Boolean)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.Serialization.Json.DataContractJsonSerializer.DataContractSurrogate.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.Serialization.Json.DataContractJsonSerializerSettings.DataContractSurrogate.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.Serialization.Json.DataContractJsonSerializerSettings.DataContractSurrogate.set(System.Runtime.Serialization.IDataContractSurrogate)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.CspKeyContainerInfo.CryptoKeySecurity.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.CspParameters..ctor(System.Int32, System.String, System.String, System.Security.AccessControl.CryptoKeySecurity, System.IntPtr)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.CspParameters..ctor(System.Int32, System.String, System.String, System.Security.AccessControl.CryptoKeySecurity, System.Security.SecureString)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.CspParameters.CryptoKeySecurity.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.CspParameters.CryptoKeySecurity.set(System.Security.AccessControl.CryptoKeySecurity)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.SecurityException..ctor(System.String, System.Object, System.Object, System.Reflection.MethodInfo, System.Object, System.Security.IPermission)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.SecurityException..ctor(System.String, System.Reflection.AssemblyName, System.Security.PermissionSet, System.Security.PermissionSet, System.Reflection.MethodInfo, System.Security.Permissions.SecurityAction, System.Object, System.Security.IPermission, System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.SecurityException.Action.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.SecurityException.Action.set(System.Security.Permissions.SecurityAction)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.SecurityException.FirstPermissionThatFailed.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.SecurityException.FirstPermissionThatFailed.set(System.Security.IPermission)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.SecurityException.Zone.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.SecurityException.Zone.set(System.Security.SecurityZone)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Threading.Thread.CurrentContext.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.String System.Resources.ResourceManager.BaseNameField' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Threading.EventWaitHandle..ctor(System.Boolean, System.Threading.EventResetMode, System.String, System.Boolean, System.Security.AccessControl.EventWaitHandleSecurity)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Threading.EventWaitHandle.GetAccessControl()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Threading.EventWaitHandle.OpenExisting(System.String, System.Security.AccessControl.EventWaitHandleRights)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Threading.EventWaitHandle.SetAccessControl(System.Security.AccessControl.EventWaitHandleSecurity)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Threading.EventWaitHandle.TryOpenExisting(System.String, System.Security.AccessControl.EventWaitHandleRights, System.Threading.EventWaitHandle)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Threading.Mutex..ctor(System.Boolean, System.String, System.Boolean, System.Security.AccessControl.MutexSecurity)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Threading.Mutex.GetAccessControl()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Threading.Mutex.OpenExisting(System.String, System.Security.AccessControl.MutexRights)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Threading.Mutex.SetAccessControl(System.Security.AccessControl.MutexSecurity)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Threading.Mutex.TryOpenExisting(System.String, System.Security.AccessControl.MutexRights, System.Threading.Mutex)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Threading.Semaphore..ctor(System.Int32, System.Int32, System.String, System.Boolean, System.Security.AccessControl.SemaphoreSecurity)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Threading.Semaphore.GetAccessControl()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Threading.Semaphore.OpenExisting(System.String, System.Security.AccessControl.SemaphoreRights)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Threading.Semaphore.SetAccessControl(System.Security.AccessControl.SemaphoreSecurity)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Threading.Semaphore.TryOpenExisting(System.String, System.Security.AccessControl.SemaphoreRights, System.Threading.Semaphore)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Serialization.XmlMemberMapping.GenerateTypeName(System.CodeDom.Compiler.CodeDomProvider)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Serialization.XmlSchemaImporter..ctor(System.Xml.Serialization.XmlSchemas, System.Xml.Serialization.CodeGenerationOptions, System.CodeDom.Compiler.CodeDomProvider, System.Xml.Serialization.ImportContext)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Serialization.XmlSchemaImporter..ctor(System.Xml.Serialization.XmlSchemas, System.Xml.Serialization.CodeGenerationOptions, System.Xml.Serialization.ImportContext)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Serialization.XmlSchemaImporter..ctor(System.Xml.Serialization.XmlSchemas, System.Xml.Serialization.CodeIdentifiers, System.Xml.Serialization.CodeGenerationOptions)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Serialization.XmlSerializer..ctor(System.Type, System.Xml.Serialization.XmlAttributeOverrides, System.Type[], System.Xml.Serialization.XmlRootAttribute, System.String, System.String, System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Serialization.XmlSerializer.FromMappings(System.Xml.Serialization.XmlMapping[], System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Serialization.XmlSerializer.GenerateSerializer(System.Type[], System.Xml.Serialization.XmlMapping[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Serialization.XmlSerializer.GenerateSerializer(System.Type[], System.Xml.Serialization.XmlMapping[], System.CodeDom.Compiler.CompilerParameters)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Serialization.XmlSerializerFactory.CreateSerializer(System.Type, System.Xml.Serialization.XmlAttributeOverrides, System.Type[], System.Xml.Serialization.XmlRootAttribute, System.String, System.String, System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.XmlReaderSettings..ctor(System.Xml.XmlResolver)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.XmlSecureResolver..ctor(System.Xml.XmlResolver, System.Security.PermissionSet)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.XmlSecureResolver..ctor(System.Xml.XmlResolver, System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.XmlSecureResolver.CreateEvidenceForUrl(System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Xsl.XslCompiledTransform.CompileToType(System.Xml.XmlReader, System.Xml.Xsl.XsltSettings, System.Xml.XmlResolver, System.Boolean, System.Reflection.Emit.TypeBuilder, System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Xsl.XslCompiledTransform.TemporaryFiles.get()' does not exist in the implementation but it does exist in the contract -MembersMustExist : Member 'System.Xml.Xsl.XslTransform.Load(System.Xml.XmlReader, System.Xml.XmlResolver, System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Xsl.XslTransform.Load(System.Xml.XPath.IXPathNavigable, System.Xml.XmlResolver, System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Xsl.XslTransform.Load(System.Xml.XPath.XPathNavigator, System.Xml.XmlResolver, Syste - -// Negligible usage, CAS -TypesMustExist : Type 'System.ServiceProcess.ServiceControllerPermission' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceProcess.ServiceControllerPermissionAccess' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceProcess.ServiceControllerPermissionAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceProcess.ServiceControllerPermissionEntry' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceProcess.ServiceControllerPermissionEntryCollection' does not exist in the implementation but it does exist in the contract. - -// CAS -TypesMustExist : Type 'System.Security.Policy.ApplicationSecurityInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Policy.ApplicationSecurityManager' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Policy.IApplicationTrustManager' does not exist in the implementation but it does exist in the contract. - -// Undesirable dependencies -TypesMustExist : Type 'System.ServiceProcess.Design.ServiceInstallerDialog' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceProcess.Design.ServiceInstallerDialogResult' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceProcess.ServiceInstaller' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceProcess.ServiceProcessDescriptionAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceProcess.ServiceProcessInstaller' does not exist in the implementation but it does exist in the contract. - -MembersMustExist : Member 'System.Console.Write(System.String, System.Object, System.Object, System.Object, System.Object, __arglist)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Console.WriteLine(System.String, System.Object, System.Object, System.Object, System.Object, __arglist)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.String.Concat(System.Object, System.Object, System.Object, System.Object, __arglist)' does not exist in the implementation but it does exist in the contract. - -// Intentional change in Core -TypeCannotChangeClassification : Type 'System.RuntimeArgumentHandle' is a 'ref struct' in the implementation but is a 'struct' in the contract. -TypeCannotChangeClassification : Type 'System.TypedReference' is a 'ref struct' in the implementation but is a 'struct' in the contract. \ No newline at end of file diff --git a/src/libraries/shims/ApiCompatBaseline.netcoreapp.netfx461.txt b/src/libraries/shims/ApiCompatBaseline.netcoreapp.netfx461.txt deleted file mode 100644 index 4fd3fa2437be4f..00000000000000 --- a/src/libraries/shims/ApiCompatBaseline.netcoreapp.netfx461.txt +++ /dev/null @@ -1,614 +0,0 @@ -ApiCompat Error: 0 : Unable to resolve assembly 'Assembly(Name=System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)' referenced by the contract assembly 'Assembly(Name=System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)'. -ApiCompat Error: 0 : Unable to resolve assembly 'Assembly(Name=System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)' referenced by the contract assembly 'Assembly(Name=System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a)'. -ApiCompat Error: 0 : Unable to resolve assembly 'Assembly(Name=System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)' referenced by the contract assembly 'Assembly(Name=System.Xml.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)'. -ApiCompat Error: 0 : Unable to resolve assembly 'Assembly(Name=System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)' referenced by the contract assembly 'Assembly(Name=WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)'. -Compat issues with assembly mscorlib: -TypesMustExist : Type 'System.Configuration.Assemblies.AssemblyHash' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.IO.IsolatedStorage.IsolatedStorageSecurityOptions' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.IO.IsolatedStorage.IsolatedStorageSecurityState' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.EventToken' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.ExceptionHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.FieldToken' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.MethodRental' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.MethodToken' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.ParameterToken' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.PEFileKinds' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.PropertyToken' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.SignatureToken' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.StringToken' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.TypeToken' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.UnmanagedMarshal' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.ProfileOptimization' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Serialization.Formatters.InternalRM' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Serialization.Formatters.InternalST' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Serialization.Formatters.ISoapMessage' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Serialization.Formatters.ServerFault' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Serialization.Formatters.SoapFault' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Serialization.Formatters.SoapMessage' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Principal.WindowsImpersonationContext' does not exist in the implementation but it does exist in the contract. -Compat issues with assembly System: -MembersMustExist : Member 'System.CodeDom.Compiler.CompilerParameters.Evidence.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.CodeDom.Compiler.CompilerParameters.Evidence.set(System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.CodeDom.Compiler.CompilerResults.Evidence.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.CodeDom.Compiler.CompilerResults.Evidence.set(System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.ConsoleTraceListener' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.DiagnosticsConfigurationHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.EventLogTraceListener' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.XmlWriterTraceListener' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.IO.IODescriptionAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.ICertificatePolicy' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.AuthenticationModuleElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.AuthenticationModuleElementCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.AuthenticationModulesSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.BypassElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.BypassElementCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.ConnectionManagementElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.ConnectionManagementElementCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.ConnectionManagementSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.DefaultProxySection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.FtpCachePolicyElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.HttpCachePolicyElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.HttpListenerElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.HttpListenerTimeoutsElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.HttpWebRequestElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.Ipv6Element' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.MailSettingsSectionGroup' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.ModuleElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.NetSectionGroup' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.PerformanceCountersElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.ProxyElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.RequestCachingSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.ServicePointManagerElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.SettingsSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.SmtpNetworkElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.SmtpSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.SmtpSpecifiedPickupDirectoryElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.SocketElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.UnicodeDecodingConformance' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.UnicodeEncodingConformance' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.WebProxyScriptElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.WebRequestModuleElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.WebRequestModuleElementCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.WebRequestModulesSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Configuration.WebUtilityElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Sockets.SocketClientAccessPolicyProtocol' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.ICustomTypeProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.StandardOleMarshalObject' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Authentication.ExtendedProtection.TokenBinding' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Authentication.ExtendedProtection.TokenBindingType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Authentication.ExtendedProtection.Configuration.ExtendedProtectionPolicyElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Authentication.ExtendedProtection.Configuration.ServiceNameElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Authentication.ExtendedProtection.Configuration.ServiceNameElementCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Claims.DynamicRoleClaimProvider' does not exist in the implementation but it does exist in the contract. -Compat issues with assembly System.ComponentModel.DataAnnotations: -TypesMustExist : Type 'System.ComponentModel.DataAnnotations.AssociatedMetadataTypeTypeDescriptionProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ComponentModel.DataAnnotations.BindableTypeAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ComponentModel.DataAnnotations.MetadataTypeAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ComponentModel.DataAnnotations.ScaffoldTableAttribute' does not exist in the implementation but it does exist in the contract. -Compat issues with assembly System.Core: -TypesMustExist : Type 'System.Diagnostics.EventSchemaTraceListener' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.TraceLogRetentionOption' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.UnescapedXmlDiagnosticData' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.EventDescriptor' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.EventProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.EventProviderTraceListener' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.EventBookmark' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.EventKeyword' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.EventLevel' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.EventLogConfiguration' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.EventLogException' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.EventLogInformation' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.EventLogInvalidDataException' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.EventLogIsolation' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.EventLogLink' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.EventLogMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.EventLogNotFoundException' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.EventLogPropertySelector' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.EventLogProviderDisabledException' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.EventLogQuery' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.EventLogReader' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.EventLogReadingException' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.EventLogRecord' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.EventLogSession' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.EventLogStatus' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.EventLogType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.EventLogWatcher' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.EventMetadata' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.EventOpcode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.EventProperty' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.EventRecord' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.EventRecordWrittenEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.EventTask' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.PathType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.ProviderMetadata' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.SessionAuthentication' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.StandardEventKeywords' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.StandardEventLevel' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.StandardEventOpcode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Eventing.Reader.StandardEventTask' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.PerformanceData.CounterData' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.PerformanceData.CounterSet' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.PerformanceData.CounterSetInstance' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.PerformanceData.CounterSetInstanceCounterDataSet' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.PerformanceData.CounterSetInstanceType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.PerformanceData.CounterType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.IO.MemoryMappedFiles.MemoryMappedFileSecurity' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Management.Instrumentation.InstanceNotFoundException' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Management.Instrumentation.InstrumentationBaseException' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Management.Instrumentation.InstrumentationException' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Management.Instrumentation.ManagementBindAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Management.Instrumentation.ManagementCommitAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Management.Instrumentation.ManagementConfigurationAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Management.Instrumentation.ManagementConfigurationType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Management.Instrumentation.ManagementCreateAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Management.Instrumentation.ManagementEntityAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Management.Instrumentation.ManagementEnumeratorAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Management.Instrumentation.ManagementHostingModel' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Management.Instrumentation.ManagementKeyAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Management.Instrumentation.ManagementMemberAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Management.Instrumentation.ManagementNameAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Management.Instrumentation.ManagementNewInstanceAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Management.Instrumentation.ManagementProbeAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Management.Instrumentation.ManagementReferenceAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Management.Instrumentation.ManagementRemoveAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Management.Instrumentation.ManagementTaskAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Management.Instrumentation.WmiConfigurationAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.CompilerServices.CallSiteOps' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.CompilerServices.Closure' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.CompilerServices.ExecutionScope' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.CompilerServices.RuntimeOps' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.ManifestKinds' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Cryptography.ManifestSignatureInformation' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Cryptography.ManifestSignatureInformationCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Cryptography.MD5Cng' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Cryptography.SHA1Cng' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Cryptography.SHA256Cng' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Cryptography.SHA384Cng' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Cryptography.SHA512Cng' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Cryptography.SignatureVerificationResult' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Cryptography.StrongNameSignatureInformation' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Cryptography.X509Certificates.AuthenticodeSignatureInformation' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Cryptography.X509Certificates.TimestampInformation' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Cryptography.X509Certificates.TrustStatus' does not exist in the implementation but it does exist in the contract. -Compat issues with assembly System.Data: -TypesMustExist : Type 'Microsoft.SqlServer.Server.SqlContext' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'Microsoft.SqlServer.Server.SqlFacetAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'Microsoft.SqlServer.Server.SqlPipe' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'Microsoft.SqlServer.Server.SqlProcedureAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'Microsoft.SqlServer.Server.SqlTriggerAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'Microsoft.SqlServer.Server.SqlTriggerContext' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'Microsoft.SqlServer.Server.TriggerAction' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.DataSetSchemaImporterExtension' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.PropertyAttributes' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.TypedDataSetGenerator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.TypedDataSetGeneratorException' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.Common.DbProviderConfigurationHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.Common.DbProviderFactoriesConfigurationHandler' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.Common.DbProviderFactory.CreatePermission(System.Security.Permissions.PermissionState)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.Odbc.OdbcConnection.EnlistDistributedTransaction(System.EnterpriseServices.ITransaction)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.Odbc.OdbcFactory.CreatePermission(System.Security.Permissions.PermissionState)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.Sql.SqlDataSourceEnumerator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.SqlClient.SqlAuthenticationMethod' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.SqlClient.SqlBulkCopyOptions System.Data.SqlClient.SqlBulkCopyOptions.AllowEncryptedValueModifications' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.SqlClient.SqlClientFactory.CreatePermission(System.Security.Permissions.PermissionState)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.SqlClient.SqlColumnEncryptionCertificateStoreProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.SqlClient.SqlColumnEncryptionCngProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.SqlClient.SqlColumnEncryptionCspProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.SqlClient.SqlColumnEncryptionKeyStoreProvider' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.SqlClient.SqlCommand..ctor(System.String, System.Data.SqlClient.SqlConnection, System.Data.SqlClient.SqlTransaction, System.Data.SqlClient.SqlCommandColumnEncryptionSetting)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.SqlClient.SqlCommand.BeginExecuteReader()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.SqlClient.SqlCommand.BeginExecuteReader(System.AsyncCallback, System.Object)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.SqlClient.SqlCommand.BeginExecuteReader(System.AsyncCallback, System.Object, System.Data.CommandBehavior)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.SqlClient.SqlCommand.BeginExecuteReader(System.Data.CommandBehavior)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.SqlClient.SqlCommand.ColumnEncryptionSetting.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.SqlClient.SqlCommand.EndExecuteReader(System.IAsyncResult)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.SqlClient.SqlCommand.NotificationAutoEnlist.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.SqlClient.SqlCommand.NotificationAutoEnlist.set(System.Boolean)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.SqlClient.SqlCommandColumnEncryptionSetting' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.SqlClient.SqlConnection.AccessToken.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.SqlClient.SqlConnection.AccessToken.set(System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.SqlClient.SqlConnection.ColumnEncryptionTrustedMasterKeyPaths.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.SqlClient.SqlConnection.EnlistDistributedTransaction(System.EnterpriseServices.ITransaction)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.SqlClient.SqlConnection.RegisterColumnEncryptionKeyStoreProviders(System.Collections.Generic.IDictionary)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.SqlClient.SqlConnectionColumnEncryptionSetting' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.SqlClient.SqlConnectionStringBuilder.AsynchronousProcessing.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.SqlClient.SqlConnectionStringBuilder.AsynchronousProcessing.set(System.Boolean)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.SqlClient.SqlConnectionStringBuilder.Authentication.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.SqlClient.SqlConnectionStringBuilder.Authentication.set(System.Data.SqlClient.SqlAuthenticationMethod)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.SqlClient.SqlConnectionStringBuilder.ColumnEncryptionSetting.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.SqlClient.SqlConnectionStringBuilder.ColumnEncryptionSetting.set(System.Data.SqlClient.SqlConnectionColumnEncryptionSetting)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.SqlClient.SqlConnectionStringBuilder.ConnectionReset.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.SqlClient.SqlConnectionStringBuilder.ConnectionReset.set(System.Boolean)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.SqlClient.SqlConnectionStringBuilder.ContextConnection.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.SqlClient.SqlConnectionStringBuilder.ContextConnection.set(System.Boolean)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.SqlClient.SqlConnectionStringBuilder.NetworkLibrary.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.SqlClient.SqlConnectionStringBuilder.NetworkLibrary.set(System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.SqlClient.SqlConnectionStringBuilder.TransparentNetworkIPResolution.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.SqlClient.SqlConnectionStringBuilder.TransparentNetworkIPResolution.set(System.Boolean)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.SqlClient.SQLDebugging' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.SqlClient.SqlParameter.ForceColumnEncryption.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.SqlClient.SqlParameter.ForceColumnEncryption.set(System.Boolean)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Data.SqlClient.SqlParameterCollection.Add(System.String, System.Object)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.SqlTypes.SqlFileStream' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.SqlTypes.SqlTypesSchemaImporterExtensionHelper' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.SqlTypes.TypeBigIntSchemaImporterExtension' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.SqlTypes.TypeBinarySchemaImporterExtension' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.SqlTypes.TypeBitSchemaImporterExtension' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.SqlTypes.TypeCharSchemaImporterExtension' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.SqlTypes.TypeDateTimeSchemaImporterExtension' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.SqlTypes.TypeDecimalSchemaImporterExtension' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.SqlTypes.TypeFloatSchemaImporterExtension' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.SqlTypes.TypeIntSchemaImporterExtension' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.SqlTypes.TypeMoneySchemaImporterExtension' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.SqlTypes.TypeNCharSchemaImporterExtension' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.SqlTypes.TypeNTextSchemaImporterExtension' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.SqlTypes.TypeNumericSchemaImporterExtension' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.SqlTypes.TypeNVarCharSchemaImporterExtension' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.SqlTypes.TypeRealSchemaImporterExtension' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.SqlTypes.TypeSmallDateTimeSchemaImporterExtension' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.SqlTypes.TypeSmallIntSchemaImporterExtension' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.SqlTypes.TypeSmallMoneySchemaImporterExtension' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.SqlTypes.TypeTextSchemaImporterExtension' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.SqlTypes.TypeTinyIntSchemaImporterExtension' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.SqlTypes.TypeUniqueIdentifierSchemaImporterExtension' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.SqlTypes.TypeVarBinarySchemaImporterExtension' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.SqlTypes.TypeVarCharSchemaImporterExtension' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Data.SqlTypes.TypeVarImageSchemaImporterExtension' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Xml.XmlDataDocument' does not exist in the implementation but it does exist in the contract. -Compat issues with assembly System.DirectoryServices: -TypesMustExist : Type 'System.DirectoryServices.DSDescriptionAttribute' does not exist in the implementation but it does exist in the contract. -Compat issues with assembly System.DirectoryServices.Protocols: -MembersMustExist : Member 'System.DirectoryServices.Protocols.AddRequest.ToXmlNode(System.Xml.XmlDocument)' does not exist in the implementation but it does exist in the contract. -CannotMakeTypeAbstract : Type 'System.DirectoryServices.Protocols.BerConverter' is abstract in the implementation but is not abstract in the contract. -MembersMustExist : Member 'System.DirectoryServices.Protocols.CompareRequest.ToXmlNode(System.Xml.XmlDocument)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.DirectoryServices.Protocols.DeleteRequest.ToXmlNode(System.Xml.XmlDocument)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.DirectoryServices.Protocols.DirectoryRequest.ToXmlNode(System.Xml.XmlDocument)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.DirectoryServices.Protocols.DsmlAuthRequest.ToXmlNode(System.Xml.XmlDocument)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.DirectoryServices.Protocols.DsmlAuthResponse' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.DirectoryServices.Protocols.DsmlDirectoryIdentifier' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.DirectoryServices.Protocols.DsmlDocument' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.DirectoryServices.Protocols.DsmlDocumentProcessing' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.DirectoryServices.Protocols.DsmlErrorProcessing' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.DirectoryServices.Protocols.DsmlErrorResponse' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.DirectoryServices.Protocols.DsmlInvalidDocumentException' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.DirectoryServices.Protocols.DsmlRequestDocument' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.DirectoryServices.Protocols.DsmlResponseDocument' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.DirectoryServices.Protocols.DsmlResponseOrder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.DirectoryServices.Protocols.DsmlSoapConnection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.DirectoryServices.Protocols.DsmlSoapHttpConnection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.DirectoryServices.Protocols.ErrorResponseCategory' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.DirectoryServices.Protocols.ErrorResponseException' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.DirectoryServices.Protocols.ExtendedRequest.ToXmlNode(System.Xml.XmlDocument)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.DirectoryServices.Protocols.ModifyDNRequest.ToXmlNode(System.Xml.XmlDocument)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.DirectoryServices.Protocols.ModifyRequest.ToXmlNode(System.Xml.XmlDocument)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.DirectoryServices.Protocols.SearchRequest..ctor(System.String, System.Xml.XmlDocument, System.DirectoryServices.Protocols.SearchScope, System.String[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.DirectoryServices.Protocols.SearchRequest.ToXmlNode(System.Xml.XmlDocument)' does not exist in the implementation but it does exist in the contract. -Compat issues with assembly System.Drawing: -CannotMakeTypeAbstract : Type 'System.Drawing.ColorTranslator' is abstract in the implementation but is not abstract in the contract. -TypesMustExist : Type 'System.Drawing.FontConverter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Drawing.IconConverter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Drawing.ImageConverter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Drawing.ImageFormatConverter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Drawing.Design.IPropertyValueUIService' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Drawing.Design.IToolboxItemProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Drawing.Design.IToolboxService' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Drawing.Design.IToolboxUser' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Drawing.Design.PaintValueEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Drawing.Design.PropertyValueUIHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Drawing.Design.PropertyValueUIItem' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Drawing.Design.PropertyValueUIItemInvokeHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Drawing.Design.ToolboxComponentsCreatedEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Drawing.Design.ToolboxComponentsCreatedEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Drawing.Design.ToolboxComponentsCreatingEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Drawing.Design.ToolboxComponentsCreatingEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Drawing.Design.ToolboxItem' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Drawing.Design.ToolboxItemCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Drawing.Design.ToolboxItemCreatorCallback' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Drawing.Design.UITypeEditor' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Drawing.Design.UITypeEditorEditStyle' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Drawing.Printing.MarginsConverter' does not exist in the implementation but it does exist in the contract. -Compat issues with assembly System.Net: -TypesMustExist : Type 'System.Net.INetworkProgress' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.IPEndPointCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.IUnsafeWebRequestCreate' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.NetworkProgressChangedEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.UiSynchronizationContext' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.Cloud' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.CloudCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.PeerName' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.PeerNameRecord' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.PeerNameRecordCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.PeerNameRegistration' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.PeerNameResolver' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.PeerNameType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.PeerToPeerException' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.ResolveCompletedEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.ResolveProgressChangedEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.Collaboration.ApplicationChangedEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.Collaboration.ContactManager' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.Collaboration.CreateContactCompletedEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.Collaboration.InviteCompletedEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.Collaboration.NameChangedEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.Collaboration.ObjectChangedEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.Collaboration.Peer' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.Collaboration.PeerApplication' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.Collaboration.PeerApplicationCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.Collaboration.PeerApplicationLaunchInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.Collaboration.PeerApplicationRegistrationType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.Collaboration.PeerChangeType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.Collaboration.PeerCollaboration' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.Collaboration.PeerContact' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.Collaboration.PeerContactCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.Collaboration.PeerEndPoint' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.Collaboration.PeerEndPointCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.Collaboration.PeerInvitationResponse' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.Collaboration.PeerInvitationResponseType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.Collaboration.PeerNearMe' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.Collaboration.PeerNearMeChangedEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.Collaboration.PeerNearMeCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.Collaboration.PeerObject' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.Collaboration.PeerObjectCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.Collaboration.PeerPresenceInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.Collaboration.PeerPresenceStatus' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.Collaboration.PeerScope' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.Collaboration.PresenceChangedEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.Collaboration.RefreshDataCompletedEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.Collaboration.SubscribeCompletedEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.Collaboration.SubscriptionListChangedEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.PeerToPeer.Collaboration.SubscriptionType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Sockets.HttpPolicyDownloaderProtocol' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Sockets.SecurityCriticalAction' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Sockets.SocketPolicy' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Sockets.UdpAnySourceMulticastClient' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Sockets.UdpSingleSourceMulticastClient' does not exist in the implementation but it does exist in the contract. -Compat issues with assembly System.Runtime.Serialization: -TypesMustExist : Type 'System.Runtime.Serialization.IDataContractSurrogate' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Serialization.ImportOptions' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Serialization.NetDataContractSerializer' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Serialization.XsdDataContractImporter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Serialization.Configuration.DataContractSerializerSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Serialization.Configuration.DeclaredTypeElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Serialization.Configuration.DeclaredTypeElementCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Serialization.Configuration.NetDataContractSerializerSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Serialization.Configuration.ParameterElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Serialization.Configuration.ParameterElementCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Serialization.Configuration.SerializationSectionGroup' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Serialization.Configuration.TypeElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.Serialization.Configuration.TypeElementCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Xml.IXmlMtomReaderInitializer' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Xml.IXmlMtomWriterInitializer' does not exist in the implementation but it does exist in the contract. -Compat issues with assembly System.Security: -TypesMustExist : Type 'System.Security.Cryptography.DataProtector' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Cryptography.DpapiDataProtector' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Cryptography.MemoryProtectionScope' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Cryptography.ProtectedMemory' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.Pkcs.AlgorithmIdentifier.Parameters.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.Pkcs.AlgorithmIdentifier.Parameters.set(System.Byte[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.Pkcs.EnvelopedCms..ctor(System.Security.Cryptography.Pkcs.SubjectIdentifierType, System.Security.Cryptography.Pkcs.ContentInfo)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.Pkcs.EnvelopedCms..ctor(System.Security.Cryptography.Pkcs.SubjectIdentifierType, System.Security.Cryptography.Pkcs.ContentInfo, System.Security.Cryptography.Pkcs.AlgorithmIdentifier)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.Pkcs.EnvelopedCms.Encrypt()' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Cryptography.Pkcs.KeyAgreeKeyChoice' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Cryptography.X509Certificates.X509Certificate2UI' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Cryptography.X509Certificates.X509SelectionFlag' does not exist in the implementation but it does exist in the contract. -Compat issues with assembly System.ServiceModel.Web: -TypesMustExist : Type 'System.ServiceModel.WebHttpBinding' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.WebHttpSecurity' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.WebHttpSecurityMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Activation.WebScriptServiceHostFactory' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Activation.WebServiceHostFactory' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Channels.JavascriptCallbackResponseMessageProperty' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Channels.StreamBodyWriter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Channels.WebBodyFormatMessageProperty' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Channels.WebContentFormat' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Channels.WebContentTypeMapper' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Channels.WebMessageEncodingBindingElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Configuration.WebHttpBindingCollectionElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Configuration.WebHttpBindingElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Configuration.WebHttpElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Configuration.WebHttpEndpointCollectionElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Configuration.WebHttpEndpointElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Configuration.WebHttpSecurityElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Configuration.WebMessageEncodingElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Configuration.WebScriptEnablingElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Configuration.WebScriptEndpointCollectionElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Configuration.WebScriptEndpointElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Description.JsonFaultDetail' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Description.WebHttpBehavior' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Description.WebHttpEndpoint' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Description.WebScriptEnablingBehavior' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Description.WebScriptEndpoint' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Description.WebServiceEndpoint' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Dispatcher.JsonQueryStringConverter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Dispatcher.QueryStringConverter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Dispatcher.WebHttpDispatchOperationSelector' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Web.AspNetCacheProfileAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Web.IncomingWebRequestContext' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Web.IncomingWebResponseContext' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Web.JavascriptCallbackBehaviorAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Web.OutgoingWebRequestContext' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Web.OutgoingWebResponseContext' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Web.WebChannelFactory' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Web.WebFaultException' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Web.WebFaultException' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Web.WebGetAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Web.WebInvokeAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Web.WebMessageBodyStyle' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Web.WebMessageFormat' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Web.WebOperationContext' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ServiceModel.Web.WebServiceHost' does not exist in the implementation but it does exist in the contract. -Compat issues with assembly System.ServiceProcess: -TypesMustExist : Type 'System.ServiceProcess.ServiceAccount' does not exist in the implementation but it does exist in the contract. -Compat issues with assembly System.Transactions: -TypesMustExist : Type 'System.Transactions.Configuration.DefaultSettingsSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Transactions.Configuration.MachineSettingsSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Transactions.Configuration.TransactionsSectionGroup' does not exist in the implementation but it does exist in the contract. -Compat issues with assembly System.Xml: -TypesMustExist : Type 'System.Xml.XmlXapResolver' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Xml.Serialization.CodeExporter' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Serialization.SchemaImporter.Extensions.get()' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Xml.Serialization.SoapCodeExporter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Xml.Serialization.SoapSchemaExporter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Xml.Serialization.SoapSchemaImporter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Xml.Serialization.XmlCodeExporter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Xml.Serialization.Advanced.SchemaImporterExtension' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Xml.Serialization.Advanced.SchemaImporterExtensionCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Xml.Serialization.Configuration.DateTimeSerializationSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Xml.Serialization.Configuration.RootedPathValidator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Xml.Serialization.Configuration.SchemaImporterExtensionElement' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Xml.Serialization.Configuration.SchemaImporterExtensionElementCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Xml.Serialization.Configuration.SchemaImporterExtensionsSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Xml.Serialization.Configuration.SerializationSectionGroup' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Xml.Serialization.Configuration.XmlSerializerSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Xml.XmlConfiguration.XmlReaderSection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Xml.XmlConfiguration.XsltConfigSection' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Xsl.XslCompiledTransform.TemporaryFiles.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Xsl.XslTransform.Load(System.Xml.XPath.XPathNavigator, System.Xml.XmlResolver, System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract. -Compat issues with assembly WindowsBase: -TypesMustExist : Type 'System.Collections.Specialized.CollectionChangedEventManager' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ComponentModel.CurrentChangedEventManager' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ComponentModel.CurrentChangingEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ComponentModel.CurrentChangingEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ComponentModel.CurrentChangingEventManager' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ComponentModel.DependencyPropertyDescriptor' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ComponentModel.ErrorsChangedEventManager' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ComponentModel.GroupDescription' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ComponentModel.ICollectionView' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ComponentModel.ICollectionViewFactory' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ComponentModel.ICollectionViewLiveShaping' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ComponentModel.IEditableCollectionView' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ComponentModel.IEditableCollectionViewAddNewItem' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ComponentModel.IItemProperties' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ComponentModel.ItemPropertyInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ComponentModel.NewItemPlaceholderPosition' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ComponentModel.PropertyChangedEventManager' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ComponentModel.PropertyFilterAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ComponentModel.PropertyFilterOptions' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ComponentModel.SortDescription' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ComponentModel.SortDescriptionCollection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.PresentationTraceLevel' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.PresentationTraceSources' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.IO.Packaging.CertificateEmbeddingOption' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.IO.Packaging.EncryptedPackageEnvelope' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.IO.Packaging.InvalidSignatureEventHandler' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Packaging.Package..ctor(System.IO.FileAccess, System.Boolean)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.IO.Packaging.PackageDigitalSignature' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.IO.Packaging.PackageDigitalSignatureManager' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Packaging.PackUriHelper.ComparePackUri(System.Uri, System.Uri)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Packaging.PackUriHelper.Create(System.Uri)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Packaging.PackUriHelper.Create(System.Uri, System.Uri)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Packaging.PackUriHelper.Create(System.Uri, System.Uri, System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Packaging.PackUriHelper.GetPackageUri(System.Uri)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Packaging.PackUriHelper.GetPartUri(System.Uri)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.IO.Packaging.RightsManagementInformation' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.IO.Packaging.SignatureVerificationEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.IO.Packaging.StorageInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.IO.Packaging.StreamInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.IO.Packaging.VerifyResult' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Permissions.MediaPermission' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Permissions.MediaPermissionAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Permissions.MediaPermissionAudio' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Permissions.MediaPermissionImage' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Permissions.MediaPermissionVideo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Permissions.WebBrowserPermission' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Permissions.WebBrowserPermissionAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Permissions.WebBrowserPermissionLevel' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.RightsManagement.AuthenticationType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.RightsManagement.ContentGrant' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.RightsManagement.ContentRight' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.RightsManagement.ContentUser' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.RightsManagement.CryptoProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.RightsManagement.LocalizedNameDescriptionPair' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.RightsManagement.PublishLicense' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.RightsManagement.RightsManagementException' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.RightsManagement.RightsManagementFailureCode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.RightsManagement.SecureEnvironment' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.RightsManagement.UnsignedPublishLicense' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.RightsManagement.UseLicense' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.RightsManagement.UserActivationMode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.AttachedPropertyBrowsableAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.AttachedPropertyBrowsableForTypeAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.AttachedPropertyBrowsableWhenAttributePresentAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.BaseCompatibilityPreferences' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.CoerceValueCallback' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.DependencyObject' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.DependencyObjectType' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.DependencyProperty' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.DependencyPropertyChangedEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.DependencyPropertyChangedEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.DependencyPropertyKey' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Expression' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.ExpressionConverter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Freezable' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Int32Rect' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Int32RectConverter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.IWeakEventListener' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.LocalValueEntry' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.LocalValueEnumerator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.NameScope' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Point' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.PointConverter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.PropertyChangedCallback' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.PropertyMetadata' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Rect' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.RectConverter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Size' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.SizeConverter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.SplashScreen' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.ValidateValueCallback' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Vector' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.VectorConverter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.WeakEventManager' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.WeakEventManager' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Converters.Int32RectValueSerializer' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Converters.PointValueSerializer' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Converters.RectValueSerializer' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Converters.SizeValueSerializer' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Converters.VectorValueSerializer' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Data.DataSourceProvider' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Input.FocusNavigationDirection' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Input.Key' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Input.KeyConverter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Input.KeyInterop' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Input.KeyValueSerializer' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Input.ModifierKeys' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Input.ModifierKeysConverter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Input.ModifierKeysValueSerializer' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Input.TraversalRequest' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Interop.ComponentDispatcher' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Interop.IKeyboardInputSink' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Interop.IKeyboardInputSite' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Interop.MSG' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Interop.ThreadMessageEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Markup.DesignerSerializationOptions' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Markup.DesignerSerializationOptionsAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Markup.InternalTypeHelper' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Markup.IReceiveMarkupExtension' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Markup.ServiceProviders' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Markup.Primitives.MarkupObject' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Markup.Primitives.MarkupProperty' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Media.DisableDpiAwarenessAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Media.Matrix' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Media.MatrixConverter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Media.Converters.MatrixValueSerializer' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Threading.Dispatcher' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Threading.DispatcherEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Threading.DispatcherFrame' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Threading.DispatcherHookEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Threading.DispatcherHookEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Threading.DispatcherHooks' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Threading.DispatcherObject' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Threading.DispatcherOperation' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Threading.DispatcherOperation' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Threading.DispatcherOperationCallback' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Threading.DispatcherOperationStatus' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Threading.DispatcherPriority' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Threading.DispatcherPriorityAwaitable' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Threading.DispatcherPriorityAwaiter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Threading.DispatcherProcessingDisabled' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Threading.DispatcherSynchronizationContext' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Threading.DispatcherTimer' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Threading.DispatcherUnhandledExceptionEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Threading.DispatcherUnhandledExceptionEventHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Threading.DispatcherUnhandledExceptionFilterEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Windows.Threading.DispatcherUnhandledExceptionFilterEventHandler' does not exist in the implementation but it does exist in the contract. -Total Issues: 633 diff --git a/src/libraries/shims/ApiCompatBaseline.netfx.netstandard.txt b/src/libraries/shims/ApiCompatBaseline.netfx.netstandard.txt deleted file mode 100644 index e185b0e6f6de75..00000000000000 --- a/src/libraries/shims/ApiCompatBaseline.netfx.netstandard.txt +++ /dev/null @@ -1,102 +0,0 @@ -Compat issues with assembly mscorlib: -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinAccountReadonlyControllersSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinApplicationPackageAuthoritySid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinBuiltinAnyPackageSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinBuiltinCertSvcDComAccessGroup' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinBuiltinCryptoOperatorsSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinBuiltinDCOMUsersSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinBuiltinEventLogReadersGroup' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinBuiltinIUsersSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinCacheablePrincipalsGroupSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinCapabilityDocumentsLibrarySid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinCapabilityEnterpriseAuthenticationSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinCapabilityInternetClientServerSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinCapabilityInternetClientSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinCapabilityMusicLibrarySid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinCapabilityPicturesLibrarySid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinCapabilityPrivateNetworkClientServerSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinCapabilityRemovableStorageSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinCapabilitySharedUserCertificatesSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinCapabilityVideosLibrarySid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinConsoleLogonSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinCreatorOwnerRightsSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinEnterpriseReadonlyControllersSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinHighLabelSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinIUserSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinLocalLogonSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinLowLabelSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinMediumLabelSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinMediumPlusLabelSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinNewEnterpriseReadonlyControllersSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinNonCacheablePrincipalsGroupSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinSystemLabelSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinThisOrganizationCertificateSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinUntrustedLabelSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinWriteRestrictedCodeSid' does not exist in the implementation but it does exist in the contract. -Compat issues with assembly System.ComponentModel.Annotations: -CannotChangeAttribute : Attribute 'System.AttributeUsageAttribute' on 'System.ComponentModel.DataAnnotations.DisplayAttribute' changed from '[AttributeUsageAttribute(AttributeTargets.Class | AttributeTargets.Field | AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property, AllowMultiple=false)]' in the contract to '[AttributeUsageAttribute(AttributeTargets.Field | AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property, AllowMultiple=false)]' in the implementation. -MembersMustExist : Member 'System.ComponentModel.DataAnnotations.DisplayFormatAttribute.GetNullDisplayText()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.ComponentModel.DataAnnotations.DisplayFormatAttribute.NullDisplayTextResourceType.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.ComponentModel.DataAnnotations.DisplayFormatAttribute.NullDisplayTextResourceType.set(System.Type)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.ComponentModel.DataAnnotations.RangeAttribute.ConvertValueInInvariantCulture.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.ComponentModel.DataAnnotations.RangeAttribute.ConvertValueInInvariantCulture.set(System.Boolean)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.ComponentModel.DataAnnotations.RangeAttribute.ParseLimitsInInvariantCulture.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.ComponentModel.DataAnnotations.RangeAttribute.ParseLimitsInInvariantCulture.set(System.Boolean)' does not exist in the implementation but it does exist in the contract. -Compat issues with assembly System.ComponentModel.Composition: -TypesMustExist : Type 'System.ComponentModel.Composition.AdaptationConstants' does not exist in the implementation but it does exist in the contract. -Compat issues with assembly System.Configuration.ConfigurationManager: -MembersMustExist : Member 'System.Configuration.Internal.DelegatingConfigHost.HasLocalConfig.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Configuration.Internal.DelegatingConfigHost.HasRoamingConfig.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Configuration.Internal.DelegatingConfigHost.IsAppConfigHttp.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Configuration.Internal.DelegatingConfigHost.RefreshConfigPaths()' does not exist in the implementation but it does exist in the contract. -Compat issues with assembly System.Diagnostics.PerformanceCounter: -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Diagnostics.CounterSample' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.Diagnostics.CounterSample' is marked as readonly in the contract so it must also be marked readonly in the implementation. -Compat issues with assembly System.Security.Cryptography.OpenSsl: -TypesMustExist : Type 'System.Security.Cryptography.DSAOpenSsl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Cryptography.ECDsaOpenSsl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Cryptography.RSAOpenSsl' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Cryptography.SafeEvpPKeyHandle' does not exist in the implementation but it does exist in the contract. -Compat issues with assembly System.Security.Permissions: -MembersMustExist : Member 'System.Security.Permissions.KeyContainerPermissionAccessEntryCollection..ctor()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Permissions.KeyContainerPermissionAccessEntryCollection.CopyTo(System.Array, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Permissions.KeyContainerPermissionAccessEntryEnumerator..ctor()' does not exist in the implementation but it does exist in the contract. -Compat issues with assembly System.Security.Principal.Windows: -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinAccountReadonlyControllersSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinApplicationPackageAuthoritySid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinBuiltinAnyPackageSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinBuiltinCertSvcDComAccessGroup' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinBuiltinCryptoOperatorsSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinBuiltinDCOMUsersSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinBuiltinEventLogReadersGroup' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinBuiltinIUsersSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinCacheablePrincipalsGroupSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinCapabilityDocumentsLibrarySid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinCapabilityEnterpriseAuthenticationSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinCapabilityInternetClientServerSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinCapabilityInternetClientSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinCapabilityMusicLibrarySid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinCapabilityPicturesLibrarySid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinCapabilityPrivateNetworkClientServerSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinCapabilityRemovableStorageSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinCapabilitySharedUserCertificatesSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinCapabilityVideosLibrarySid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinConsoleLogonSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinCreatorOwnerRightsSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinEnterpriseReadonlyControllersSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinHighLabelSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinIUserSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinLocalLogonSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinLowLabelSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinMediumLabelSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinMediumPlusLabelSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinNewEnterpriseReadonlyControllersSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinNonCacheablePrincipalsGroupSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinSystemLabelSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinThisOrganizationCertificateSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinUntrustedLabelSid' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Principal.WellKnownSidType System.Security.Principal.WellKnownSidType.WinWriteRestrictedCodeSid' does not exist in the implementation but it does exist in the contract. -Compat issues with assembly System.ServiceProcess.ServiceController: -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.ServiceProcess.SessionChangeDescription' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.ServiceProcess.SessionChangeDescription' is marked as readonly in the contract so it must also be marked readonly in the implementation. -Total Issues: 92 diff --git a/src/libraries/shims/ApiCompatBaseline.netfx.netstandardOnly.txt b/src/libraries/shims/ApiCompatBaseline.netfx.netstandardOnly.txt deleted file mode 100644 index f68769e14f0810..00000000000000 --- a/src/libraries/shims/ApiCompatBaseline.netfx.netstandardOnly.txt +++ /dev/null @@ -1,870 +0,0 @@ -Compat issues with assembly netstandard: -MembersMustExist : Member 'System.Array.Fill(T[], T)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Array.Fill(T[], T, System.Int32, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Array.Reverse(T[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Array.Reverse(T[], System.Int32, System.Int32)' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.ArraySegment' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.ArraySegment' is marked as readonly in the contract so it must also be marked readonly in the implementation. -MembersMustExist : Member 'System.ArraySegment.CopyTo(System.ArraySegment)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.ArraySegment.CopyTo(T[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.ArraySegment.CopyTo(T[], System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.ArraySegment.Empty.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.ArraySegment.GetEnumerator()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.ArraySegment.Item.get(System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.ArraySegment.Item.set(System.Int32, T)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.ArraySegment.op_Implicit(T[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.ArraySegment.Slice(System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.ArraySegment.Slice(System.Int32, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.ArraySegment.ToArray()' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ArraySegment.Enumerator' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.BitConverter.Int32BitsToSingle(System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.BitConverter.SingleToInt32Bits(System.Single)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.BitConverter.ToBoolean(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.BitConverter.ToChar(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.BitConverter.ToDouble(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.BitConverter.ToInt16(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.BitConverter.ToInt32(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.BitConverter.ToInt64(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.BitConverter.ToSingle(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.BitConverter.ToUInt16(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.BitConverter.ToUInt32(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.BitConverter.ToUInt64(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.BitConverter.TryWriteBytes(System.Span, System.Boolean)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.BitConverter.TryWriteBytes(System.Span, System.Char)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.BitConverter.TryWriteBytes(System.Span, System.Double)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.BitConverter.TryWriteBytes(System.Span, System.Int16)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.BitConverter.TryWriteBytes(System.Span, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.BitConverter.TryWriteBytes(System.Span, System.Int64)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.BitConverter.TryWriteBytes(System.Span, System.Single)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.BitConverter.TryWriteBytes(System.Span, System.UInt16)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.BitConverter.TryWriteBytes(System.Span, System.UInt32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.BitConverter.TryWriteBytes(System.Span, System.UInt64)' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Boolean' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.Boolean' is marked as readonly in the contract so it must also be marked readonly in the implementation. -MembersMustExist : Member 'System.Boolean.Parse(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Boolean.TryFormat(System.Span, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Boolean.TryParse(System.ReadOnlySpan, System.Boolean)' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Byte' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.Byte' is marked as readonly in the contract so it must also be marked readonly in the implementation. -MembersMustExist : Member 'System.Byte.Parse(System.ReadOnlySpan, System.Globalization.NumberStyles, System.IFormatProvider)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Byte.TryFormat(System.Span, System.Int32, System.ReadOnlySpan, System.IFormatProvider)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Byte.TryParse(System.ReadOnlySpan, System.Byte)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Byte.TryParse(System.ReadOnlySpan, System.Globalization.NumberStyles, System.IFormatProvider, System.Byte)' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Char' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.Char' is marked as readonly in the contract so it must also be marked readonly in the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.ConsoleKeyInfo' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.ConsoleKeyInfo' is marked as readonly in the contract so it must also be marked readonly in the implementation. -MembersMustExist : Member 'System.Convert.ToBase64String(System.ReadOnlySpan, System.Base64FormattingOptions)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Convert.TryFromBase64Chars(System.ReadOnlySpan, System.Span, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Convert.TryFromBase64String(System.String, System.Span, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Convert.TryToBase64Chars(System.ReadOnlySpan, System.Span, System.Int32, System.Base64FormattingOptions)' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.DateTime' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.DateTime' is marked as readonly in the contract so it must also be marked readonly in the implementation. -MembersMustExist : Member 'System.DateTime System.DateTime.UnixEpoch' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.DateTime.Parse(System.ReadOnlySpan, System.IFormatProvider, System.Globalization.DateTimeStyles)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.DateTime.ParseExact(System.ReadOnlySpan, System.ReadOnlySpan, System.IFormatProvider, System.Globalization.DateTimeStyles)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.DateTime.ParseExact(System.ReadOnlySpan, System.String[], System.IFormatProvider, System.Globalization.DateTimeStyles)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.DateTime.TryFormat(System.Span, System.Int32, System.ReadOnlySpan, System.IFormatProvider)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.DateTime.TryParse(System.ReadOnlySpan, System.DateTime)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.DateTime.TryParse(System.ReadOnlySpan, System.IFormatProvider, System.Globalization.DateTimeStyles, System.DateTime)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.DateTime.TryParseExact(System.ReadOnlySpan, System.ReadOnlySpan, System.IFormatProvider, System.Globalization.DateTimeStyles, System.DateTime)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.DateTime.TryParseExact(System.ReadOnlySpan, System.String[], System.IFormatProvider, System.Globalization.DateTimeStyles, System.DateTime)' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.DateTimeOffset' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.DateTimeOffset' is marked as readonly in the contract so it must also be marked readonly in the implementation. -MembersMustExist : Member 'System.DateTimeOffset System.DateTimeOffset.UnixEpoch' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.DateTimeOffset.Parse(System.ReadOnlySpan, System.IFormatProvider, System.Globalization.DateTimeStyles)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.DateTimeOffset.ParseExact(System.ReadOnlySpan, System.ReadOnlySpan, System.IFormatProvider, System.Globalization.DateTimeStyles)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.DateTimeOffset.ParseExact(System.ReadOnlySpan, System.String[], System.IFormatProvider, System.Globalization.DateTimeStyles)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.DateTimeOffset.TryFormat(System.Span, System.Int32, System.ReadOnlySpan, System.IFormatProvider)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.DateTimeOffset.TryParse(System.ReadOnlySpan, System.DateTimeOffset)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.DateTimeOffset.TryParse(System.ReadOnlySpan, System.IFormatProvider, System.Globalization.DateTimeStyles, System.DateTimeOffset)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.DateTimeOffset.TryParseExact(System.ReadOnlySpan, System.ReadOnlySpan, System.IFormatProvider, System.Globalization.DateTimeStyles, System.DateTimeOffset)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.DateTimeOffset.TryParseExact(System.ReadOnlySpan, System.String[], System.IFormatProvider, System.Globalization.DateTimeStyles, System.DateTimeOffset)' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Decimal' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.Decimal' is marked as readonly in the contract so it must also be marked readonly in the implementation. -MembersMustExist : Member 'System.Decimal.Parse(System.ReadOnlySpan, System.Globalization.NumberStyles, System.IFormatProvider)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Decimal.TryFormat(System.Span, System.Int32, System.ReadOnlySpan, System.IFormatProvider)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Decimal.TryParse(System.ReadOnlySpan, System.Decimal)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Decimal.TryParse(System.ReadOnlySpan, System.Globalization.NumberStyles, System.IFormatProvider, System.Decimal)' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Double' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.Double' is marked as readonly in the contract so it must also be marked readonly in the implementation. -MembersMustExist : Member 'System.Double.IsFinite(System.Double)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Double.IsNegative(System.Double)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Double.IsNormal(System.Double)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Double.IsSubnormal(System.Double)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Double.Parse(System.ReadOnlySpan, System.Globalization.NumberStyles, System.IFormatProvider)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Double.TryFormat(System.Span, System.Int32, System.ReadOnlySpan, System.IFormatProvider)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Double.TryParse(System.ReadOnlySpan, System.Double)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Double.TryParse(System.ReadOnlySpan, System.Globalization.NumberStyles, System.IFormatProvider, System.Double)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Enum.Parse(System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Enum.Parse(System.String, System.Boolean)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Enum.TryParse(System.Type, System.String, System.Boolean, System.Object)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Enum.TryParse(System.Type, System.String, System.Object)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.GC.GetAllocatedBytesForCurrentThread()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Guid..ctor(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Guid.Parse(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Guid.ParseExact(System.ReadOnlySpan, System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Guid.TryFormat(System.Span, System.Int32, System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Guid.TryParse(System.ReadOnlySpan, System.Guid)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Guid.TryParseExact(System.ReadOnlySpan, System.ReadOnlySpan, System.Guid)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Guid.TryWriteBytes(System.Span)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.HashCode' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.IAsyncDisposable' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Index' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Int16' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.Int16' is marked as readonly in the contract so it must also be marked readonly in the implementation. -MembersMustExist : Member 'System.Int16.Parse(System.ReadOnlySpan, System.Globalization.NumberStyles, System.IFormatProvider)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Int16.TryFormat(System.Span, System.Int32, System.ReadOnlySpan, System.IFormatProvider)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Int16.TryParse(System.ReadOnlySpan, System.Globalization.NumberStyles, System.IFormatProvider, System.Int16)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Int16.TryParse(System.ReadOnlySpan, System.Int16)' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Int32' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.Int32' is marked as readonly in the contract so it must also be marked readonly in the implementation. -MembersMustExist : Member 'System.Int32.Parse(System.ReadOnlySpan, System.Globalization.NumberStyles, System.IFormatProvider)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Int32.TryFormat(System.Span, System.Int32, System.ReadOnlySpan, System.IFormatProvider)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Int32.TryParse(System.ReadOnlySpan, System.Globalization.NumberStyles, System.IFormatProvider, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Int32.TryParse(System.ReadOnlySpan, System.Int32)' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Int64' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.Int64' is marked as readonly in the contract so it must also be marked readonly in the implementation. -MembersMustExist : Member 'System.Int64.Parse(System.ReadOnlySpan, System.Globalization.NumberStyles, System.IFormatProvider)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Int64.TryFormat(System.Span, System.Int32, System.ReadOnlySpan, System.IFormatProvider)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Int64.TryParse(System.ReadOnlySpan, System.Globalization.NumberStyles, System.IFormatProvider, System.Int64)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Int64.TryParse(System.ReadOnlySpan, System.Int64)' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.IntPtr' in the contract but not the implementation. -CannotRemoveBaseTypeOrInterface : Type 'System.IntPtr' does not implement interface 'System.IEquatable' in the implementation but it does in the contract. -TypeCannotChangeClassification : Type 'System.IntPtr' is marked as readonly in the contract so it must also be marked readonly in the implementation. -MembersMustExist : Member 'System.Lazy..ctor(T)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Math.Acosh(System.Double)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Math.Asinh(System.Double)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Math.Atanh(System.Double)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Math.Cbrt(System.Double)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Math.Clamp(System.Byte, System.Byte, System.Byte)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Math.Clamp(System.Decimal, System.Decimal, System.Decimal)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Math.Clamp(System.Double, System.Double, System.Double)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Math.Clamp(System.Int16, System.Int16, System.Int16)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Math.Clamp(System.Int32, System.Int32, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Math.Clamp(System.Int64, System.Int64, System.Int64)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Math.Clamp(System.SByte, System.SByte, System.SByte)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Math.Clamp(System.Single, System.Single, System.Single)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Math.Clamp(System.UInt16, System.UInt16, System.UInt16)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Math.Clamp(System.UInt32, System.UInt32, System.UInt32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Math.Clamp(System.UInt64, System.UInt64, System.UInt64)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.MathF' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Memory' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.MemoryExtensions' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Random.NextBytes(System.Span)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Range' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ReadOnlyMemory' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.ReadOnlySpan' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsByRefLikeAttribute' exists on 'System.RuntimeArgumentHandle' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.RuntimeArgumentHandle' is a 'struct' in the implementation but is a 'ref struct' in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.SByte' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.SByte' is marked as readonly in the contract so it must also be marked readonly in the implementation. -MembersMustExist : Member 'System.SByte.Parse(System.ReadOnlySpan, System.Globalization.NumberStyles, System.IFormatProvider)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.SByte.TryFormat(System.Span, System.Int32, System.ReadOnlySpan, System.IFormatProvider)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.SByte.TryParse(System.ReadOnlySpan, System.Globalization.NumberStyles, System.IFormatProvider, System.SByte)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.SByte.TryParse(System.ReadOnlySpan, System.SByte)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.SequencePosition' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Single' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.Single' is marked as readonly in the contract so it must also be marked readonly in the implementation. -MembersMustExist : Member 'System.Single.IsFinite(System.Single)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Single.IsNegative(System.Single)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Single.IsNormal(System.Single)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Single.IsSubnormal(System.Single)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Single.Parse(System.ReadOnlySpan, System.Globalization.NumberStyles, System.IFormatProvider)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Single.TryFormat(System.Span, System.Int32, System.ReadOnlySpan, System.IFormatProvider)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Single.TryParse(System.ReadOnlySpan, System.Globalization.NumberStyles, System.IFormatProvider, System.Single)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Single.TryParse(System.ReadOnlySpan, System.Single)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Span' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.String..ctor(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.String.Chars.get(System.Index)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.String.Chars.get(System.Range)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.String.Contains(System.Char)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.String.Contains(System.Char, System.StringComparison)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.String.Contains(System.String, System.StringComparison)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.String.Create(System.Int32, TState, System.Buffers.SpanAction)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.String.EndsWith(System.Char)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.String.GetHashCode(System.StringComparison)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.String.IndexOf(System.Char, System.StringComparison)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.String.Join(System.Char, System.Object[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.String.Join(System.Char, System.String[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.String.Join(System.Char, System.String[], System.Int32, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.String.Join(System.Char, System.Collections.Generic.IEnumerable)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.String.op_Implicit(System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.String.Replace(System.String, System.String, System.Boolean, System.Globalization.CultureInfo)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.String.Replace(System.String, System.String, System.StringComparison)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.String.Split(System.Char, System.Int32, System.StringSplitOptions)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.String.Split(System.Char, System.StringSplitOptions)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.String.Split(System.String, System.Int32, System.StringSplitOptions)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.String.Split(System.String, System.StringSplitOptions)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.String.StartsWith(System.Char)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.String.Substring(System.Index)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.String.Substring(System.Range)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.String.Trim(System.Char)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.String.TrimEnd()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.String.TrimEnd(System.Char)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.String.TrimStart()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.String.TrimStart(System.Char)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.StringComparer.Create(System.Globalization.CultureInfo, System.Globalization.CompareOptions)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.StringComparer.FromComparison(System.StringComparison)' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.TimeSpan' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.TimeSpan' is marked as readonly in the contract so it must also be marked readonly in the implementation. -MembersMustExist : Member 'System.TimeSpan.Divide(System.Double)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.TimeSpan.Divide(System.TimeSpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.TimeSpan.Multiply(System.Double)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.TimeSpan.op_Division(System.TimeSpan, System.Double)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.TimeSpan.op_Division(System.TimeSpan, System.TimeSpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.TimeSpan.op_Multiply(System.Double, System.TimeSpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.TimeSpan.op_Multiply(System.TimeSpan, System.Double)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.TimeSpan.Parse(System.ReadOnlySpan, System.IFormatProvider)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.TimeSpan.ParseExact(System.ReadOnlySpan, System.ReadOnlySpan, System.IFormatProvider, System.Globalization.TimeSpanStyles)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.TimeSpan.ParseExact(System.ReadOnlySpan, System.String[], System.IFormatProvider, System.Globalization.TimeSpanStyles)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.TimeSpan.TryFormat(System.Span, System.Int32, System.ReadOnlySpan, System.IFormatProvider)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.TimeSpan.TryParse(System.ReadOnlySpan, System.IFormatProvider, System.TimeSpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.TimeSpan.TryParse(System.ReadOnlySpan, System.TimeSpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.TimeSpan.TryParseExact(System.ReadOnlySpan, System.ReadOnlySpan, System.IFormatProvider, System.Globalization.TimeSpanStyles, System.TimeSpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.TimeSpan.TryParseExact(System.ReadOnlySpan, System.ReadOnlySpan, System.IFormatProvider, System.TimeSpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.TimeSpan.TryParseExact(System.ReadOnlySpan, System.String[], System.IFormatProvider, System.Globalization.TimeSpanStyles, System.TimeSpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.TimeSpan.TryParseExact(System.ReadOnlySpan, System.String[], System.IFormatProvider, System.TimeSpan)' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.TimeZoneInfo.TransitionTime' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.TimeZoneInfo.TransitionTime' is marked as readonly in the contract so it must also be marked readonly in the implementation. -MembersMustExist : Member 'System.Type.GetMethod(System.String, System.Int32, System.Reflection.BindingFlags, System.Reflection.Binder, System.Reflection.CallingConventions, System.Type[], System.Reflection.ParameterModifier[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Type.GetMethod(System.String, System.Int32, System.Reflection.BindingFlags, System.Reflection.Binder, System.Type[], System.Reflection.ParameterModifier[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Type.GetMethod(System.String, System.Int32, System.Type[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Type.GetMethod(System.String, System.Int32, System.Type[], System.Reflection.ParameterModifier[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Type.GetMethodImpl(System.String, System.Int32, System.Reflection.BindingFlags, System.Reflection.Binder, System.Reflection.CallingConventions, System.Type[], System.Reflection.ParameterModifier[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Type.IsByRefLike.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Type.IsGenericMethodParameter.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Type.IsGenericTypeParameter.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Type.IsSignatureType.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Type.IsSZArray.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Type.IsTypeDefinition.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Type.IsVariableBoundArray.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Type.MakeGenericMethodParameter(System.Int32)' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsByRefLikeAttribute' exists on 'System.TypedReference' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.TypedReference' is a 'struct' in the implementation but is a 'ref struct' in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.UInt16' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.UInt16' is marked as readonly in the contract so it must also be marked readonly in the implementation. -MembersMustExist : Member 'System.UInt16.Parse(System.ReadOnlySpan, System.Globalization.NumberStyles, System.IFormatProvider)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.UInt16.TryFormat(System.Span, System.Int32, System.ReadOnlySpan, System.IFormatProvider)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.UInt16.TryParse(System.ReadOnlySpan, System.Globalization.NumberStyles, System.IFormatProvider, System.UInt16)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.UInt16.TryParse(System.ReadOnlySpan, System.UInt16)' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.UInt32' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.UInt32' is marked as readonly in the contract so it must also be marked readonly in the implementation. -MembersMustExist : Member 'System.UInt32.Parse(System.ReadOnlySpan, System.Globalization.NumberStyles, System.IFormatProvider)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.UInt32.TryFormat(System.Span, System.Int32, System.ReadOnlySpan, System.IFormatProvider)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.UInt32.TryParse(System.ReadOnlySpan, System.Globalization.NumberStyles, System.IFormatProvider, System.UInt32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.UInt32.TryParse(System.ReadOnlySpan, System.UInt32)' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.UInt64' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.UInt64' is marked as readonly in the contract so it must also be marked readonly in the implementation. -MembersMustExist : Member 'System.UInt64.Parse(System.ReadOnlySpan, System.Globalization.NumberStyles, System.IFormatProvider)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.UInt64.TryFormat(System.Span, System.Int32, System.ReadOnlySpan, System.IFormatProvider)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.UInt64.TryParse(System.ReadOnlySpan, System.Globalization.NumberStyles, System.IFormatProvider, System.UInt64)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.UInt64.TryParse(System.ReadOnlySpan, System.UInt64)' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.UIntPtr' in the contract but not the implementation. -CannotRemoveBaseTypeOrInterface : Type 'System.UIntPtr' does not implement interface 'System.IEquatable' in the implementation but it does in the contract. -TypeCannotChangeClassification : Type 'System.UIntPtr' is marked as readonly in the contract so it must also be marked readonly in the implementation. -MembersMustExist : Member 'System.Version.Parse(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Version.TryFormat(System.Span, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Version.TryFormat(System.Span, System.Int32, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Version.TryParse(System.ReadOnlySpan, System.Version)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Buffers.ArrayPool' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Buffers.BuffersExtensions' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Buffers.IBufferWriter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Buffers.IMemoryOwner' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Buffers.IPinnable' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Buffers.MemoryHandle' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Buffers.MemoryManager' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Buffers.MemoryPool' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Buffers.OperationStatus' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Buffers.ReadOnlySequence' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Buffers.ReadOnlySequenceSegment' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Buffers.ReadOnlySpanAction' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Buffers.SpanAction' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Buffers.StandardFormat' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Buffers.Binary.BinaryPrimitives' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Buffers.Text.Base64' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Buffers.Text.Utf8Formatter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Buffers.Text.Utf8Parser' does not exist in the implementation but it does exist in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.CodeDom.Compiler.IndentedTextWriter' does not implement interface 'System.IAsyncDisposable' in the implementation but it does in the contract. -MembersMustExist : Member 'System.Collections.BitArray.LeftShift(System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Collections.BitArray.RightShift(System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Collections.DictionaryEntry.Deconstruct(System.Object, System.Object)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Collections.Concurrent.ConcurrentBag.Clear()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Collections.Concurrent.ConcurrentQueue.Clear()' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Collections.Generic.CollectionExtensions' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Collections.Generic.Dictionary..ctor(System.Collections.Generic.IEnumerable>)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Collections.Generic.Dictionary..ctor(System.Collections.Generic.IEnumerable>, System.Collections.Generic.IEqualityComparer)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Collections.Generic.Dictionary.EnsureCapacity(System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Collections.Generic.Dictionary.Remove(TKey, TValue)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Collections.Generic.Dictionary.TrimExcess()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Collections.Generic.Dictionary.TrimExcess(System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Collections.Generic.Dictionary.TryAdd(TKey, TValue)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Collections.Generic.HashSet.EnsureCapacity(System.Int32)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Collections.Generic.IAsyncEnumerable' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Collections.Generic.IAsyncEnumerator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Collections.Generic.KeyValuePair' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Collections.Generic.KeyValuePair' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.Collections.Generic.KeyValuePair' is marked as readonly in the contract so it must also be marked readonly in the implementation. -MembersMustExist : Member 'System.Collections.Generic.KeyValuePair.Deconstruct(TKey, TValue)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Collections.Generic.Queue.TryDequeue(T)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Collections.Generic.Queue.TryPeek(T)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Collections.Generic.Stack.TryPeek(T)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Collections.Generic.Stack.TryPop(T)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Collections.ObjectModel.KeyedCollection.TryGetValue(TKey, TItem)' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Collections.Specialized.BitVector32.Section' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.Collections.Specialized.BitVector32.Section' is marked as readonly in the contract so it must also be marked readonly in the implementation. -MembersMustExist : Member 'System.ComponentModel.DefaultValueAttribute..ctor(System.SByte)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.ComponentModel.DefaultValueAttribute..ctor(System.UInt16)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.ComponentModel.DefaultValueAttribute..ctor(System.UInt32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.ComponentModel.DefaultValueAttribute..ctor(System.UInt64)' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.ComponentModel.Design.Serialization.MemberRelationship' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.ComponentModel.Design.Serialization.MemberRelationship' is marked as readonly in the contract so it must also be marked readonly in the implementation. -TypesMustExist : Type 'System.Data.Common.DbProviderFactories' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Diagnostics.ProcessStartInfo.ArgumentList.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Diagnostics.ProcessStartInfo.StandardInputEncoding.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Diagnostics.ProcessStartInfo.StandardInputEncoding.set(System.Text.Encoding)' does not exist in the implementation but it does exist in the contract. -CannotChangeAttribute : Attribute 'System.AttributeUsageAttribute' on 'System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute' changed from '[AttributeUsageAttribute(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Event | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Struct, Inherited=false, AllowMultiple=false)]' in the contract to '[AttributeUsageAttribute(AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Event | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Struct, Inherited=false, AllowMultiple=false)]' in the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Diagnostics.SymbolStore.SymbolToken' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.Diagnostics.SymbolStore.SymbolToken' is marked as readonly in the contract so it must also be marked readonly in the implementation. -CannotRemoveBaseTypeOrInterface : Type 'System.Diagnostics.Tracing.EventCounter' does not implement interface 'System.IDisposable' in the implementation but it does in the contract. -MembersMustExist : Member 'System.Diagnostics.Tracing.EventCounter.Dispose()' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Diagnostics.Tracing.EventSourceCreatedEventArgs' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Drawing.Color' in the contract but not the implementation. -CannotRemoveBaseTypeOrInterface : Type 'System.Drawing.Color' does not implement interface 'System.IEquatable' in the implementation but it does in the contract. -TypeCannotChangeClassification : Type 'System.Drawing.Color' is marked as readonly in the contract so it must also be marked readonly in the implementation. -MembersMustExist : Member 'System.Drawing.Color.Equals(System.Drawing.Color)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Drawing.ColorConverter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Drawing.KnownColor' does not exist in the implementation but it does exist in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Drawing.Point' does not implement interface 'System.IEquatable' in the implementation but it does in the contract. -MembersMustExist : Member 'System.Drawing.Point.Equals(System.Drawing.Point)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Drawing.PointConverter' does not exist in the implementation but it does exist in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Drawing.PointF' does not implement interface 'System.IEquatable' in the implementation but it does in the contract. -MembersMustExist : Member 'System.Drawing.PointF.Equals(System.Drawing.PointF)' does not exist in the implementation but it does exist in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Drawing.Rectangle' does not implement interface 'System.IEquatable' in the implementation but it does in the contract. -MembersMustExist : Member 'System.Drawing.Rectangle.Equals(System.Drawing.Rectangle)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Drawing.RectangleConverter' does not exist in the implementation but it does exist in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Drawing.RectangleF' does not implement interface 'System.IEquatable' in the implementation but it does in the contract. -MembersMustExist : Member 'System.Drawing.RectangleF.Equals(System.Drawing.RectangleF)' does not exist in the implementation but it does exist in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Drawing.Size' does not implement interface 'System.IEquatable' in the implementation but it does in the contract. -MembersMustExist : Member 'System.Drawing.Size.Equals(System.Drawing.Size)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Drawing.Size.op_Division(System.Drawing.Size, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Drawing.Size.op_Division(System.Drawing.Size, System.Single)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Drawing.Size.op_Multiply(System.Drawing.Size, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Drawing.Size.op_Multiply(System.Drawing.Size, System.Single)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Drawing.Size.op_Multiply(System.Int32, System.Drawing.Size)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Drawing.Size.op_Multiply(System.Single, System.Drawing.Size)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Drawing.SizeConverter' does not exist in the implementation but it does exist in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Drawing.SizeF' does not implement interface 'System.IEquatable' in the implementation but it does in the contract. -MembersMustExist : Member 'System.Drawing.SizeF.Equals(System.Drawing.SizeF)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Drawing.SizeF.op_Division(System.Drawing.SizeF, System.Single)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Drawing.SizeF.op_Multiply(System.Drawing.SizeF, System.Single)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Drawing.SizeF.op_Multiply(System.Single, System.Drawing.SizeF)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Drawing.SizeFConverter' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Globalization.CharUnicodeInfo.GetUnicodeCategory(System.Int32)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Globalization.ISOWeek' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.BinaryReader.Read(System.Span)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.BinaryReader.Read(System.Span)' does not exist in the implementation but it does exist in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.IO.BinaryWriter' does not implement interface 'System.IAsyncDisposable' in the implementation but it does in the contract. -MembersMustExist : Member 'System.IO.BinaryWriter.DisposeAsync()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.BinaryWriter.Write(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.BinaryWriter.Write(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.IO.BufferedStream' does not implement interface 'System.IAsyncDisposable' in the implementation but it does in the contract. -MembersMustExist : Member 'System.IO.BufferedStream.BufferSize.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.BufferedStream.DisposeAsync()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.BufferedStream.UnderlyingStream.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Directory.EnumerateDirectories(System.String, System.String, System.IO.EnumerationOptions)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Directory.EnumerateFiles(System.String, System.String, System.IO.EnumerationOptions)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Directory.EnumerateFileSystemEntries(System.String, System.String, System.IO.EnumerationOptions)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Directory.GetDirectories(System.String, System.String, System.IO.EnumerationOptions)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Directory.GetFiles(System.String, System.String, System.IO.EnumerationOptions)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Directory.GetFileSystemEntries(System.String, System.String, System.IO.EnumerationOptions)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.DirectoryInfo.EnumerateDirectories(System.String, System.IO.EnumerationOptions)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.DirectoryInfo.EnumerateFiles(System.String, System.IO.EnumerationOptions)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.DirectoryInfo.EnumerateFileSystemInfos(System.String, System.IO.EnumerationOptions)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.DirectoryInfo.GetDirectories(System.String, System.IO.EnumerationOptions)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.DirectoryInfo.GetFiles(System.String, System.IO.EnumerationOptions)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.DirectoryInfo.GetFileSystemInfos(System.String, System.IO.EnumerationOptions)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.IO.EnumerationOptions' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.File.AppendAllLinesAsync(System.String, System.Collections.Generic.IEnumerable, System.Text.Encoding, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.File.AppendAllLinesAsync(System.String, System.Collections.Generic.IEnumerable, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.File.AppendAllTextAsync(System.String, System.String, System.Text.Encoding, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.File.AppendAllTextAsync(System.String, System.String, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.File.ReadAllBytesAsync(System.String, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.File.ReadAllLinesAsync(System.String, System.Text.Encoding, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.File.ReadAllLinesAsync(System.String, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.File.ReadAllTextAsync(System.String, System.Text.Encoding, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.File.ReadAllTextAsync(System.String, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.File.WriteAllBytesAsync(System.String, System.Byte[], System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.File.WriteAllLinesAsync(System.String, System.Collections.Generic.IEnumerable, System.Text.Encoding, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.File.WriteAllLinesAsync(System.String, System.Collections.Generic.IEnumerable, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.File.WriteAllTextAsync(System.String, System.String, System.Text.Encoding, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.File.WriteAllTextAsync(System.String, System.String, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.IO.FileStream' does not implement interface 'System.IAsyncDisposable' in the implementation but it does in the contract. -CannotMakeMemberNonVirtual : Member 'System.IO.FileStream.Name' is non-virtual in the implementation but is virtual in the contract. -MembersMustExist : Member 'System.IO.FileStream.DisposeAsync()' does not exist in the implementation but it does exist in the contract. -CannotMakeMemberNonVirtual : Member 'System.IO.FileStream.Name.get()' is non-virtual in the implementation but is virtual in the contract. -TypesMustExist : Type 'System.IO.MatchCasing' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.IO.MatchType' does not exist in the implementation but it does exist in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.IO.MemoryStream' does not implement interface 'System.IAsyncDisposable' in the implementation but it does in the contract. -MembersMustExist : Member 'System.IO.MemoryStream.Read(System.Span)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.MemoryStream.ReadAsync(System.Memory, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.MemoryStream.Write(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.MemoryStream.WriteAsync(System.ReadOnlyMemory, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Path.GetDirectoryName(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Path.GetExtension(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Path.GetFileName(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Path.GetFileNameWithoutExtension(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Path.GetFullPath(System.String, System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Path.GetPathRoot(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Path.GetRelativePath(System.String, System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Path.HasExtension(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Path.IsPathFullyQualified(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Path.IsPathFullyQualified(System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Path.IsPathRooted(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Path.Join(System.ReadOnlySpan, System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Path.Join(System.ReadOnlySpan, System.ReadOnlySpan, System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Path.TryJoin(System.ReadOnlySpan, System.ReadOnlySpan, System.ReadOnlySpan, System.Span, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Path.TryJoin(System.ReadOnlySpan, System.ReadOnlySpan, System.Span, System.Int32)' does not exist in the implementation but it does exist in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.IO.Stream' does not implement interface 'System.IAsyncDisposable' in the implementation but it does in the contract. -CannotMakeMemberNonVirtual : Member 'System.IO.Stream.CopyTo(System.IO.Stream, System.Int32)' is non-virtual in the implementation but is virtual in the contract. -MembersMustExist : Member 'System.IO.Stream.CopyToAsync(System.IO.Stream, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Stream.DisposeAsync()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Stream.Read(System.Span)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Stream.ReadAsync(System.Memory, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Stream.Write(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Stream.WriteAsync(System.ReadOnlyMemory, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.StreamReader.Read(System.Span)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.StreamReader.ReadAsync(System.Memory, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.StreamReader.ReadBlock(System.Span)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.StreamReader.ReadBlockAsync(System.Memory, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.IO.StreamWriter' does not implement interface 'System.IAsyncDisposable' in the implementation but it does in the contract. -MembersMustExist : Member 'System.IO.StreamWriter.DisposeAsync()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.StreamWriter.Write(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.StreamWriter.WriteAsync(System.ReadOnlyMemory, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.StreamWriter.WriteLine(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.StreamWriter.WriteLineAsync(System.ReadOnlyMemory, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.StringReader.Read(System.Span)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.StringReader.ReadAsync(System.Memory, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.StringReader.ReadBlock(System.Span)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.StringReader.ReadBlockAsync(System.Memory, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.IO.StringWriter' does not implement interface 'System.IAsyncDisposable' in the implementation but it does in the contract. -MembersMustExist : Member 'System.IO.StringWriter.Write(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.StringWriter.WriteAsync(System.ReadOnlyMemory, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.StringWriter.WriteLine(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.StringWriter.WriteLineAsync(System.ReadOnlyMemory, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.TextReader.Read(System.Span)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.TextReader.ReadAsync(System.Memory, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.TextReader.ReadBlock(System.Span)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.TextReader.ReadBlockAsync(System.Memory, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.IO.TextWriter' does not implement interface 'System.IAsyncDisposable' in the implementation but it does in the contract. -MembersMustExist : Member 'System.IO.TextWriter.DisposeAsync()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.TextWriter.Write(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.TextWriter.WriteAsync(System.ReadOnlyMemory, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.TextWriter.WriteLine(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.TextWriter.WriteLineAsync(System.ReadOnlyMemory, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.IO.UnmanagedMemoryStream' does not implement interface 'System.IAsyncDisposable' in the implementation but it does in the contract. -MembersMustExist : Member 'System.IO.UnmanagedMemoryStream.Read(System.Span)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.UnmanagedMemoryStream.Write(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.IO.Compression.BrotliDecoder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.IO.Compression.BrotliEncoder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.IO.Compression.BrotliStream' does not exist in the implementation but it does exist in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.IO.Compression.DeflateStream' does not implement interface 'System.IAsyncDisposable' in the implementation but it does in the contract. -MembersMustExist : Member 'System.IO.Compression.DeflateStream.DisposeAsync()' does not exist in the implementation but it does exist in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.IO.Compression.GZipStream' does not implement interface 'System.IAsyncDisposable' in the implementation but it does in the contract. -MembersMustExist : Member 'System.IO.Compression.GZipStream.DisposeAsync()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Compression.ZipArchiveEntry.Crc32.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Compression.ZipFile.ExtractToDirectory(System.String, System.String, System.Boolean)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Compression.ZipFile.ExtractToDirectory(System.String, System.String, System.Text.Encoding, System.Boolean)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.IO.Compression.ZipFileExtensions.ExtractToDirectory(System.IO.Compression.ZipArchive, System.String, System.Boolean)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.IO.Enumeration.FileSystemEntry' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.IO.Enumeration.FileSystemEnumerable' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.IO.Enumeration.FileSystemEnumerator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.IO.Enumeration.FileSystemName' does not exist in the implementation but it does exist in the contract. -CannotAddAbstractMembers : Member 'System.IO.IsolatedStorage.IsolatedStorage.GetPermission(System.Security.PermissionSet)' is abstract in the implementation but is missing in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.IO.IsolatedStorage.IsolatedStorageFileStream' does not implement interface 'System.IAsyncDisposable' in the implementation but it does in the contract. -MembersMustExist : Member 'System.IO.IsolatedStorage.IsolatedStorageFileStream.DisposeAsync()' does not exist in the implementation but it does exist in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.IO.MemoryMappedFiles.MemoryMappedViewStream' does not implement interface 'System.IAsyncDisposable' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.IO.Pipes.AnonymousPipeClientStream' does not implement interface 'System.IAsyncDisposable' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.IO.Pipes.AnonymousPipeServerStream' does not implement interface 'System.IAsyncDisposable' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.IO.Pipes.NamedPipeClientStream' does not implement interface 'System.IAsyncDisposable' in the implementation but it does in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.IO.Pipes.NamedPipeServerStream' does not implement interface 'System.IAsyncDisposable' in the implementation but it does in the contract. -MembersMustExist : Member 'System.IO.Pipes.PipeOptions System.IO.Pipes.PipeOptions.CurrentUserOnly' does not exist in the implementation but it does exist in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.IO.Pipes.PipeStream' does not implement interface 'System.IAsyncDisposable' in the implementation but it does in the contract. -MembersMustExist : Member 'System.Linq.Enumerable.SkipLast(System.Collections.Generic.IEnumerable, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Linq.Enumerable.TakeLast(System.Collections.Generic.IEnumerable, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Linq.Queryable.Append(System.Linq.IQueryable, TSource)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Linq.Queryable.Prepend(System.Linq.IQueryable, TSource)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Linq.Queryable.SkipLast(System.Linq.IQueryable, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Linq.Queryable.TakeLast(System.Linq.IQueryable, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.HttpStatusCode System.Net.HttpStatusCode.AlreadyReported' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.HttpStatusCode System.Net.HttpStatusCode.EarlyHints' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.HttpStatusCode System.Net.HttpStatusCode.FailedDependency' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.HttpStatusCode System.Net.HttpStatusCode.IMUsed' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.HttpStatusCode System.Net.HttpStatusCode.InsufficientStorage' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.HttpStatusCode System.Net.HttpStatusCode.Locked' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.HttpStatusCode System.Net.HttpStatusCode.LoopDetected' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.HttpStatusCode System.Net.HttpStatusCode.MisdirectedRequest' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.HttpStatusCode System.Net.HttpStatusCode.MultiStatus' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.HttpStatusCode System.Net.HttpStatusCode.NetworkAuthenticationRequired' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.HttpStatusCode System.Net.HttpStatusCode.NotExtended' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.HttpStatusCode System.Net.HttpStatusCode.PermanentRedirect' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.HttpStatusCode System.Net.HttpStatusCode.PreconditionRequired' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.HttpStatusCode System.Net.HttpStatusCode.Processing' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.HttpStatusCode System.Net.HttpStatusCode.RequestHeaderFieldsTooLarge' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.HttpStatusCode System.Net.HttpStatusCode.TooManyRequests' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.HttpStatusCode System.Net.HttpStatusCode.UnavailableForLegalReasons' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.HttpStatusCode System.Net.HttpStatusCode.UnprocessableEntity' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.HttpStatusCode System.Net.HttpStatusCode.VariantAlsoNegotiates' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Version System.Net.HttpVersion.Unknown' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Version System.Net.HttpVersion.Version20' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.IPAddress..ctor(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.IPAddress..ctor(System.ReadOnlySpan, System.Int64)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.IPAddress.Parse(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.IPAddress.TryFormat(System.Span, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.IPAddress.TryParse(System.ReadOnlySpan, System.Net.IPAddress)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.IPAddress.TryWriteBytes(System.Span, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.Http.HttpClient.PatchAsync(System.String, System.Net.Http.HttpContent)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.Http.HttpClient.PatchAsync(System.String, System.Net.Http.HttpContent, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.Http.HttpClient.PatchAsync(System.Uri, System.Net.Http.HttpContent)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.Http.HttpClient.PatchAsync(System.Uri, System.Net.Http.HttpContent, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.Http.HttpMethod.Patch.get()' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Http.ReadOnlyMemoryContent' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.String System.Net.Mime.MediaTypeNames.Application.Json' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.String System.Net.Mime.MediaTypeNames.Application.Xml' does not exist in the implementation but it does exist in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Net.Security.AuthenticatedStream' does not implement interface 'System.IAsyncDisposable' in the implementation but it does in the contract. -MembersMustExist : Member 'System.Net.Security.AuthenticatedStream.DisposeAsync()' does not exist in the implementation but it does exist in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Net.Security.NegotiateStream' does not implement interface 'System.IAsyncDisposable' in the implementation but it does in the contract. -MembersMustExist : Member 'System.Net.Security.NegotiateStream.DisposeAsync()' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Security.ServerCertificateSelectionCallback' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Security.SslApplicationProtocol' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Security.SslClientAuthenticationOptions' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Security.SslServerAuthenticationOptions' does not exist in the implementation but it does exist in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Net.Security.SslStream' does not implement interface 'System.IAsyncDisposable' in the implementation but it does in the contract. -MembersMustExist : Member 'System.Net.Security.SslStream.AuthenticateAsClientAsync(System.Net.Security.SslClientAuthenticationOptions, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.Security.SslStream.AuthenticateAsServerAsync(System.Net.Security.SslServerAuthenticationOptions, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.Security.SslStream.DisposeAsync()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.Security.SslStream.NegotiatedApplicationProtocol.get()' does not exist in the implementation but it does exist in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Net.Sockets.NetworkStream' does not implement interface 'System.IAsyncDisposable' in the implementation but it does in the contract. -MembersMustExist : Member 'System.Net.Sockets.Socket.Receive(System.Span)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.Sockets.Socket.Receive(System.Span, System.Net.Sockets.SocketFlags)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.Sockets.Socket.Receive(System.Span, System.Net.Sockets.SocketFlags, System.Net.Sockets.SocketError)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.Sockets.Socket.Send(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.Sockets.Socket.Send(System.ReadOnlySpan, System.Net.Sockets.SocketFlags)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.Sockets.Socket.Send(System.ReadOnlySpan, System.Net.Sockets.SocketFlags, System.Net.Sockets.SocketError)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.Sockets.SocketAsyncEventArgs.MemoryBuffer.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.Sockets.SocketAsyncEventArgs.SetBuffer(System.Memory)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.Sockets.SocketTaskExtensions.ReceiveAsync(System.Net.Sockets.Socket, System.Memory, System.Net.Sockets.SocketFlags, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.Sockets.SocketTaskExtensions.SendAsync(System.Net.Sockets.Socket, System.ReadOnlyMemory, System.Net.Sockets.SocketFlags, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.Sockets.UnixDomainSocketEndPoint' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.WebSockets.ClientWebSocketOptions.RemoteCertificateValidationCallback.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.WebSockets.ClientWebSocketOptions.RemoteCertificateValidationCallback.set(System.Net.Security.RemoteCertificateValidationCallback)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Net.WebSockets.ValueWebSocketReceiveResult' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.WebSockets.WebSocket.CreateFromStream(System.IO.Stream, System.Boolean, System.String, System.TimeSpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.WebSockets.WebSocket.ReceiveAsync(System.Memory, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Net.WebSockets.WebSocket.SendAsync(System.ReadOnlyMemory, System.Net.WebSockets.WebSocketMessageType, System.Boolean, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.BigInteger' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.Numerics.BigInteger' is marked as readonly in the contract so it must also be marked readonly in the implementation. -MembersMustExist : Member 'System.Numerics.BigInteger..ctor(System.ReadOnlySpan, System.Boolean, System.Boolean)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Numerics.BigInteger.GetByteCount(System.Boolean)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Numerics.BigInteger.Parse(System.ReadOnlySpan, System.Globalization.NumberStyles, System.IFormatProvider)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Numerics.BigInteger.ToByteArray(System.Boolean, System.Boolean)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Numerics.BigInteger.TryFormat(System.Span, System.Int32, System.ReadOnlySpan, System.IFormatProvider)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Numerics.BigInteger.TryParse(System.ReadOnlySpan, System.Globalization.NumberStyles, System.IFormatProvider, System.Numerics.BigInteger)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Numerics.BigInteger.TryParse(System.ReadOnlySpan, System.Numerics.BigInteger)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Numerics.BigInteger.TryWriteBytes(System.Span, System.Int32, System.Boolean, System.Boolean)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Numerics.Matrix3x2' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Numerics.Matrix4x4' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Numerics.Plane' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Numerics.Quaternion' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Numerics.Vector' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Numerics.Vector' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Numerics.Vector2' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Numerics.Vector3' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Numerics.Vector4' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.Assembly.GetForwardedTypes()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.BindingFlags System.Reflection.BindingFlags.DoNotWrapExceptions' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.DispatchProxy' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.MemberInfo.HasSameMetadataDefinitionAs(System.Reflection.MemberInfo)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.MethodBase.IsConstructedGenericMethod.get()' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Reflection.ParameterModifier' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.Reflection.ParameterModifier' is marked as readonly in the contract so it must also be marked readonly in the implementation. -MembersMustExist : Member 'System.Reflection.TypeDelegator.IsByRefLike.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.TypeDelegator.IsGenericMethodParameter.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.TypeDelegator.IsGenericTypeParameter.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.TypeDelegator.IsSZArray.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.TypeDelegator.IsTypeDefinition.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Reflection.TypeDelegator.IsVariableBoundArray.get()' does not exist in the implementation but it does exist in the contract. -CannotSealType : Type 'System.Reflection.TypeInfo' is effectively (has a private constructor) sealed in the implementation but not sealed in the contract. -MembersMustExist : Member 'System.Reflection.TypeInfo..ctor()' does not exist in the implementation but it does exist in the contract. -CannotMakeMemberNonVirtual : Member 'System.Reflection.TypeInfo.DeclaredConstructors' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'System.Reflection.TypeInfo.DeclaredEvents' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'System.Reflection.TypeInfo.DeclaredFields' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'System.Reflection.TypeInfo.DeclaredMembers' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'System.Reflection.TypeInfo.DeclaredMethods' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'System.Reflection.TypeInfo.DeclaredNestedTypes' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'System.Reflection.TypeInfo.DeclaredProperties' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'System.Reflection.TypeInfo.GenericTypeParameters' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'System.Reflection.TypeInfo.ImplementedInterfaces' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'System.Reflection.TypeInfo.AsType()' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'System.Reflection.TypeInfo.DeclaredConstructors.get()' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'System.Reflection.TypeInfo.DeclaredEvents.get()' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'System.Reflection.TypeInfo.DeclaredFields.get()' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'System.Reflection.TypeInfo.DeclaredMembers.get()' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'System.Reflection.TypeInfo.DeclaredMethods.get()' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'System.Reflection.TypeInfo.DeclaredNestedTypes.get()' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'System.Reflection.TypeInfo.DeclaredProperties.get()' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'System.Reflection.TypeInfo.GenericTypeParameters.get()' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'System.Reflection.TypeInfo.GetDeclaredEvent(System.String)' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'System.Reflection.TypeInfo.GetDeclaredField(System.String)' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'System.Reflection.TypeInfo.GetDeclaredMethod(System.String)' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'System.Reflection.TypeInfo.GetDeclaredMethods(System.String)' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'System.Reflection.TypeInfo.GetDeclaredNestedType(System.String)' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'System.Reflection.TypeInfo.GetDeclaredProperty(System.String)' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'System.Reflection.TypeInfo.ImplementedInterfaces.get()' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'System.Reflection.TypeInfo.IsAssignableFrom(System.Reflection.TypeInfo)' is non-virtual in the implementation but is virtual in the contract. -TypesMustExist : Type 'System.Reflection.Emit.AssemblyBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.AssemblyBuilderAccess' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.ConstructorBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.CustomAttributeBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.DynamicILInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.DynamicMethod' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.EnumBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.EventBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.EventToken' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.ExceptionHandler' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.FieldBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.FieldToken' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.GenericTypeParameterBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.ILGenerator' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.Label' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.LocalBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.MethodBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.MethodToken' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.ModuleBuilder' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Reflection.Emit.OpCode' in the contract but not the implementation. -CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.Emit.OpCode' does not implement interface 'System.IEquatable' in the implementation but it does in the contract. -TypeCannotChangeClassification : Type 'System.Reflection.Emit.OpCode' is marked as readonly in the contract so it must also be marked readonly in the implementation. -TypesMustExist : Type 'System.Reflection.Emit.ParameterBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.ParameterToken' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.PropertyBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.PropertyToken' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.SignatureHelper' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.SignatureToken' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.StringToken' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.TypeBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Reflection.Emit.TypeToken' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.CompilerServices.AsyncIteratorMethodBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.CompilerServices.AsyncIteratorStateMachineAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.CompilerServices.AsyncMethodBuilderAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder' does not exist in the implementation but it does exist in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.CompilerServices.ConditionalWeakTable' does not implement interface 'System.Collections.Generic.IEnumerable>' in the implementation but it does in the contract. -MembersMustExist : Member 'System.Runtime.CompilerServices.ConditionalWeakTable.AddOrUpdate(TKey, TValue)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.CompilerServices.ConditionalWeakTable.Clear()' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.CompilerServices.ConfiguredAsyncDisposable' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Runtime.CompilerServices.ConfiguredTaskAwaitable' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.Runtime.CompilerServices.ConfiguredTaskAwaitable' is marked as readonly in the contract so it must also be marked readonly in the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter' is marked as readonly in the contract so it must also be marked readonly in the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Runtime.CompilerServices.ConfiguredTaskAwaitable' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.Runtime.CompilerServices.ConfiguredTaskAwaitable' is marked as readonly in the contract so it must also be marked readonly in the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter' is marked as readonly in the contract so it must also be marked readonly in the implementation. -TypesMustExist : Type 'System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.CompilerServices.IsByRefLikeAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.CompilerServices.IsReadOnlyAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.CompilerServices.ITuple' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.CompilerServices.RuntimeFeature' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.CompilerServices.RuntimeHelpers.GetSubArray(T[], System.Range)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.CompilerServices.RuntimeHelpers.GetUninitializedObject(System.Type)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.CompilerServices.RuntimeHelpers.IsReferenceOrContainsReferences()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.CompilerServices.RuntimeHelpers.TryEnsureSufficientExecutionStack()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.CompilerServices.RuntimeWrappedException..ctor(System.Object)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.CompilerServices.SwitchExpressionException' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Runtime.CompilerServices.TaskAwaiter' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.Runtime.CompilerServices.TaskAwaiter' is marked as readonly in the contract so it must also be marked readonly in the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Runtime.CompilerServices.TaskAwaiter' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.Runtime.CompilerServices.TaskAwaiter' is marked as readonly in the contract so it must also be marked readonly in the implementation. -TypesMustExist : Type 'System.Runtime.CompilerServices.ValueTaskAwaiter' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.CompilerServices.ValueTaskAwaiter' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Runtime.CompilerServices.YieldAwaitable' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.Runtime.CompilerServices.YieldAwaitable' is marked as readonly in the contract so it must also be marked readonly in the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter' is marked as readonly in the contract so it must also be marked readonly in the implementation. -MembersMustExist : Member 'System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw(System.Exception)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.AutomationProxyAttribute' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Runtime.InteropServices.HandleRef' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.Runtime.InteropServices.HandleRef' is marked as readonly in the contract so it must also be marked readonly in the implementation. -TypesMustExist : Type 'System.Runtime.InteropServices.ImportedFromTypeLibAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.ManagedToNativeComInteropStubAttribute' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.PtrToStringUTF8(System.IntPtr)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.PtrToStringUTF8(System.IntPtr, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.StringToCoTaskMemUTF8(System.String)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.ZeroFreeCoTaskMemUTF8(System.IntPtr)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.MemoryMarshal' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Runtime.InteropServices.OSPlatform' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.Runtime.InteropServices.OSPlatform' is marked as readonly in the contract so it must also be marked readonly in the implementation. -TypesMustExist : Type 'System.Runtime.InteropServices.SequenceMarshal' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.TypeLibFuncAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.TypeLibFuncFlags' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.TypeLibImportClassAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.TypeLibTypeAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.TypeLibTypeFlags' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.TypeLibVarAttribute' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.TypeLibVarFlags' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Runtime.InteropServices.TypeLibVersionAttribute' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Runtime.Serialization.SerializationEntry' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.Runtime.Serialization.SerializationEntry' is marked as readonly in the contract so it must also be marked readonly in the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Runtime.Serialization.StreamingContext' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.Runtime.Serialization.StreamingContext' is marked as readonly in the contract so it must also be marked readonly in the implementation. -TypesMustExist : Type 'System.Runtime.Serialization.Formatters.IFieldInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Cryptography.CryptographicOperations' does not exist in the implementation but it does exist in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Security.Cryptography.CryptoStream' does not implement interface 'System.IAsyncDisposable' in the implementation but it does in the contract. -MembersMustExist : Member 'System.Security.Cryptography.CryptoStream.DisposeAsync()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.DSA.TryCreateSignature(System.ReadOnlySpan, System.Span, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.DSA.TryHashData(System.ReadOnlySpan, System.Span, System.Security.Cryptography.HashAlgorithmName, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.DSA.TrySignData(System.ReadOnlySpan, System.Span, System.Security.Cryptography.HashAlgorithmName, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.DSA.VerifyData(System.ReadOnlySpan, System.ReadOnlySpan, System.Security.Cryptography.HashAlgorithmName)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.DSA.VerifySignature(System.ReadOnlySpan, System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Cryptography.ECDiffieHellman' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.ECDsa.TryHashData(System.ReadOnlySpan, System.Span, System.Security.Cryptography.HashAlgorithmName, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.ECDsa.TrySignData(System.ReadOnlySpan, System.Span, System.Security.Cryptography.HashAlgorithmName, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.ECDsa.TrySignHash(System.ReadOnlySpan, System.Span, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.ECDsa.VerifyData(System.ReadOnlySpan, System.ReadOnlySpan, System.Security.Cryptography.HashAlgorithmName)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.ECDsa.VerifyHash(System.ReadOnlySpan, System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.HashAlgorithm.HashCore(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.HashAlgorithm.TryComputeHash(System.ReadOnlySpan, System.Span, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.HashAlgorithm.TryHashFinal(System.Span, System.Int32)' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Security.Cryptography.HashAlgorithmName' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.Security.Cryptography.HashAlgorithmName' is marked as readonly in the contract so it must also be marked readonly in the implementation. -MembersMustExist : Member 'System.Security.Cryptography.HMAC.HashCore(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.HMAC.TryHashFinal(System.Span, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.HMACMD5.HashCore(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.HMACMD5.TryHashFinal(System.Span, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.HMACSHA1.HashCore(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.HMACSHA1.TryHashFinal(System.Span, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.HMACSHA256.HashCore(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.HMACSHA256.TryHashFinal(System.Span, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.HMACSHA384.HashCore(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.HMACSHA384.TryHashFinal(System.Span, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.HMACSHA512.HashCore(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.HMACSHA512.TryHashFinal(System.Span, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.IncrementalHash.AppendData(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.IncrementalHash.TryGetHashAndReset(System.Span, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.RandomNumberGenerator.Fill(System.Span)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.RandomNumberGenerator.GetBytes(System.Span)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.RandomNumberGenerator.GetInt32(System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.RandomNumberGenerator.GetInt32(System.Int32, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.RandomNumberGenerator.GetNonZeroBytes(System.Span)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.Rfc2898DeriveBytes.HashAlgorithm.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.RSA.TryDecrypt(System.ReadOnlySpan, System.Span, System.Security.Cryptography.RSAEncryptionPadding, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.RSA.TryEncrypt(System.ReadOnlySpan, System.Span, System.Security.Cryptography.RSAEncryptionPadding, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.RSA.TryHashData(System.ReadOnlySpan, System.Span, System.Security.Cryptography.HashAlgorithmName, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.RSA.TrySignData(System.ReadOnlySpan, System.Span, System.Security.Cryptography.HashAlgorithmName, System.Security.Cryptography.RSASignaturePadding, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.RSA.TrySignHash(System.ReadOnlySpan, System.Span, System.Security.Cryptography.HashAlgorithmName, System.Security.Cryptography.RSASignaturePadding, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.RSA.VerifyData(System.ReadOnlySpan, System.ReadOnlySpan, System.Security.Cryptography.HashAlgorithmName, System.Security.Cryptography.RSASignaturePadding)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.RSA.VerifyHash(System.ReadOnlySpan, System.ReadOnlySpan, System.Security.Cryptography.HashAlgorithmName, System.Security.Cryptography.RSASignaturePadding)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.SHA1Managed.HashCore(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.SHA1Managed.TryHashFinal(System.Span, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.SHA256Managed.HashCore(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.SHA256Managed.TryHashFinal(System.Span, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.SHA384Managed.HashCore(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.SHA384Managed.TryHashFinal(System.Span, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.SHA512Managed.HashCore(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.SHA512Managed.TryHashFinal(System.Span, System.Int32)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Cryptography.X509Certificates.CertificateRequest' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Cryptography.X509Certificates.DSACertificateExtensions' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Cryptography.X509Certificates.SubjectAlternativeNameBuilder' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.X509Certificates.X509Certificate.GetCertHash(System.Security.Cryptography.HashAlgorithmName)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.X509Certificates.X509Certificate.GetCertHashString(System.Security.Cryptography.HashAlgorithmName)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.X509Certificates.X509Certificate.TryGetCertHash(System.Security.Cryptography.HashAlgorithmName, System.Span, System.Int32)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Security.Cryptography.X509Certificates.X509SignatureGenerator' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.X509Certificates.X509Store..ctor(System.Security.Cryptography.X509Certificates.StoreName, System.Security.Cryptography.X509Certificates.StoreLocation, System.Security.Cryptography.X509Certificates.OpenFlags)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.X509Certificates.X509Store..ctor(System.String, System.Security.Cryptography.X509Certificates.StoreLocation, System.Security.Cryptography.X509Certificates.OpenFlags)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Security.Cryptography.X509Certificates.X509Store.IsOpen.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Text.Decoder.Convert(System.ReadOnlySpan, System.Span, System.Boolean, System.Int32, System.Int32, System.Boolean)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Text.Decoder.GetCharCount(System.ReadOnlySpan, System.Boolean)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Text.Decoder.GetChars(System.ReadOnlySpan, System.Span, System.Boolean)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Text.Encoder.Convert(System.ReadOnlySpan, System.Span, System.Boolean, System.Int32, System.Int32, System.Boolean)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Text.Encoder.GetByteCount(System.ReadOnlySpan, System.Boolean)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Text.Encoder.GetBytes(System.ReadOnlySpan, System.Span, System.Boolean)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Text.Encoding.GetByteCount(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Text.Encoding.GetByteCount(System.String, System.Int32, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Text.Encoding.GetBytes(System.ReadOnlySpan, System.Span)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Text.Encoding.GetBytes(System.String, System.Int32, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Text.Encoding.GetCharCount(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Text.Encoding.GetChars(System.ReadOnlySpan, System.Span)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Text.Encoding.GetString(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Text.Encoding.Preamble.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Text.StringBuilder.Append(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Text.StringBuilder.Append(System.Text.StringBuilder)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Text.StringBuilder.Append(System.Text.StringBuilder, System.Int32, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Text.StringBuilder.AppendJoin(System.Char, System.Object[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Text.StringBuilder.AppendJoin(System.Char, System.String[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Text.StringBuilder.AppendJoin(System.String, System.Object[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Text.StringBuilder.AppendJoin(System.String, System.String[])' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Text.StringBuilder.AppendJoin(System.Char, System.Collections.Generic.IEnumerable)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Text.StringBuilder.AppendJoin(System.String, System.Collections.Generic.IEnumerable)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Text.StringBuilder.CopyTo(System.Int32, System.Span, System.Int32)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Text.StringBuilder.Equals(System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Text.StringBuilder.Insert(System.Int32, System.ReadOnlySpan)' does not exist in the implementation but it does exist in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Text.RegularExpressions.CaptureCollection' does not implement interface 'System.Collections.Generic.ICollection' in the implementation but it does in the contract. -MembersMustExist : Member 'System.Text.RegularExpressions.CaptureCollection.CopyTo(System.Text.RegularExpressions.Capture[], System.Int32)' does not exist in the implementation but it does exist in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Text.RegularExpressions.GroupCollection' does not implement interface 'System.Collections.Generic.ICollection' in the implementation but it does in the contract. -MembersMustExist : Member 'System.Text.RegularExpressions.GroupCollection.CopyTo(System.Text.RegularExpressions.Group[], System.Int32)' does not exist in the implementation but it does exist in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Text.RegularExpressions.MatchCollection' does not implement interface 'System.Collections.Generic.ICollection' in the implementation but it does in the contract. -MembersMustExist : Member 'System.Text.RegularExpressions.MatchCollection.CopyTo(System.Text.RegularExpressions.Match[], System.Int32)' does not exist in the implementation but it does exist in the contract. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Threading.AsyncLocalValueChangedArgs' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.Threading.AsyncLocalValueChangedArgs' is marked as readonly in the contract so it must also be marked readonly in the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Threading.CancellationToken' in the contract but not the implementation. -TypeCannotChangeClassification : Type 'System.Threading.CancellationToken' is marked as readonly in the contract so it must also be marked readonly in the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Threading.CancellationTokenRegistration' in the contract but not the implementation. -CannotRemoveBaseTypeOrInterface : Type 'System.Threading.CancellationTokenRegistration' does not implement interface 'System.IAsyncDisposable' in the implementation but it does in the contract. -TypeCannotChangeClassification : Type 'System.Threading.CancellationTokenRegistration' is marked as readonly in the contract so it must also be marked readonly in the implementation. -MembersMustExist : Member 'System.Threading.CancellationTokenRegistration.DisposeAsync()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Threading.CancellationTokenRegistration.Token.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Threading.Interlocked.MemoryBarrierProcessWide()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Threading.LazyInitializer.EnsureInitialized(T, System.Object, System.Func)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Threading.Thread.GetCurrentProcessorId()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Threading.ThreadPool.QueueUserWorkItem(System.Action, TState, System.Boolean)' does not exist in the implementation but it does exist in the contract. -CannotRemoveBaseTypeOrInterface : Type 'System.Threading.Timer' does not implement interface 'System.IAsyncDisposable' in the implementation but it does in the contract. -MembersMustExist : Member 'System.Threading.Timer.DisposeAsync()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Threading.Tasks.Task.IsCompletedSuccessfully.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Threading.Tasks.TaskCanceledException..ctor(System.String, System.Exception, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Threading.Tasks.TaskExtensions.ConfigureAwait(System.IAsyncDisposable, System.Boolean)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Threading.Tasks.TaskExtensions.ConfigureAwait(System.Collections.Generic.IAsyncEnumerable, System.Boolean)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Threading.Tasks.TaskExtensions.WithCancellation(System.Collections.Generic.IAsyncEnumerable, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Threading.Tasks.ValueTask' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Threading.Tasks.ValueTask' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Threading.Tasks.Sources.IValueTaskSource' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Threading.Tasks.Sources.IValueTaskSource' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Threading.Tasks.Sources.ValueTaskSourceOnCompletedFlags' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Threading.Tasks.Sources.ValueTaskSourceStatus' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Linq.XCData.WriteToAsync(System.Xml.XmlWriter, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Linq.XComment.WriteToAsync(System.Xml.XmlWriter, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Linq.XDocument.LoadAsync(System.IO.Stream, System.Xml.Linq.LoadOptions, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Linq.XDocument.LoadAsync(System.IO.TextReader, System.Xml.Linq.LoadOptions, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Linq.XDocument.LoadAsync(System.Xml.XmlReader, System.Xml.Linq.LoadOptions, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Linq.XDocument.SaveAsync(System.IO.Stream, System.Xml.Linq.SaveOptions, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Linq.XDocument.SaveAsync(System.IO.TextWriter, System.Xml.Linq.SaveOptions, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Linq.XDocument.SaveAsync(System.Xml.XmlWriter, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Linq.XDocument.WriteToAsync(System.Xml.XmlWriter, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Linq.XDocumentType.WriteToAsync(System.Xml.XmlWriter, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Linq.XElement.LoadAsync(System.IO.Stream, System.Xml.Linq.LoadOptions, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Linq.XElement.LoadAsync(System.IO.TextReader, System.Xml.Linq.LoadOptions, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Linq.XElement.LoadAsync(System.Xml.XmlReader, System.Xml.Linq.LoadOptions, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Linq.XElement.SaveAsync(System.IO.Stream, System.Xml.Linq.SaveOptions, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Linq.XElement.SaveAsync(System.IO.TextWriter, System.Xml.Linq.SaveOptions, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Linq.XElement.SaveAsync(System.Xml.XmlWriter, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Linq.XElement.WriteToAsync(System.Xml.XmlWriter, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Linq.XNode.ReadFromAsync(System.Xml.XmlReader, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Linq.XNode.WriteToAsync(System.Xml.XmlWriter, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Linq.XProcessingInstruction.WriteToAsync(System.Xml.XmlWriter, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'System.Xml.Linq.XText.WriteToAsync(System.Xml.XmlWriter, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'System.Xml.Serialization.SchemaImporter' does not exist in the implementation but it does exist in the contract. -CannotChangeAttribute : Attribute 'System.AttributeUsageAttribute' on 'System.Xml.Serialization.XmlAnyAttributeAttribute' changed from '[AttributeUsageAttribute(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue)]' in the contract to '[AttributeUsageAttribute(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue, AllowMultiple=false)]' in the implementation. -CannotChangeAttribute : Attribute 'System.AttributeUsageAttribute' on 'System.Xml.Serialization.XmlNamespaceDeclarationsAttribute' changed from '[AttributeUsageAttribute(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue)]' in the contract to '[AttributeUsageAttribute(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue, AllowMultiple=false)]' in the implementation. -Total Issues: 868 From 9e2a8a6042f82fd73eb4e5f0dc0e68a99ed8e7fa Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Tue, 25 Jan 2022 09:30:24 -0500 Subject: [PATCH 056/161] Improve Regex handling of anchors (#64177) * Improve Regex handling of anchors - Extend search for leading anchor to support alternations. This means that an expression like `^abc|^def` will now observe the leading `^` whereas previously it didn't. - Add a FindFirstChar optimization that jumps to the right position for a pattern that matches a computeable max length and ends with an end anchor. * Address PR feedback --- .../gen/RegexGenerator.Emitter.cs | 153 ++++++---- .../System/Text/RegularExpressions/Match.cs | 3 - .../Text/RegularExpressions/RegexCode.cs | 2 +- .../Text/RegularExpressions/RegexCompiler.cs | 261 ++++++++++-------- .../RegexFindOptimizations.cs | 78 +++++- .../Text/RegularExpressions/RegexNode.cs | 178 ++++++++++-- .../Text/RegularExpressions/RegexNodeKind.cs | 10 +- .../RegularExpressions/RegexPrefixAnalyzer.cs | 163 ++++++----- .../tests/Regex.Match.Tests.cs | 38 ++- .../tests/RegexReductionTests.cs | 158 +++++++---- 10 files changed, 700 insertions(+), 344 deletions(-) diff --git a/src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.Emitter.cs b/src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.Emitter.cs index fabe62f5262ec1..820490c500298e 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.Emitter.cs +++ b/src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.Emitter.cs @@ -392,68 +392,111 @@ private static RequiredHelperFunctions EmitFindFirstChar(IndentedTextWriter writ // searching is required; otherwise, false. bool EmitAnchors() { - // Generate anchor checks. - if ((code.FindOptimizations.LeadingAnchor & (RegexPrefixAnalyzer.Beginning | RegexPrefixAnalyzer.Start | RegexPrefixAnalyzer.EndZ | RegexPrefixAnalyzer.End | RegexPrefixAnalyzer.Bol)) != 0) + // Anchors that fully implement FindFirstChar, with a check that leads to immediate success or failure determination. + switch (code.FindOptimizations.FindMode) { - switch (code.FindOptimizations.LeadingAnchor) - { - case RegexPrefixAnalyzer.Beginning: - writer.WriteLine("// Beginning \\A anchor"); - additionalDeclarations.Add("int beginning = base.runtextbeg;"); - using (EmitBlock(writer, "if (pos > beginning)")) - { - writer.WriteLine($"goto {NoStartingPositionFound};"); - } - writer.WriteLine("return true;"); - return true; + case FindNextStartingPositionMode.LeadingAnchor_LeftToRight_Beginning: + writer.WriteLine("// Beginning \\A anchor"); + additionalDeclarations.Add("int beginning = base.runtextbeg;"); + using (EmitBlock(writer, "if (pos > beginning)")) + { + writer.WriteLine($"goto {NoStartingPositionFound};"); + } + writer.WriteLine("return true;"); + return true; + + case FindNextStartingPositionMode.LeadingAnchor_LeftToRight_Start: + writer.WriteLine("// Start \\G anchor"); + using (EmitBlock(writer, "if (pos > base.runtextstart)")) + { + writer.WriteLine($"goto {NoStartingPositionFound};"); + } + writer.WriteLine("return true;"); + return true; + + case FindNextStartingPositionMode.LeadingAnchor_LeftToRight_EndZ: + writer.WriteLine("// Leading end \\Z anchor"); + using (EmitBlock(writer, "if (pos < end - 1)")) + { + writer.WriteLine("base.runtextpos = end - 1;"); + } + writer.WriteLine("return true;"); + return true; + + case FindNextStartingPositionMode.LeadingAnchor_LeftToRight_End: + writer.WriteLine("// Leading end \\z anchor"); + using (EmitBlock(writer, "if (pos < end)")) + { + writer.WriteLine("base.runtextpos = end;"); + } + writer.WriteLine("return true;"); + return true; - case RegexPrefixAnalyzer.Start: - writer.WriteLine("// Start \\G anchor"); - using (EmitBlock(writer, "if (pos > base.runtextstart)")) + case FindNextStartingPositionMode.TrailingAnchor_FixedLength_LeftToRight_EndZ: + // Jump to the end, minus the min required length, which in this case is actually the fixed length, minus 1 (for a possible ending \n). + writer.WriteLine("// Trailing end \\Z anchor with fixed-length match"); + using (EmitBlock(writer, $"if (pos < end - {code.Tree.MinRequiredLength + 1})")) + { + writer.WriteLine($"base.runtextpos = end - {code.Tree.MinRequiredLength + 1};"); + } + writer.WriteLine("return true;"); + return true; + + case FindNextStartingPositionMode.TrailingAnchor_FixedLength_LeftToRight_End: + // Jump to the end, minus the min required length, which in this case is actually the fixed length. + writer.WriteLine("// Trailing end \\z anchor with fixed-length match"); + using (EmitBlock(writer, $"if (pos < end - {code.Tree.MinRequiredLength})")) + { + writer.WriteLine($"base.runtextpos = end - {code.Tree.MinRequiredLength};"); + } + writer.WriteLine("return true;"); + return true; + } + + // Now handle anchors that boost the position but may not determine immediate success or failure. + + switch (code.FindOptimizations.LeadingAnchor) + { + case RegexNodeKind.Bol: + // Optimize the handling of a Beginning-Of-Line (BOL) anchor. BOL is special, in that unlike + // other anchors like Beginning, there are potentially multiple places a BOL can match. So unlike + // the other anchors, which all skip all subsequent processing if found, with BOL we just use it + // to boost our position to the next line, and then continue normally with any searches. + writer.WriteLine("// Beginning-of-line anchor"); + additionalDeclarations.Add("global::System.ReadOnlySpan inputSpan = base.runtext;"); + additionalDeclarations.Add("int beginning = base.runtextbeg;"); + using (EmitBlock(writer, "if (pos > beginning && inputSpan[pos - 1] != '\\n')")) + { + writer.WriteLine("int newlinePos = global::System.MemoryExtensions.IndexOf(inputSpan.Slice(pos), '\\n');"); + using (EmitBlock(writer, "if (newlinePos < 0 || newlinePos + pos + 1 > end)")) { writer.WriteLine($"goto {NoStartingPositionFound};"); } - writer.WriteLine("return true;"); - return true; + writer.WriteLine("pos = newlinePos + pos + 1;"); + } + writer.WriteLine(); + break; + } - case RegexPrefixAnalyzer.EndZ: - writer.WriteLine("// End \\Z anchor"); - using (EmitBlock(writer, "if (pos < end - 1)")) - { - writer.WriteLine("base.runtextpos = end - 1;"); - } - writer.WriteLine("return true;"); - return true; + switch (code.FindOptimizations.TrailingAnchor) + { + case RegexNodeKind.End when code.FindOptimizations.MaxPossibleLength is int maxLength: + writer.WriteLine("// End \\z anchor with maximum-length match"); + using (EmitBlock(writer, $"if (pos < end - {maxLength})")) + { + writer.WriteLine($"pos = end - {maxLength};"); + } + writer.WriteLine(); + break; - case RegexPrefixAnalyzer.End: - writer.WriteLine("// End \\z anchor"); - using (EmitBlock(writer, "if (pos < end)")) - { - writer.WriteLine("base.runtextpos = end;"); - } - writer.WriteLine("return true;"); - return true; - - case RegexPrefixAnalyzer.Bol: - // Optimize the handling of a Beginning-Of-Line (BOL) anchor. BOL is special, in that unlike - // other anchors like Beginning, there are potentially multiple places a BOL can match. So unlike - // the other anchors, which all skip all subsequent processing if found, with BOL we just use it - // to boost our position to the next line, and then continue normally with any searches. - writer.WriteLine("// Beginning-of-line anchor"); - additionalDeclarations.Add("global::System.ReadOnlySpan inputSpan = base.runtext;"); - additionalDeclarations.Add("int beginning = base.runtextbeg;"); - using (EmitBlock(writer, "if (pos > beginning && inputSpan[pos - 1] != '\\n')")) - { - writer.WriteLine("int newlinePos = global::System.MemoryExtensions.IndexOf(inputSpan.Slice(pos), '\\n');"); - using (EmitBlock(writer, "if (newlinePos < 0 || newlinePos + pos + 1 > end)")) - { - writer.WriteLine($"goto {NoStartingPositionFound};"); - } - writer.WriteLine("pos = newlinePos + pos + 1;"); - } - writer.WriteLine(); - break; - } + case RegexNodeKind.EndZ when code.FindOptimizations.MaxPossibleLength is int maxLength: + writer.WriteLine("// End \\Z anchor with maximum-length match"); + using (EmitBlock(writer, $"if (pos < end - {maxLength + 1})")) + { + writer.WriteLine($"pos = end - {maxLength + 1};"); + } + writer.WriteLine(); + break; } return false; diff --git a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Match.cs b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Match.cs index b7f2f032e78a82..b941d1ad8d7a2f 100644 --- a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Match.cs +++ b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Match.cs @@ -61,9 +61,6 @@ internal Match(Regex? regex, int capcount, string text, int begpos, int len, int _textend = begpos + len; _textstart = startpos; _balancing = false; - - Debug.Assert(!(_textbeg < 0 || _textstart < _textbeg || _textend < _textstart || Text.Length < _textend), - "The parameters are out of range."); } /// Returns an empty Match object. diff --git a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCode.cs b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCode.cs index d51ca826fd71c6..76caec6647ad21 100644 --- a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCode.cs +++ b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCode.cs @@ -401,7 +401,7 @@ public override string ToString() var sb = new StringBuilder(); sb.AppendLine($"Direction: {(RightToLeft ? "right-to-left" : "left-to-right")}"); - sb.AppendLine($"Anchor: {RegexPrefixAnalyzer.AnchorDescription(FindOptimizations.LeadingAnchor)}"); + sb.AppendLine($"Anchor: {FindOptimizations.LeadingAnchor}"); sb.AppendLine(); for (int i = 0; i < Codes.Length; i += OpcodeSize(Codes[i])) { diff --git a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCompiler.cs b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCompiler.cs index 2145a5dec334d2..1c03616ef37931 100644 --- a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCompiler.cs +++ b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCompiler.cs @@ -465,134 +465,173 @@ FindNextStartingPositionMode.FixedSets_LeftToRight_CaseInsensitive or // searching is required; otherwise, false. bool GenerateAnchors() { - // Generate anchor checks. - if ((_code.FindOptimizations.LeadingAnchor & (RegexPrefixAnalyzer.Beginning | RegexPrefixAnalyzer.Start | RegexPrefixAnalyzer.EndZ | RegexPrefixAnalyzer.End | RegexPrefixAnalyzer.Bol)) != 0) + Label label; + + // Anchors that fully implement FindFirstChar, with a check that leads to immediate success or failure determination. + switch (_code.FindOptimizations.FindMode) { - switch (_code.FindOptimizations.LeadingAnchor) - { - case RegexPrefixAnalyzer.Beginning: - { - Label l1 = DefineLabel(); - Ldloc(pos); - Ldthisfld(s_runtextbegField); - Ble(l1); - Br(returnFalse); - MarkLabel(l1); - } + case FindNextStartingPositionMode.LeadingAnchor_LeftToRight_Beginning: + label = DefineLabel(); + Ldloc(pos); + Ldthisfld(s_runtextbegField); + Ble(label); + Br(returnFalse); + MarkLabel(label); + Ldc(1); + Ret(); + return true; + + case FindNextStartingPositionMode.LeadingAnchor_LeftToRight_Start: + label = DefineLabel(); + Ldloc(pos); + Ldthisfld(s_runtextstartField); + Ble(label); + Br(returnFalse); + MarkLabel(label); + Ldc(1); + Ret(); + return true; + + case FindNextStartingPositionMode.LeadingAnchor_LeftToRight_EndZ: + label = DefineLabel(); + Ldloc(pos); + Ldloc(end); + Ldc(1); + Sub(); + Bge(label); + Ldthis(); + Ldloc(end); + Ldc(1); + Sub(); + Stfld(s_runtextposField); + MarkLabel(label); + Ldc(1); + Ret(); + return true; + + case FindNextStartingPositionMode.LeadingAnchor_LeftToRight_End: + label = DefineLabel(); + Ldloc(pos); + Ldloc(end); + Bge(label); + Ldthis(); + Ldloc(end); + Stfld(s_runtextposField); + MarkLabel(label); + Ldc(1); + Ret(); + return true; + + case FindNextStartingPositionMode.TrailingAnchor_FixedLength_LeftToRight_End: + case FindNextStartingPositionMode.TrailingAnchor_FixedLength_LeftToRight_EndZ: + // Jump to the end, minus the min required length, which in this case is actually the fixed length. + { + int extraNewlineBump = _code.FindOptimizations.FindMode == FindNextStartingPositionMode.TrailingAnchor_FixedLength_LeftToRight_EndZ ? 1 : 0; + label = DefineLabel(); + Ldloc(pos); + Ldloc(end); + Ldc(_code.Tree.MinRequiredLength + extraNewlineBump); + Sub(); + Bge(label); + Ldthis(); + Ldloc(end); + Ldc(_code.Tree.MinRequiredLength + extraNewlineBump); + Sub(); + Stfld(s_runtextposField); + MarkLabel(label); Ldc(1); Ret(); return true; + } + } - case RegexPrefixAnalyzer.Start: - { - Label l1 = DefineLabel(); - Ldloc(pos); - Ldthisfld(s_runtextstartField); - Ble(l1); - Br(returnFalse); - MarkLabel(l1); - } + // Now handle anchors that boost the position but don't determine immediate success or failure. + + switch (_code.FindOptimizations.LeadingAnchor) + { + case RegexNodeKind.Bol: + { + // Optimize the handling of a Beginning-Of-Line (BOL) anchor. BOL is special, in that unlike + // other anchors like Beginning, there are potentially multiple places a BOL can match. So unlike + // the other anchors, which all skip all subsequent processing if found, with BOL we just use it + // to boost our position to the next line, and then continue normally with any prefix or char class searches. + + label = DefineLabel(); + + // if (pos > runtextbeg... + Ldloc(pos!); + Ldthisfld(s_runtextbegField); + Ble(label); + + // ... && inputSpan[pos - 1] != '\n') { ... } + Ldloca(inputSpan); + Ldloc(pos); Ldc(1); - Ret(); - return true; + Sub(); + Call(s_spanGetItemMethod); + LdindU2(); + Ldc('\n'); + Beq(label); - case RegexPrefixAnalyzer.EndZ: + // int tmp = inputSpan.Slice(pos).IndexOf('\n'); + Ldloca(inputSpan); + Ldloc(pos); + Call(s_spanSliceIntMethod); + Ldc('\n'); + Call(s_spanIndexOfChar); + using (RentedLocalBuilder newlinePos = RentInt32Local()) { - Label l1 = DefineLabel(); + Stloc(newlinePos); + + // if (newlinePos < 0 || newlinePos + pos + 1 > end) + // { + // base.runtextpos = end; + // return false; + // } + Ldloc(newlinePos); + Ldc(0); + Blt(returnFalse); + Ldloc(newlinePos); Ldloc(pos); - Ldloc(end); + Add(); Ldc(1); - Sub(); - Bge(l1); - Ldthis(); + Add(); Ldloc(end); - Ldc(1); - Sub(); - Stfld(s_runtextposField); - MarkLabel(l1); - } - Ldc(1); - Ret(); - return true; + Bgt(returnFalse); - case RegexPrefixAnalyzer.End: - { - Label l1 = DefineLabel(); + // pos += newlinePos + 1; Ldloc(pos); - Ldloc(end); - Bge(l1); - Ldthis(); - Ldloc(end); - Stfld(s_runtextposField); - MarkLabel(l1); + Ldloc(newlinePos); + Add(); + Ldc(1); + Add(); + Stloc(pos); } - Ldc(1); - Ret(); - return true; - - case RegexPrefixAnalyzer.Bol: - { - // Optimize the handling of a Beginning-Of-Line (BOL) anchor. BOL is special, in that unlike - // other anchors like Beginning, there are potentially multiple places a BOL can match. So unlike - // the other anchors, which all skip all subsequent processing if found, with BOL we just use it - // to boost our position to the next line, and then continue normally with any prefix or char class searches. - Label atBeginningOfLine = DefineLabel(); - - // if (pos > runtextbeg... - Ldloc(pos!); - Ldthisfld(s_runtextbegField); - Ble(atBeginningOfLine); + MarkLabel(label); + } + break; + } - // ... && inputSpan[pos - 1] != '\n') { ... } - Ldloca(inputSpan); - Ldloc(pos); - Ldc(1); - Sub(); - Call(s_spanGetItemMethod); - LdindU2(); - Ldc('\n'); - Beq(atBeginningOfLine); - - // int tmp = inputSpan.Slice(pos).IndexOf('\n'); - Ldloca(inputSpan); - Ldloc(pos); - Call(s_spanSliceIntMethod); - Ldc('\n'); - Call(s_spanIndexOfChar); - using (RentedLocalBuilder newlinePos = RentInt32Local()) - { - Stloc(newlinePos); - - // if (newlinePos < 0 || newlinePos + pos + 1 > end) - // { - // base.runtextpos = end; - // return false; - // } - Ldloc(newlinePos); - Ldc(0); - Blt(returnFalse); - Ldloc(newlinePos); - Ldloc(pos); - Add(); - Ldc(1); - Add(); - Ldloc(end); - Bgt(returnFalse); - - // pos += newlinePos + 1; - Ldloc(pos); - Ldloc(newlinePos); - Add(); - Ldc(1); - Add(); - Stloc(pos); - } - - MarkLabel(atBeginningOfLine); - } + switch (_code.FindOptimizations.TrailingAnchor) + { + case RegexNodeKind.End or RegexNodeKind.EndZ when _code.FindOptimizations.MaxPossibleLength is int maxLength: + // Jump to the end, minus the max allowed length. + { + int extraNewlineBump = _code.FindOptimizations.FindMode == FindNextStartingPositionMode.TrailingAnchor_FixedLength_LeftToRight_EndZ ? 1 : 0; + label = DefineLabel(); + Ldloc(pos); + Ldloc(end); + Ldc(maxLength + extraNewlineBump); + Sub(); + Bge(label); + Ldloc(end); + Ldc(maxLength + extraNewlineBump); + Sub(); + Stloc(pos); + MarkLabel(label); break; - } + } } return false; diff --git a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexFindOptimizations.cs b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexFindOptimizations.cs index e3c760c2728be5..ee96e7e5cc8470 100644 --- a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexFindOptimizations.cs +++ b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexFindOptimizations.cs @@ -10,7 +10,8 @@ namespace System.Text.RegularExpressions /// Contains state and provides operations related to finding the next location a match could possibly begin. internal sealed class RegexFindOptimizations { - /// The minimum required length an input need be to match the pattern. May be 0. + /// The minimum required length an input need be to match the pattern. + /// 0 is a valid minimum length. This value may also be the max (and hence fixed) length of the expression. private readonly int _minRequiredLength; /// True if the input should be processed right-to-left rather than left-to-right. private readonly bool _rightToLeft; @@ -27,28 +28,48 @@ public RegexFindOptimizations(RegexTree tree, CultureInfo culture) // Compute any anchor starting the expression. If there is one, we won't need to search for anything, // as we can just match at that single location. - LeadingAnchor = RegexPrefixAnalyzer.FindLeadingAnchor(tree); - if (_rightToLeft) + LeadingAnchor = RegexPrefixAnalyzer.FindLeadingAnchor(tree.Root); + if (_rightToLeft && LeadingAnchor == RegexNodeKind.Bol) { // Filter out Bol for RightToLeft, as we don't currently optimize for it. - LeadingAnchor &= ~RegexPrefixAnalyzer.Bol; + LeadingAnchor = RegexNodeKind.Unknown; } - if ((LeadingAnchor & (RegexPrefixAnalyzer.Beginning | RegexPrefixAnalyzer.Start | RegexPrefixAnalyzer.EndZ | RegexPrefixAnalyzer.End)) != 0) + if (LeadingAnchor is RegexNodeKind.Beginning or RegexNodeKind.Start or RegexNodeKind.EndZ or RegexNodeKind.End) { FindMode = (LeadingAnchor, _rightToLeft) switch { - (RegexPrefixAnalyzer.Beginning, false) => FindNextStartingPositionMode.LeadingAnchor_LeftToRight_Beginning, - (RegexPrefixAnalyzer.Beginning, true) => FindNextStartingPositionMode.LeadingAnchor_RightToLeft_Beginning, - (RegexPrefixAnalyzer.Start, false) => FindNextStartingPositionMode.LeadingAnchor_LeftToRight_Start, - (RegexPrefixAnalyzer.Start, true) => FindNextStartingPositionMode.LeadingAnchor_RightToLeft_Start, - (RegexPrefixAnalyzer.End, false) => FindNextStartingPositionMode.LeadingAnchor_LeftToRight_End, - (RegexPrefixAnalyzer.End, true) => FindNextStartingPositionMode.LeadingAnchor_RightToLeft_End, + (RegexNodeKind.Beginning, false) => FindNextStartingPositionMode.LeadingAnchor_LeftToRight_Beginning, + (RegexNodeKind.Beginning, true) => FindNextStartingPositionMode.LeadingAnchor_RightToLeft_Beginning, + (RegexNodeKind.Start, false) => FindNextStartingPositionMode.LeadingAnchor_LeftToRight_Start, + (RegexNodeKind.Start, true) => FindNextStartingPositionMode.LeadingAnchor_RightToLeft_Start, + (RegexNodeKind.End, false) => FindNextStartingPositionMode.LeadingAnchor_LeftToRight_End, + (RegexNodeKind.End, true) => FindNextStartingPositionMode.LeadingAnchor_RightToLeft_End, (_, false) => FindNextStartingPositionMode.LeadingAnchor_LeftToRight_EndZ, (_, true) => FindNextStartingPositionMode.LeadingAnchor_RightToLeft_EndZ, }; return; } + // Compute any anchor trailing the expression. If there is one, and we can also compute a fixed length + // for the whole expression, we can use that to quickly jump to the right location in the input. + if (!_rightToLeft) // haven't added FindNextStartingPositionMode support for RTL + { + TrailingAnchor = RegexPrefixAnalyzer.FindTrailingAnchor(tree.Root); + if (TrailingAnchor is RegexNodeKind.End or RegexNodeKind.EndZ && + tree.Root.ComputeMaxLength() is int maxLength) + { + Debug.Assert(maxLength >= _minRequiredLength, $"{maxLength} should have been greater than {_minRequiredLength} minimum"); + MaxPossibleLength = maxLength; + if (_minRequiredLength == maxLength) + { + FindMode = TrailingAnchor == RegexNodeKind.End ? + FindNextStartingPositionMode.TrailingAnchor_FixedLength_LeftToRight_End : + FindNextStartingPositionMode.TrailingAnchor_FixedLength_LeftToRight_EndZ; + return; + } + } + } + // If there's a leading case-sensitive substring, just use IndexOf and inherit all of its optimizations. string caseSensitivePrefix = RegexPrefixAnalyzer.FindCaseSensitivePrefix(tree.Root); if (caseSensitivePrefix.Length > 1) @@ -183,8 +204,18 @@ public RegexFindOptimizations(RegexTree tree, CultureInfo culture) /// Gets the selected mode for performing the next operation public FindNextStartingPositionMode FindMode { get; } = FindNextStartingPositionMode.NoSearch; - /// Gets the leading anchor, if one exists (RegexPrefixAnalyzer.Bol, etc). - public int LeadingAnchor { get; } + /// Gets the leading anchor (e.g. RegexNodeKind.Bol) if one exists and was computed. + public RegexNodeKind LeadingAnchor { get; } + + /// Gets the trailing anchor (e.g. RegexNodeKind.Bol) if one exists and was computed. + public RegexNodeKind TrailingAnchor { get; } + + /// The maximum possible length an input could be to match the pattern. + /// + /// This is currently only set when is found to be an end anchor. + /// That can be expanded in the future as needed. + /// + public int? MaxPossibleLength { get; } /// Gets the leading prefix. May be an empty string. public string LeadingCaseSensitivePrefix { get; } = string.Empty; @@ -230,7 +261,7 @@ public bool TryFindNextStartingPosition(ReadOnlySpan textSpan, ref int pos // other anchors like Beginning, there are potentially multiple places a BOL can match. So unlike // the other anchors, which all skip all subsequent processing if found, with BOL we just use it // to boost our position to the next line, and then continue normally with any searches. - if (LeadingAnchor == RegexPrefixAnalyzer.Bol) + if (LeadingAnchor == RegexNodeKind.Bol) { // If we're not currently positioned at the beginning of a line (either // the beginning of the string or just after a line feed), find the next @@ -315,6 +346,20 @@ public bool TryFindNextStartingPosition(ReadOnlySpan textSpan, ref int pos } return true; + case FindNextStartingPositionMode.TrailingAnchor_FixedLength_LeftToRight_EndZ: + if (pos < end - _minRequiredLength - 1) + { + pos = end - _minRequiredLength - 1; + } + return true; + + case FindNextStartingPositionMode.TrailingAnchor_FixedLength_LeftToRight_End: + if (pos < end - _minRequiredLength) + { + pos = end - _minRequiredLength; + } + return true; + // There's a case-sensitive prefix. Search for it with ordinal IndexOf. case FindNextStartingPositionMode.LeadingPrefix_LeftToRight_CaseSensitive: @@ -698,6 +743,11 @@ internal enum FindNextStartingPositionMode /// An "end" anchor at the beginning of the right-to-left pattern. This is rare. LeadingAnchor_RightToLeft_End, + /// An "end" anchor at the end of the pattern, with the pattern always matching a fixed-length expression. + TrailingAnchor_FixedLength_LeftToRight_End, + /// An "endz" anchor at the end of the pattern, with the pattern always matching a fixed-length expression. + TrailingAnchor_FixedLength_LeftToRight_EndZ, + /// A case-sensitive multi-character substring at the beginning of the pattern. LeadingPrefix_LeftToRight_CaseSensitive, /// A case-sensitive multi-character substring at the beginning of the right-to-left pattern. diff --git a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexNode.cs b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexNode.cs index ad760e95e39142..945f9ac2b4f2de 100644 --- a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexNode.cs +++ b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexNode.cs @@ -232,7 +232,7 @@ private void ValidateFinalTreeInvariants() case RegexNodeKind.Setloopatomic: case RegexNodeKind.Start: case RegexNodeKind.UpdateBumpalong: - Debug.Assert(childCount == 0, $"Expected zero children for {node.TypeName}, got {childCount}."); + Debug.Assert(childCount == 0, $"Expected zero children for {node.Kind}, got {childCount}."); break; case RegexNodeKind.Atomic: @@ -241,20 +241,20 @@ private void ValidateFinalTreeInvariants() case RegexNodeKind.Loop: case RegexNodeKind.NegativeLookaround: case RegexNodeKind.PositiveLookaround: - Debug.Assert(childCount == 1, $"Expected one and only one child for {node.TypeName}, got {childCount}."); + Debug.Assert(childCount == 1, $"Expected one and only one child for {node.Kind}, got {childCount}."); break; case RegexNodeKind.BackreferenceConditional: - Debug.Assert(childCount == 2, $"Expected two children for {node.TypeName}, got {childCount}"); + Debug.Assert(childCount == 2, $"Expected two children for {node.Kind}, got {childCount}"); break; case RegexNodeKind.ExpressionConditional: - Debug.Assert(childCount == 3, $"Expected three children for {node.TypeName}, got {childCount}"); + Debug.Assert(childCount == 3, $"Expected three children for {node.Kind}, got {childCount}"); break; case RegexNodeKind.Concatenate: case RegexNodeKind.Alternate: - Debug.Assert(childCount >= 2, $"Expected at least two children for {node.TypeName}, got {childCount}."); + Debug.Assert(childCount >= 2, $"Expected at least two children for {node.Kind}, got {childCount}."); break; default: @@ -274,11 +274,11 @@ private void ValidateFinalTreeInvariants() case RegexNodeKind.Setloop: case RegexNodeKind.Setloopatomic: case RegexNodeKind.Setlazy: - Debug.Assert(!string.IsNullOrEmpty(node.Str), $"Expected non-null, non-empty string for {node.TypeName}."); + Debug.Assert(!string.IsNullOrEmpty(node.Str), $"Expected non-null, non-empty string for {node.Kind}."); break; default: - Debug.Assert(node.Str is null, $"Expected null string for {node.TypeName}, got \"{node.Str}\"."); + Debug.Assert(node.Str is null, $"Expected null string for {node.Kind}, got \"{node.Str}\"."); break; } } @@ -2125,7 +2125,7 @@ public int ComputeMinLength() case RegexNodeKind.Lazyloop: case RegexNodeKind.Loop: // A node graph repeated at least M times. - return (int)Math.Min(int.MaxValue, (long)M * Child(0).ComputeMinLength()); + return (int)Math.Min(int.MaxValue - 1, (long)M * Child(0).ComputeMinLength()); case RegexNodeKind.Alternate: // The minimum required length for any of the alternation's branches. @@ -2157,7 +2157,7 @@ public int ComputeMinLength() { sum += Child(i).ComputeMinLength(); } - return (int)Math.Min(int.MaxValue, sum); + return (int)Math.Min(int.MaxValue - 1, sum); } case RegexNodeKind.Atomic: @@ -2170,9 +2170,9 @@ public int ComputeMinLength() case RegexNodeKind.Empty: case RegexNodeKind.Nothing: case RegexNodeKind.UpdateBumpalong: - // Nothing to match. In the future, we could potentially use Nothing to say that the min length - // is infinite, but that would require a different structure, as that would only apply if the - // Nothing match is required in all cases (rather than, say, as one branch of an alternation). + // Nothing to match. In the future, we could potentially use Nothing to say that the min length + // is infinite, but that would require a different structure, as that would only apply if the + // Nothing match is required in all cases (rather than, say, as one branch of an alternation). case RegexNodeKind.Beginning: case RegexNodeKind.Bol: case RegexNodeKind.Boundary: @@ -2183,20 +2183,154 @@ public int ComputeMinLength() case RegexNodeKind.NonBoundary: case RegexNodeKind.NonECMABoundary: case RegexNodeKind.Start: - // Difficult to glean anything meaningful from boundaries or results only known at run time. case RegexNodeKind.NegativeLookaround: case RegexNodeKind.PositiveLookaround: - // Lookaheads/behinds could potentially be included in the future, but that will require - // a different structure, as they can't be added as part of a concatenation, since they overlap - // with what comes after. + // Zero-width case RegexNodeKind.Backreference: - // Constructs requiring data at runtime from the matching pattern can't influence min length. + // Requires matching data available only at run-time. In the future, we could choose to find + // and follow the capture group this aligns with, while being careful not to end up in an + // infinite cycle. return 0; default: -#if DEBUG - Debug.Fail($"Unknown node: {TypeName}"); -#endif + Debug.Fail($"Unknown node: {Kind}"); + goto case RegexNodeKind.Empty; + } + } + + /// Computes a maximum length of any string that could possibly match. + /// The maximum length of any string that could possibly match, or null if the length may not always be the same. + /// + /// e.g. abc[def](gh|ijklmnop) => 12 + /// + public int? ComputeMaxLength() + { + if (!StackHelper.TryEnsureSufficientExecutionStack()) + { + // If we can't recur further, assume there's no minimum we can enforce. + return null; + } + + switch (Kind) + { + case RegexNodeKind.One: + case RegexNodeKind.Notone: + case RegexNodeKind.Set: + // Single character. + return 1; + + case RegexNodeKind.Multi: + // Every character in the string needs to match. + return Str!.Length; + + case RegexNodeKind.Notonelazy or RegexNodeKind.Notoneloop or RegexNodeKind.Notoneloopatomic or + RegexNodeKind.Onelazy or RegexNodeKind.Oneloop or RegexNodeKind.Oneloopatomic or + RegexNodeKind.Setlazy or RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic: + // Return the max number of iterations if there's an upper bound, or null if it's infinite + return N == int.MaxValue ? null : N; + + case RegexNodeKind.Loop or RegexNodeKind.Lazyloop: + if (N != int.MaxValue) + { + // A node graph repeated a fixed number of times + if (Child(0).ComputeMaxLength() is int childMaxLength) + { + long maxLength = (long)N * childMaxLength; + if (maxLength < int.MaxValue) + { + return (int)maxLength; + } + } + } + return null; + + case RegexNodeKind.Alternate: + // The maximum length of any child branch, as long as they all have one. + { + int childCount = ChildCount(); + Debug.Assert(childCount >= 2); + if (Child(0).ComputeMaxLength() is not int maxLength) + { + return null; + } + + for (int i = 1; i < childCount; i++) + { + if (Child(i).ComputeMaxLength() is not int next) + { + return null; + } + + maxLength = Math.Max(maxLength, next); + } + + return maxLength; + } + + case RegexNodeKind.BackreferenceConditional: + case RegexNodeKind.ExpressionConditional: + // The maximum length of either child branch, as long as they both have one.. The condition for an expression conditional is a zero-width assertion. + { + int i = Kind == RegexNodeKind.BackreferenceConditional ? 0 : 1; + return Child(i).ComputeMaxLength() is int yes && Child(i + 1).ComputeMaxLength() is int no ? + Math.Max(yes, no) : + null; + } + + case RegexNodeKind.Concatenate: + // The sum of all of the concatenation's children's max lengths, as long as they all have one. + { + long sum = 0; + int childCount = ChildCount(); + for (int i = 0; i < childCount; i++) + { + if (Child(i).ComputeMaxLength() is not int length) + { + return null; + } + sum += length; + } + + if (sum < int.MaxValue) + { + return (int)sum; + } + + return null; + } + + case RegexNodeKind.Atomic: + case RegexNodeKind.Capture: + // For groups, we just delegate to the sole child. + Debug.Assert(ChildCount() == 1); + return Child(0).ComputeMaxLength(); + + case RegexNodeKind.Empty: + case RegexNodeKind.Nothing: + case RegexNodeKind.UpdateBumpalong: + case RegexNodeKind.Beginning: + case RegexNodeKind.Bol: + case RegexNodeKind.Boundary: + case RegexNodeKind.ECMABoundary: + case RegexNodeKind.End: + case RegexNodeKind.EndZ: + case RegexNodeKind.Eol: + case RegexNodeKind.NonBoundary: + case RegexNodeKind.NonECMABoundary: + case RegexNodeKind.Start: + case RegexNodeKind.PositiveLookaround: + case RegexNodeKind.NegativeLookaround: + // Zero-width + return 0; + + case RegexNodeKind.Backreference: + // Requires matching data available only at run-time. In the future, we could choose to find + // and follow the capture group this aligns with, while being careful not to end up in an + // infinite cycle. + return null; + + default: + Debug.Fail($"Unknown node: {Kind}"); goto case RegexNodeKind.Empty; } } @@ -2416,12 +2550,10 @@ public bool IsInLoop() } #if DEBUG - private string TypeName => Kind.ToString(); - [ExcludeFromCodeCoverage] public string Description() { - var sb = new StringBuilder(TypeName); + var sb = new StringBuilder(Kind.ToString()); if ((Options & RegexOptions.ExplicitCapture) != 0) sb.Append("-C"); if ((Options & RegexOptions.IgnoreCase) != 0) sb.Append("-I"); diff --git a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexNodeKind.cs b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexNodeKind.cs index ab4ea881087c5c..dcf1097ea3ec70 100644 --- a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexNodeKind.cs +++ b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexNodeKind.cs @@ -1,17 +1,15 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Collections.Generic; -using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; -using System.Globalization; -using System.Threading; - namespace System.Text.RegularExpressions { /// Specifies the kind of a . internal enum RegexNodeKind { + /// Unknown node type. + /// This should never occur on an actual node, and instead is used as a sentinel. + Unknown = 0, + // The following are leaves (no children) and correspond to primitive operations in the regular expression. /// A specific character, e.g. `a`. diff --git a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexPrefixAnalyzer.cs b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexPrefixAnalyzer.cs index 692ee7d5557c1a..c3e80fc9913718 100644 --- a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexPrefixAnalyzer.cs +++ b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexPrefixAnalyzer.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Runtime.CompilerServices; using System.Threading; @@ -17,16 +16,6 @@ internal ref struct RegexPrefixAnalyzer private const RegexNodeKind BeforeChild = (RegexNodeKind)64; private const RegexNodeKind AfterChild = (RegexNodeKind)128; - // where the regex can be pegged - public const int Beginning = 0x0001; - public const int Bol = 0x0002; - public const int Start = 0x0004; - public const int Eol = 0x0008; - public const int EndZ = 0x0010; - public const int End = 0x0020; - public const int Boundary = 0x0040; - public const int ECMABoundary = 0x0080; - private readonly List _fcStack; private ValueListBuilder _intStack; // must not be readonly private bool _skipAllChildren; // don't process any more children at the current level @@ -654,94 +643,116 @@ public static (RegexNode LoopNode, (char Char, string? String, char[]? Chars) Li return null; } - /// Takes a RegexTree and computes the leading anchor that it encounters. - public static int FindLeadingAnchor(RegexTree tree) + /// Computes the leading anchor of a node. + public static RegexNodeKind FindLeadingAnchor(RegexNode node) => + FindLeadingOrTrailingAnchor(node, leading: true); + + /// Computes the leading anchor of a node. + public static RegexNodeKind FindTrailingAnchor(RegexNode node) => + FindLeadingOrTrailingAnchor(node, leading: false); + + /// Computes the leading or trailing anchor of a node. + private static RegexNodeKind FindLeadingOrTrailingAnchor(RegexNode node, bool leading) { - RegexNode curNode = tree.Root; - RegexNode? concatNode = null; - int nextChild = 0; + if (!StackHelper.TryEnsureSufficientExecutionStack()) + { + // We only recur for alternations, but with a really deep nesting of alternations we could potentially overflow. + // In such a case, simply stop searching for an anchor. + return RegexNodeKind.Unknown; + } while (true) { - switch (curNode.Kind) + switch (node.Kind) { case RegexNodeKind.Bol: - return Bol; - case RegexNodeKind.Eol: - return Eol; - - case RegexNodeKind.Boundary: - return Boundary; - - case RegexNodeKind.ECMABoundary: - return ECMABoundary; - case RegexNodeKind.Beginning: - return Beginning; - case RegexNodeKind.Start: - return Start; - case RegexNodeKind.EndZ: - return EndZ; - case RegexNodeKind.End: - return End; + case RegexNodeKind.Boundary: + case RegexNodeKind.ECMABoundary: + // Return any anchor found. + return node.Kind; + + case RegexNodeKind.Atomic: + case RegexNodeKind.Capture: + // For groups, continue exploring the sole child. + node = node.Child(0); + continue; case RegexNodeKind.Concatenate: - if (curNode.ChildCount() > 0) + // For concatenations, we expect primarily to explore its first (for leading) or last (for trailing) child, + // but we can also skip over certain kinds of nodes (e.g. Empty), and thus iterate through its children backward + // looking for the last we shouldn't skip. { - concatNode = curNode; - nextChild = 0; + int childCount = node.ChildCount(); + RegexNode? child = null; + if (leading) + { + for (int i = 0; i < childCount; i++) + { + if (node.Child(i).Kind is not (RegexNodeKind.Empty or RegexNodeKind.PositiveLookaround or RegexNodeKind.NegativeLookaround)) + { + child = node.Child(i); + break; + } + } + } + else + { + for (int i = childCount - 1; i >= 0; i--) + { + if (node.Child(i).Kind is not (RegexNodeKind.Empty or RegexNodeKind.PositiveLookaround or RegexNodeKind.NegativeLookaround)) + { + child = node.Child(i); + break; + } + } + } + + if (child is not null) + { + node = child; + continue; + } + + goto default; } - break; - case RegexNodeKind.Atomic: - case RegexNodeKind.Capture: - curNode = curNode.Child(0); - concatNode = null; - continue; + case RegexNodeKind.Alternate: + // For alternations, every branch needs to lead or trail with the same anchor. + { + // Get the leading/trailing anchor of the first branch. If there isn't one, bail. + RegexNodeKind anchor = FindLeadingOrTrailingAnchor(node.Child(0), leading); + if (anchor == RegexNodeKind.Unknown) + { + return RegexNodeKind.Unknown; + } - case RegexNodeKind.Empty: - case RegexNodeKind.PositiveLookaround: - case RegexNodeKind.NegativeLookaround: - break; + // Look at each subsequent branch and validate it has the same leading or trailing + // anchor. If any doesn't, bail. + int childCount = node.ChildCount(); + for (int i = 1; i < childCount; i++) + { + if (FindLeadingOrTrailingAnchor(node.Child(i), leading) != anchor) + { + return RegexNodeKind.Unknown; + } + } - default: - return 0; - } + // All branches have the same leading/trailing anchor. Return it. + return anchor; + } - if (concatNode == null || nextChild >= concatNode.ChildCount()) - { - return 0; + default: + // For everything else, we couldn't find an anchor. + return RegexNodeKind.Unknown; } - - curNode = concatNode.Child(nextChild++); } } -#if DEBUG - [ExcludeFromCodeCoverage] - public static string AnchorDescription(int anchors) - { - var sb = new StringBuilder(); - - if ((anchors & Beginning) != 0) sb.Append(", Beginning"); - if ((anchors & Start) != 0) sb.Append(", Start"); - if ((anchors & Bol) != 0) sb.Append(", Bol"); - if ((anchors & Boundary) != 0) sb.Append(", Boundary"); - if ((anchors & ECMABoundary) != 0) sb.Append(", ECMABoundary"); - if ((anchors & Eol) != 0) sb.Append(", Eol"); - if ((anchors & End) != 0) sb.Append(", End"); - if ((anchors & EndZ) != 0) sb.Append(", EndZ"); - - return sb.Length >= 2 ? - sb.ToString(2, sb.Length - 2) : - "None"; - } -#endif - /// /// To avoid recursion, we use a simple integer stack. /// diff --git a/src/libraries/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs b/src/libraries/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs index 005e9b27bb203a..e3e466dd64ece3 100644 --- a/src/libraries/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs +++ b/src/libraries/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs @@ -284,8 +284,42 @@ public static IEnumerable Match_MemberData() // Using beginning/end of string chars \A, \Z: Actual - "\\Aaaa\\w+zzz\\Z" yield return (@"\Aaaa\w+zzz\Z", "aaaasdfajsdlfjzzza", RegexOptions.None, 0, 18, false, string.Empty); + // Anchors + foreach (RegexOptions anchorOptions in new[] { RegexOptions.None, RegexOptions.Multiline }) + { + yield return (@"^abc", "abc", anchorOptions, 0, 3, true, "abc"); + yield return (@"^abc", " abc", anchorOptions, 0, 4, false, ""); + yield return (@"^abc|^def", "def", anchorOptions, 0, 3, true, "def"); + yield return (@"^abc|^def", " abc", anchorOptions, 0, 4, false, ""); + yield return (@"^abc|^def", " def", anchorOptions, 0, 4, false, ""); + yield return (@"abc|^def", " abc", anchorOptions, 0, 4, true, "abc"); + yield return (@"abc|^def|^efg", " abc", anchorOptions, 0, 4, true, "abc"); + yield return (@"^abc|def|^efg", " def", anchorOptions, 0, 4, true, "def"); + yield return (@"^abc|def", " def", anchorOptions, 0, 4, true, "def"); + yield return (@"abcd$", "1234567890abcd", anchorOptions, 0, 14, true, "abcd"); + yield return (@"abc{1,4}d$", "1234567890abcd", anchorOptions, 0, 14, true, "abcd"); + yield return (@"abc{1,4}d$", "1234567890abccccd", anchorOptions, 0, 17, true, "abccccd"); + } + if (!RegexHelpers.IsNonBacktracking(engine)) + { + yield return (@"\Gabc", "abc", RegexOptions.None, 0, 3, true, "abc"); + yield return (@"\Gabc", " abc", RegexOptions.None, 0, 4, false, ""); + yield return (@"\Gabc", " abc", RegexOptions.None, 1, 3, true, "abc"); + yield return (@"\Gabc|\Gdef", "def", RegexOptions.None, 0, 3, true, "def"); + yield return (@"\Gabc|\Gdef", " abc", RegexOptions.None, 0, 4, false, ""); + yield return (@"\Gabc|\Gdef", " def", RegexOptions.None, 0, 4, false, ""); + yield return (@"\Gabc|\Gdef", " abc", RegexOptions.None, 1, 3, true, "abc"); + yield return (@"\Gabc|\Gdef", " def", RegexOptions.None, 1, 3, true, "def"); + yield return (@"abc|\Gdef", " abc", RegexOptions.None, 0, 4, true, "abc"); + yield return (@"\Gabc|def", " def", RegexOptions.None, 0, 4, true, "def"); + } + // Anchors and multiline - yield return (@"^A$", "ABC\n", RegexOptions.Multiline, 0, 2, false, string.Empty); + yield return (@"^A$", "A\n", RegexOptions.Multiline, 0, 2, true, "A"); + yield return (@"^A$", "ABC\n", RegexOptions.Multiline, 0, 4, false, string.Empty); + yield return (@"^A$", "123\nA", RegexOptions.Multiline, 0, 5, true, "A"); + yield return (@"^A$", "123\nA\n456", RegexOptions.Multiline, 0, 9, true, "A"); + yield return (@"^A$|^B$", "123\nB\n456", RegexOptions.Multiline, 0, 9, true, "B"); // Using beginning/end of string chars \A, \Z: Actual - "\\Aaaa\\w+zzz\\Z" yield return (@"\A(line2\n)line3\Z", "line2\nline3\n", RegexOptions.Multiline, 0, 12, true, "line2\nline3"); @@ -905,7 +939,7 @@ private async Task Match_TestThatTimeoutHappens(RegexEngine engine) } string input = new string(chars); - Regex re = await RegexHelpers.GetRegexAsync(engine, @"a.{20}$", RegexOptions.None, TimeSpan.FromMilliseconds(10)); + Regex re = await RegexHelpers.GetRegexAsync(engine, @"a.{20}^", RegexOptions.None, TimeSpan.FromMilliseconds(10)); Assert.Throws(() => { re.Match(input); }); } diff --git a/src/libraries/System.Text.RegularExpressions/tests/RegexReductionTests.cs b/src/libraries/System.Text.RegularExpressions/tests/RegexReductionTests.cs index 38cf72a3f52380..65ef818124a425 100644 --- a/src/libraries/System.Text.RegularExpressions/tests/RegexReductionTests.cs +++ b/src/libraries/System.Text.RegularExpressions/tests/RegexReductionTests.cs @@ -18,6 +18,8 @@ public class RegexReductionTests private static readonly FieldInfo s_regexCode; private static readonly FieldInfo s_regexCodeCodes; private static readonly FieldInfo s_regexCodeTree; + private static readonly FieldInfo s_regexCodeFindOptimizations; + private static readonly PropertyInfo s_regexCodeFindOptimizationsMaxPossibleLength; private static readonly FieldInfo s_regexCodeTreeMinRequiredLength; static RegexReductionTests() @@ -31,6 +33,12 @@ static RegexReductionTests() s_regexCode = typeof(Regex).GetField("_code", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); Assert.NotNull(s_regexCode); + s_regexCodeFindOptimizations = s_regexCode.FieldType.GetField("FindOptimizations", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); + Assert.NotNull(s_regexCodeFindOptimizations); + + s_regexCodeFindOptimizationsMaxPossibleLength = s_regexCodeFindOptimizations.FieldType.GetProperty("MaxPossibleLength", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); + Assert.NotNull(s_regexCodeFindOptimizationsMaxPossibleLength); + s_regexCodeCodes = s_regexCode.FieldType.GetField("Codes", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); Assert.NotNull(s_regexCodeCodes); @@ -71,6 +79,20 @@ private static int GetMinRequiredLength(Regex r) return (int)minRequiredLength; } + private static int? GetMaxPossibleLength(Regex r) + { + object code = s_regexCode.GetValue(r); + Assert.NotNull(code); + + object findOpts = s_regexCodeFindOptimizations.GetValue(code); + Assert.NotNull(findOpts); + + object maxPossibleLength = s_regexCodeFindOptimizationsMaxPossibleLength.GetValue(findOpts); + Assert.True(maxPossibleLength is null || maxPossibleLength is int); + + return (int?)maxPossibleLength; + } + [Theory] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Many of these optimizations don't exist in .NET Framework.")] // Two greedy one loops @@ -535,70 +557,100 @@ public void PatternsReduceDifferently(string pattern1, string pattern2) [Theory] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Not computed in netfx")] - [InlineData(@"a", 1)] - [InlineData(@"[^a]", 1)] - [InlineData(@"[abcdefg]", 1)] - [InlineData(@"abcd", 4)] - [InlineData(@"a*", 0)] - [InlineData(@"a*?", 0)] - [InlineData(@"a?", 0)] - [InlineData(@"a??", 0)] - [InlineData(@"a+", 1)] - [InlineData(@"a+?", 1)] - [InlineData(@"a{2}", 2)] - [InlineData(@"a{2}?", 2)] - [InlineData(@"a{3,17}", 3)] - [InlineData(@"a{3,17}?", 3)] - [InlineData(@"(abcd){5}", 20)] - [InlineData(@"(abcd|ef){2,6}", 4)] - [InlineData(@"abcef|de", 2)] - [InlineData(@"abc(def|ghij)k", 7)] - [InlineData(@"\d{1,2}-\d{1,2}-\d{2,4}", 6)] - [InlineData(@"1(?=9)\d", 2)] - [InlineData(@"1(?!\d)\w", 2)] - [InlineData(@"a*a*a*a*a*a*a*b*", 0)] - [InlineData(@"((a{1,2}){4}){3,7}", 12)] - [InlineData(@"\b\w{4}\b", 4)] - [InlineData(@"abcd(?=efgh)efgh", 8)] - [InlineData(@"abcd(?<=cd)efgh", 8)] - [InlineData(@"abcd(?!ab)efgh", 8)] - [InlineData(@"abcd(?\d{1,2})-\d{2,4}", RegexOptions.None, 6, 10)] + [InlineData(@"1(?=9)\d", RegexOptions.None, 2, 2)] + [InlineData(@"1(?!\d)\w", RegexOptions.None, 2, 2)] + [InlineData(@"a*a*a*a*a*a*a*b*", RegexOptions.None, 0, null)] + [InlineData(@"((a{1,2}){4}){3,7}", RegexOptions.None, 12, 56)] + [InlineData(@"((a{1,2}){4}?){3,7}", RegexOptions.None, 12, 56)] + [InlineData(@"\b\w{4}\b", RegexOptions.None, 4, 4)] + [InlineData(@"\b\w{4}\b", RegexOptions.ECMAScript, 4, 4)] + [InlineData(@"abcd(?=efgh)efgh", RegexOptions.None, 8, 8)] + [InlineData(@"abcd(?<=cd)efgh", RegexOptions.None, 8, 8)] + [InlineData(@"abcd(?!ab)efgh", RegexOptions.None, 8, 8)] + [InlineData(@"abcd(? Date: Tue, 25 Jan 2022 17:35:28 +0300 Subject: [PATCH 057/161] Add the exception set for `ObjGetType` (#64106) * Model NRE for ObjGetType * Add tests --- src/coreclr/jit/gentree.cpp | 18 +++------ src/coreclr/jit/namedintrinsiclist.h | 5 ++- src/coreclr/jit/valuenum.cpp | 3 +- .../JIT/opt/ValueNumbering/ExceptionSets.cs | 37 +++++++++++++++++++ .../opt/ValueNumbering/ExceptionSets.csproj | 13 +++++++ 5 files changed, 61 insertions(+), 15 deletions(-) create mode 100644 src/tests/JIT/opt/ValueNumbering/ExceptionSets.cs create mode 100644 src/tests/JIT/opt/ValueNumbering/ExceptionSets.csproj diff --git a/src/coreclr/jit/gentree.cpp b/src/coreclr/jit/gentree.cpp index 8c9450cfbf5649..68a7b49d74dbb4 100644 --- a/src/coreclr/jit/gentree.cpp +++ b/src/coreclr/jit/gentree.cpp @@ -5226,7 +5226,7 @@ bool GenTree::OperRequiresCallFlag(Compiler* comp) // Return Value: // True if the given node contains an implicit indirection // -// Note that for the GT_HWINTRINSIC node we have to examine the +// Note that for the [HW]INTRINSIC nodes we have to examine the // details of the node to determine its result. // @@ -5250,6 +5250,8 @@ bool GenTree::OperIsImplicitIndir() const case GT_ARR_ELEM: case GT_ARR_OFFSET: return true; + case GT_INTRINSIC: + return AsIntrinsic()->gtIntrinsicName == NI_System_Object_GetType; #ifdef FEATURE_SIMD case GT_SIMD: { @@ -5306,18 +5308,8 @@ bool GenTree::OperMayThrow(Compiler* comp) case GT_INTRINSIC: // If this is an intrinsic that represents the object.GetType(), it can throw an NullReferenceException. - // Report it as may throw. - // Note: Some of the rest of the existing intrinsics could potentially throw an exception (for example - // the array and string element access ones). They are handled differently than the GetType intrinsic - // and are not marked with GTF_EXCEPT. If these are revisited at some point to be marked as - // GTF_EXCEPT, - // the code below might need to be specialized to handle them properly. - if ((this->gtFlags & GTF_EXCEPT) != 0) - { - return true; - } - - break; + // Currently, this is the only intrinsic that can throw an exception. + return AsIntrinsic()->gtIntrinsicName == NI_System_Object_GetType; case GT_CALL: diff --git a/src/coreclr/jit/namedintrinsiclist.h b/src/coreclr/jit/namedintrinsiclist.h index 7b2108d3edd057..68ea721ae48180 100644 --- a/src/coreclr/jit/namedintrinsiclist.h +++ b/src/coreclr/jit/namedintrinsiclist.h @@ -4,7 +4,10 @@ #ifndef _NAMEDINTRINSICLIST_H_ #define _NAMEDINTRINSICLIST_H_ -// Named jit intrinsics +// Named jit intrinsics. + +// When adding a new intrinsic that will use the GT_INTRINSIC node and can throw, make sure +// to update the "OperMayThrow" and "fgValueNumberAddExceptionSet" methods to account for that. enum NamedIntrinsic : unsigned short { diff --git a/src/coreclr/jit/valuenum.cpp b/src/coreclr/jit/valuenum.cpp index 356124ab00e5cb..3faa6efc7ace9b 100644 --- a/src/coreclr/jit/valuenum.cpp +++ b/src/coreclr/jit/valuenum.cpp @@ -10992,7 +10992,8 @@ void Compiler::fgValueNumberAddExceptionSet(GenTree* tree) break; case GT_INTRINSIC: - // ToDo: model the exceptions for Intrinsics + assert(tree->AsIntrinsic()->gtIntrinsicName == NI_System_Object_GetType); + fgValueNumberAddExceptionSetForIndirection(tree, tree->AsIntrinsic()->gtGetOp1()); break; case GT_IND: diff --git a/src/tests/JIT/opt/ValueNumbering/ExceptionSets.cs b/src/tests/JIT/opt/ValueNumbering/ExceptionSets.cs new file mode 100644 index 00000000000000..6a413303ad194c --- /dev/null +++ b/src/tests/JIT/opt/ValueNumbering/ExceptionSets.cs @@ -0,0 +1,37 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Runtime.CompilerServices; + +#pragma warning disable CS0253 // Possible unintended reference comparison + +class ExceptionSets +{ + public static int Main() + { + try + { + TestObjGetType(null, 0); + return 101; + } + catch (NullReferenceException) { } + + return 100; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + private static bool TestObjGetType(object a, int i) + { + var fls = false; + var c1 = i == 0; + var c2 = c1; + + if (((a.GetType() == a) & fls) | (i == 0)) + { + return true; + } + + return c2; + } +} diff --git a/src/tests/JIT/opt/ValueNumbering/ExceptionSets.csproj b/src/tests/JIT/opt/ValueNumbering/ExceptionSets.csproj new file mode 100644 index 00000000000000..5d8fe225297649 --- /dev/null +++ b/src/tests/JIT/opt/ValueNumbering/ExceptionSets.csproj @@ -0,0 +1,13 @@ + + + Exe + 1 + + + None + True + + + + + From 902db7e364422b9918d3d9d4ee2c1e6362359cf7 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Tue, 25 Jan 2022 06:37:01 -0800 Subject: [PATCH 058/161] [ILVerify] Fix casting check for arrays of generic parameters with class constraints (#64259) Fixes #63999 --- .../Common/TypeSystem/Common/CastingHelper.cs | 28 +++++++++++++++++-- .../CastingTests.cs | 15 ++++++++++ .../CoreTestAssembly/Casting.cs | 4 +++ 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/src/coreclr/tools/Common/TypeSystem/Common/CastingHelper.cs b/src/coreclr/tools/Common/TypeSystem/Common/CastingHelper.cs index 1b067af21b476a..03a59a840e1ded 100644 --- a/src/coreclr/tools/Common/TypeSystem/Common/CastingHelper.cs +++ b/src/coreclr/tools/Common/TypeSystem/Common/CastingHelper.cs @@ -263,7 +263,7 @@ private static bool CanCastParamTo(this ParameterizedType thisType, TypeDesc par else if (curTypesParm.IsGenericParameter) { var genericVariableFromParam = (GenericParameterDesc)curTypesParm; - if (genericVariableFromParam.HasReferenceTypeConstraint) + if (genericVariableFromParam.HasReferenceTypeConstraint || IsConstrainedAsGCPointer(genericVariableFromParam)) { return genericVariableFromParam.CanCastToInternal(paramType, protect); } @@ -281,6 +281,30 @@ private static bool CanCastParamTo(this ParameterizedType thisType, TypeDesc par return false; } + private static bool IsConstrainedAsGCPointer(GenericParameterDesc type) + { + foreach (var typeConstraint in type.TypeConstraints) + { + if (typeConstraint.IsGenericParameter) + { + if (IsConstrainedAsGCPointer((GenericParameterDesc)typeConstraint)) + return true; + } + + if (!typeConstraint.IsInterface && typeConstraint.IsGCPointer) + { + // Object, ValueType, and Enum are GCPointers but they do not constrain the type to GCPointer! + if (!typeConstraint.IsWellKnownType(WellKnownType.Object) && + !typeConstraint.IsWellKnownType(WellKnownType.ValueType) && + !typeConstraint.IsWellKnownType(WellKnownType.Enum)) + { + return true; + } + } + } + return false; + } + private static TypeFlags GetNormalizedIntegralArrayElementType(TypeDesc type) { Debug.Assert(!type.IsEnum); @@ -502,7 +526,7 @@ private static bool IsBoxedAndCanCastTo(this TypeDesc thisType, TypeDesc otherTy else if (thisType.IsGenericParameter) { var genericVariableFromParam = (GenericParameterDesc)thisType; - if (genericVariableFromParam.HasReferenceTypeConstraint) + if (genericVariableFromParam.HasReferenceTypeConstraint || IsConstrainedAsGCPointer(genericVariableFromParam)) { return genericVariableFromParam.CanCastToInternal(otherType, protect); } diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CastingTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CastingTests.cs index f6cd2e187d46c5..4bcf3432f522f3 100644 --- a/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CastingTests.cs +++ b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CastingTests.cs @@ -202,6 +202,21 @@ public void TestNullableCasting() Assert.True(intType.CanCastTo(nullableOfIntType)); } + [Fact] + public void TestGenericParameterArrayCasting() + { + TypeDesc baseArrayType = _testModule.GetType("Casting", "Base").MakeArrayType(); + TypeDesc iFooArrayType = _testModule.GetType("Casting", "IFoo").MakeArrayType(); + + TypeDesc paramArrayWithBaseClassConstraint = + _testModule.GetType("Casting", "ClassWithBaseClassConstraint`1").Instantiation[0].MakeArrayType(); + TypeDesc paramArrayWithInterfaceConstraint = + _testModule.GetType("Casting", "ClassWithInterfaceConstraint`1").Instantiation[0].MakeArrayType(); + + Assert.True(paramArrayWithBaseClassConstraint.CanCastTo(baseArrayType)); + Assert.False(paramArrayWithInterfaceConstraint.CanCastTo(iFooArrayType)); + } + [Fact] public void TestRecursiveCanCast() { diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Casting.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Casting.cs index a6ae700e942a1d..03ce4ae4332cdd 100644 --- a/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Casting.cs +++ b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Casting.cs @@ -3,6 +3,8 @@ namespace Casting { + class Base { } + interface IFoo { } interface IContravariant { } @@ -21,6 +23,8 @@ class ClassWithNoConstraint { } class ClassWithValueTypeConstraint where T : struct { } + class ClassWithBaseClassConstraint where T : Base { } + class ClassWithInterfaceConstraint where T : IFoo { } class ClassWithRecursiveImplementation : IContravariant> { } From 802dc689fdcca6e52e17604048465a50203371b1 Mon Sep 17 00:00:00 2001 From: Koundinya Veluri Date: Tue, 25 Jan 2022 06:47:22 -0800 Subject: [PATCH 059/161] Use lower call count threshold for tiering in debug builds (#60945) * Use lower call count threshold for tiering in debug builds To exercise more paths during tests, see https://github.com/dotnet/runtime/pull/60886 --- src/coreclr/inc/clrconfigvalues.h | 33 ++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/src/coreclr/inc/clrconfigvalues.h b/src/coreclr/inc/clrconfigvalues.h index 28b1010666369f..e1edb2466e65c8 100644 --- a/src/coreclr/inc/clrconfigvalues.h +++ b/src/coreclr/inc/clrconfigvalues.h @@ -562,21 +562,36 @@ RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_GainExponent, /// Tiered Compilation /// #ifdef FEATURE_TIERED_COMPILATION +#ifdef _DEBUG +// Use lower values to exercise more paths sooner +#define TC_BackgroundWorkerTimeoutMs (100) +#define TC_CallCountThreshold (2) +#define TC_CallCountingDelayMs (1) +#define TC_DelaySingleProcMultiplier (2) +#define TC_DeleteCallCountingStubsAfter (1) +#else // !_DEBUG +#define TC_BackgroundWorkerTimeoutMs (4000) +#define TC_CallCountThreshold (30) +#define TC_CallCountingDelayMs (100) +#define TC_DelaySingleProcMultiplier (10) +#define TC_DeleteCallCountingStubsAfter (4096) +#endif // _DEBUG RETAIL_CONFIG_DWORD_INFO(EXTERNAL_TieredCompilation, W("TieredCompilation"), 1, "Enables tiered compilation") RETAIL_CONFIG_DWORD_INFO(EXTERNAL_TC_QuickJit, W("TC_QuickJit"), 1, "For methods that would be jitted, enable using quick JIT when appropriate.") RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_TC_QuickJitForLoops, W("TC_QuickJitForLoops"), 0, "When quick JIT is enabled, quick JIT may also be used for methods that contain loops.") RETAIL_CONFIG_DWORD_INFO(EXTERNAL_TC_AggressiveTiering, W("TC_AggressiveTiering"), 0, "Transition through tiers aggressively.") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_TC_BackgroundWorkerTimeoutMs, W("TC_BackgroundWorkerTimeoutMs"), 4000, "How long in milliseconds the background worker thread may remain idle before exiting.") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_TC_CallCountThreshold, W("TC_CallCountThreshold"), 30, "Number of times a method must be called in tier 0 after which it is promoted to the next tier.") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_TC_CallCountingDelayMs, W("TC_CallCountingDelayMs"), 100, "A perpetual delay in milliseconds that is applied call counting in tier 0 and jitting at higher tiers, while there is startup-like activity.") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_TC_DelaySingleProcMultiplier, W("TC_DelaySingleProcMultiplier"), 10, "Multiplier for TC_CallCountingDelayMs that is applied on a single-processor machine or when the process is affinitized to a single processor.") +RETAIL_CONFIG_DWORD_INFO(INTERNAL_TC_BackgroundWorkerTimeoutMs, W("TC_BackgroundWorkerTimeoutMs"), TC_BackgroundWorkerTimeoutMs, "How long in milliseconds the background worker thread may remain idle before exiting.") +RETAIL_CONFIG_DWORD_INFO(INTERNAL_TC_CallCountThreshold, W("TC_CallCountThreshold"), TC_CallCountThreshold, "Number of times a method must be called in tier 0 after which it is promoted to the next tier.") +RETAIL_CONFIG_DWORD_INFO(INTERNAL_TC_CallCountingDelayMs, W("TC_CallCountingDelayMs"), TC_CallCountingDelayMs, "A perpetual delay in milliseconds that is applied call counting in tier 0 and jitting at higher tiers, while there is startup-like activity.") +RETAIL_CONFIG_DWORD_INFO(INTERNAL_TC_DelaySingleProcMultiplier, W("TC_DelaySingleProcMultiplier"), TC_DelaySingleProcMultiplier, "Multiplier for TC_CallCountingDelayMs that is applied on a single-processor machine or when the process is affinitized to a single processor.") RETAIL_CONFIG_DWORD_INFO(INTERNAL_TC_CallCounting, W("TC_CallCounting"), 1, "Enabled by default (only activates when TieredCompilation is also enabled). If disabled immediately backpatches prestub, and likely prevents any promotion to higher tiers") RETAIL_CONFIG_DWORD_INFO(INTERNAL_TC_UseCallCountingStubs, W("TC_UseCallCountingStubs"), 1, "Uses call counting stubs for faster call counting.") -#ifdef _DEBUG -RETAIL_CONFIG_DWORD_INFO(INTERNAL_TC_DeleteCallCountingStubsAfter, W("TC_DeleteCallCountingStubsAfter"), 1, "Deletes call counting stubs after this many have completed. Zero to disable deleting.") -#else -RETAIL_CONFIG_DWORD_INFO(INTERNAL_TC_DeleteCallCountingStubsAfter, W("TC_DeleteCallCountingStubsAfter"), 4096, "Deletes call counting stubs after this many have completed. Zero to disable deleting.") -#endif +RETAIL_CONFIG_DWORD_INFO(INTERNAL_TC_DeleteCallCountingStubsAfter, W("TC_DeleteCallCountingStubsAfter"), TC_DeleteCallCountingStubsAfter, "Deletes call counting stubs after this many have completed. Zero to disable deleting.") +#undef TC_BackgroundWorkerTimeoutMs +#undef TC_CallCountThreshold +#undef TC_CallCountingDelayMs +#undef TC_DelaySingleProcMultiplier +#undef TC_DeleteCallCountingStubsAfter #endif // FEATURE_TIERED_COMPILATION /// From d910ce301fad2f8e8a4ff82ec7da658d7852b034 Mon Sep 17 00:00:00 2001 From: Steve Pfister Date: Tue, 25 Jan 2022 07:37:06 -0800 Subject: [PATCH 060/161] Skip tests using AsyncIO in FileSystemAclExtensionsTests where it's not supported (#64212) The mono runtime does not yet support AsyncIO on Windows and there were some tests failing on CI because of it. Fixes #64221 --- .../tests/FileSystemAclExtensionsTests.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.IO.FileSystem.AccessControl/tests/FileSystemAclExtensionsTests.cs b/src/libraries/System.IO.FileSystem.AccessControl/tests/FileSystemAclExtensionsTests.cs index 80eb1805310b5b..5a525cf5f60e38 100644 --- a/src/libraries/System.IO.FileSystem.AccessControl/tests/FileSystemAclExtensionsTests.cs +++ b/src/libraries/System.IO.FileSystem.AccessControl/tests/FileSystemAclExtensionsTests.cs @@ -409,7 +409,8 @@ from options in Enum.GetValues() where !(rights == FileSystemRights.CreateFiles && (mode == FileMode.Append || mode == FileMode.Create || mode == FileMode.CreateNew)) && !(mode == FileMode.Truncate && rights != FileSystemRights.Write) && - options != FileOptions.Encrypted // Using FileOptions.Encrypted throws UnauthorizedAccessException when attempting to read the created file + (options != FileOptions.Encrypted && // Using FileOptions.Encrypted throws UnauthorizedAccessException when attempting to read the created file + !(options == FileOptions.Asynchronous && !PlatformDetection.IsAsyncFileIOSupported))// Async IO not supported on Windows using Mono runtime https://github.com/dotnet/runtime/issues/34582 select new object[] { mode, rights, share, options }; [Theory] @@ -432,7 +433,8 @@ public static IEnumerable ReadRights_AllArguments_Data() => from rights in s_readableRights from share in Enum.GetValues() from options in Enum.GetValues() - where options != FileOptions.Encrypted // Using FileOptions.Encrypted throws UnauthorizedAccessException when attempting to read the created file + where options != FileOptions.Encrypted && // Using FileOptions.Encrypted throws UnauthorizedAccessException when attempting to read the created file + !(options == FileOptions.Asynchronous && !PlatformDetection.IsAsyncFileIOSupported) // Async IO not supported on Windows using Mono runtime https://github.com/dotnet/runtime/issues/34582 select new object[] { mode, rights, share, options }; [Theory] From 722ecced8963c83c315104513babd78620502db2 Mon Sep 17 00:00:00 2001 From: Steve Harter Date: Tue, 25 Jan 2022 10:40:34 -0600 Subject: [PATCH 061/161] Correct JsonNode.Root doc (#64238) --- .../System.Text.Json/src/System/Text/Json/Nodes/JsonNode.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Nodes/JsonNode.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Nodes/JsonNode.cs index cfe4a1130db3aa..dc34dcfba82761 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Nodes/JsonNode.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Nodes/JsonNode.cs @@ -140,8 +140,10 @@ public string GetPath() /// /// Gets the root . - /// If the current is a root, is returned. /// + /// + /// The current node is returned if it is a root. + /// public JsonNode Root { get From 233c0644a472d95ac6f0418c2ee3020c1afd4187 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Tue, 25 Jan 2022 11:50:09 -0500 Subject: [PATCH 062/161] Take ARMv6 out of PlatformGroup All (#64267) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Take ARMv6 out of PlatformGroup All, CoreCLR assumes this means full support Co-authored-by: Alexander Köplinger --- eng/pipelines/common/platform-matrix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 0938ee359b4a47..4f0200380bc9f7 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -53,7 +53,7 @@ jobs: ${{ insert }}: ${{ parameters.jobParameters }} # Linux armv6 -- ${{ if or(containsValue(parameters.platforms, 'Linux_armv6'), in(parameters.platformGroup, 'all', 'gcstress')) }}: +- ${{ if or(containsValue(parameters.platforms, 'Linux_armv6'), or(and(ne(parameters.runtimeFlavor, 'mono'), in(parameters.platformGroup, 'gcstress')), and(eq(parameters.runtimeFlavor, 'mono'), in(parameters.platformGroup, 'all', 'gcstress')))) }}: - template: xplat-setup.yml parameters: jobTemplate: ${{ parameters.jobTemplate }} From 74f5ca5a81e03accbaa571018350e781e093acdc Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Tue, 25 Jan 2022 12:52:36 -0500 Subject: [PATCH 063/161] Only send to Helix for rolling build, due to small Helix queue (#64274) --- eng/pipelines/runtime-staging.yml | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/eng/pipelines/runtime-staging.yml b/eng/pipelines/runtime-staging.yml index e06a9a6344d9b9..c51d639d29f0f2 100644 --- a/eng/pipelines/runtime-staging.yml +++ b/eng/pipelines/runtime-staging.yml @@ -261,18 +261,13 @@ jobs: eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true), eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true), - eq(variables['isManualOrIsNotPR'], true), - eq(variables['isFullMatrix'], true)) - # extra steps, run tests - extraStepsTemplate: /eng/pipelines/libraries/helix.yml - extraStepsParameters: - creator: dotnet-bot - testRunNamePrefixSuffix: Mono_$(_BuildConfig) - condition: >- - or( - eq(variables['librariesContainsChange'], true), - eq(variables['monoContainsChange'], true), eq(variables['isRollingBuild'], true)) + ${{ if eq(variables['isRollingBuild'], true) }}: + # extra steps, run tests + extraStepsTemplate: /eng/pipelines/libraries/helix.yml + extraStepsParameters: + creator: dotnet-bot + testRunNamePrefixSuffix: Mono_$(_BuildConfig) # # Build the whole product using Mono and run runtime tests with the JIT. From aa1b4f8e4a029cea54e2a87c1ff027d5a20e323c Mon Sep 17 00:00:00 2001 From: Aaron Robinson Date: Tue, 25 Jan 2022 13:15:47 -0500 Subject: [PATCH 064/161] Add ref field runtime feature indication (#64167) * Add ref field runtime feature indication Co-authored-by: Stephen Toub --- .../src/System/Runtime/CompilerServices/RuntimeFeature.cs | 6 ++++++ src/libraries/System.Runtime/ref/System.Runtime.cs | 1 + 2 files changed, 7 insertions(+) diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeFeature.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeFeature.cs index a94a0e19d01761..9e0a5ed29e42e8 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeFeature.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeFeature.cs @@ -27,6 +27,11 @@ public static partial class RuntimeFeature /// public const string CovariantReturnsOfClasses = nameof(CovariantReturnsOfClasses); + /// + /// Represents a runtime feature where types can define ref fields. + /// + public const string ByRefFields = nameof(ByRefFields); + /// /// Indicates that this version of runtime supports virtual static members of interfaces. /// @@ -42,6 +47,7 @@ public static bool IsSupported(string feature) { case PortablePdb: case CovariantReturnsOfClasses: + case ByRefFields: case UnmanagedSignatureCallingConvention: case DefaultImplementationsOfInterfaces: #pragma warning disable CA2252 diff --git a/src/libraries/System.Runtime/ref/System.Runtime.cs b/src/libraries/System.Runtime/ref/System.Runtime.cs index ea9cc7ecc01808..b8b136aeb3b5a7 100644 --- a/src/libraries/System.Runtime/ref/System.Runtime.cs +++ b/src/libraries/System.Runtime/ref/System.Runtime.cs @@ -13209,6 +13209,7 @@ public RuntimeCompatibilityAttribute() { } } public static partial class RuntimeFeature { + public const string ByRefFields = "ByRefFields"; public const string CovariantReturnsOfClasses = "CovariantReturnsOfClasses"; public const string DefaultImplementationsOfInterfaces = "DefaultImplementationsOfInterfaces"; public const string PortablePdb = "PortablePdb"; From 442a42147ef23c3b9742abcd8b997e8f472af68a Mon Sep 17 00:00:00 2001 From: Egor Bogatov Date: Tue, 25 Jan 2022 21:54:35 +0300 Subject: [PATCH 065/161] Faster IndexOf for substrings (#63285) * Improve "lastChar == firstChar" case, also, use IndexOf directly if value.Length == 1 * Try plain IndexOf first, to optimize cases where even first char of value is never met * add 1-byte implementation * copyrights * fix copy-paste mistake * Initial LastIndexOf impl * More efficient LastIndexOf * fix bug in Char version (we need two clear two lowest bits in the mask) & temporarily remove AdvSimd impl * use ResetLowestSetBit * Fix bug * Add two-byte LastIndexOf * Fix build * Minor optimizations * optimize cases with two-byte/two-char values * Remove gotos, fix build * fix bug in LastIndexOf * Make sure String.LastIndexOf is optimized * Use xplat simd helpers - implicit ARM support * fix arm * Delete \ * Use Vector128.IsHardwareAccelerated * Fix build * Use IsAllZero * Address feedback * Address feedback * micro-optimization, do-while is better here since mask is guaranteed to be non-zero * Address feedabc * Use clever trick I borrowed from IndexOfAny for trailing elements * give up on +1 bump for SequenceCompare * Clean up * Clean up * fix build * Add debug asserts * Clean up: give up on the unrolled trick - too little value from code bloat * Add a test * Fix build * Add byte-specific test * Fix build * Update IndexOfSequence.byte.cs --- THIRD-PARTY-NOTICES.TXT | 29 ++ .../tests/Span/IndexOfSequence.byte.cs | 101 ++++++ .../tests/Span/IndexOfSequence.char.cs | 101 ++++++ .../src/System/MemoryExtensions.cs | 25 +- .../src/System/Numerics/BitOperations.cs | 20 ++ .../src/System/SpanHelpers.Byte.cs | 310 +++++++++++++++--- .../src/System/SpanHelpers.Char.cs | 299 ++++++++++++++++- .../src/System/SpanHelpers.T.cs | 10 +- 8 files changed, 833 insertions(+), 62 deletions(-) diff --git a/THIRD-PARTY-NOTICES.TXT b/THIRD-PARTY-NOTICES.TXT index e38f6ef907d430..55329a8b022944 100644 --- a/THIRD-PARTY-NOTICES.TXT +++ b/THIRD-PARTY-NOTICES.TXT @@ -697,6 +697,35 @@ License for fastmod (https://github.com/lemire/fastmod) and ibm-fpgen (https://g See the License for the specific language governing permissions and limitations under the License. +License for sse4-strstr (https://github.com/WojciechMula/sse4-strstr) +-------------------------------------- + + Copyright (c) 2008-2016, Wojciech Muła + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + License notice for The C++ REST SDK ----------------------------------- diff --git a/src/libraries/System.Memory/tests/Span/IndexOfSequence.byte.cs b/src/libraries/System.Memory/tests/Span/IndexOfSequence.byte.cs index 33250569da2da8..1a9027d0fc7447 100644 --- a/src/libraries/System.Memory/tests/Span/IndexOfSequence.byte.cs +++ b/src/libraries/System.Memory/tests/Span/IndexOfSequence.byte.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. using Xunit; +using System.Collections.Generic; +using System.Runtime.InteropServices; namespace System.SpanTests { @@ -115,5 +117,104 @@ public static void IndexOfSequenceLengthOneValueJustPasttVeryEnd_Byte() int index = span.IndexOf(value); Assert.Equal(-1, index); } + + public static IEnumerable IndexOfSubSeqData_Byte() + { + // searchSpace, value, expected IndexOf value, expected LastIndexOf value + yield return new object[] { new byte[]{0,0,0,0,0},new byte[]{0,0,0}, 0, 2}; + yield return new object[] { new byte[]{0,0,0,0,0,0,0,0,0,0},new byte[]{0,71,0}, -1, -1}; + yield return new object[] { new byte[]{0,0,0,0,0,0,0,0,0,0},new byte[]{0,0,0}, 0, 7}; + yield return new object[] { new byte[]{0,0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0},new byte[]{0,71,0,1,0}, 10, 10}; + yield return new object[] { new byte[]{0,0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0},new byte[]{0,0,0,1,0}, -1, -1}; + yield return new object[] { new byte[]{0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0,0},new byte[]{0,0,0,1,0}, -1, -1}; + yield return new object[] { new byte[]{0,0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0},new byte[]{0,0,0,1,0}, -1, -1}; + yield return new object[] { new byte[]{0,0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0},new byte[]{0,71,1,0,0}, -1, -1}; + yield return new object[] { new byte[]{0,0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0},new byte[]{0,0,1,0,0}, -1, -1}; + yield return new object[] { new byte[]{0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0,0},new byte[]{0,0,1,0,0}, -1, -1}; + yield return new object[] { new byte[]{0,0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0},new byte[]{0,0,1,0,0}, -1, -1}; + yield return new object[] { new byte[]{0,0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0},new byte[]{0,1,0,0,0}, 12, 12}; + yield return new object[] { new byte[]{0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0,0},new byte[]{0,1,0,0,0}, 11, 11}; + yield return new object[] { new byte[]{0,0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0},new byte[]{0,1,0,0,0}, 6, 6}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1},new byte[]{0,0,0,1,0}, -1, -1}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1},new byte[]{0,0,0,1,0}, -1, -1}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1},new byte[]{0,0,0,0,1,0}, -1, -1}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1},new byte[]{0,0,0,0,0,1,0}, -1, -1}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1},new byte[]{0,0,0,0,0,1,0}, -1, -1}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1},new byte[]{0,0,0,0,0,1,0}, -1, -1}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1},new byte[]{0,1,0,0,1,0,0}, -1, -1}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1},new byte[]{0,1,0,0,0,0,0}, 5, 5}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1},new byte[]{0,1,0,0,0,0,0}, 5, 5}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1},new byte[]{0,1,0,0,0,0,0}, 5, 5}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0,0,1,1,0,2,0,1,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0,1,0,0,1,0},new byte[]{0,0,0}, 0, 44}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0,0,1,1,0,2,0,1,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0,1,0,0,1,0},new byte[]{0,0,0,0}, 0, 43}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0,0,1,1,0,2,0,1,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0,1,0,0,1,0},new byte[]{0,0,0,0,0}, 7, 42}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0,0,1,1,0,2,0,1,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0,1,0,0,1,0},new byte[]{0,0,0,0,0,0}, 7, 41}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0,0,1,1,0,2,0,1,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0,1,0,0,1,0},new byte[]{0,0,0,0,0,0,0}, 7, 11}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0,0,1,1,0,2,0,1,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0,1,0,0,1,0},new byte[]{0,0,0,0,0,0,0,0}, 7, 10}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0,0,1,1,0,2,0,1,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0,1,0,0,1,0},new byte[]{0,0,0,0,0,0,0,0,0}, 7, 9}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0,0,1,1,0,2,0,1,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0,1,0,0,1,0},new byte[]{0,0,0,0,0,0,0,0,0,0,0}, 7, 7}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0,0,1,1,0,2,0,1,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0,1,0,0,1,0},new byte[]{0,0,0,0,0,0,0,0,0,0,0,0}, -1, -1}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0,0,1,1,0,2,0,1,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0,1,0,0,1,0},new byte[]{0,0,0,0,0,0,0,0,0,0,0,0,0}, -1, -1}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0,0,1,1,0,2,0,1,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0,1,0,0,1,0},new byte[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0}, -1, -1}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0,0,1,1,0,2,0,1,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0,1,0,0,1,0},new byte[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, -1, -1}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0,0,1,1,0,2,0,1,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0,1,0,0,1,0},new byte[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, -1, -1}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0,0,1,1,0,2,0,1,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0,1,0,0,1,0},new byte[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, -1, -1}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0,0,1,1,0,2,0,1,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0,1,0,0,1,0},new byte[]{0,1,0,0}, 5, 48}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0,0,1,1,0,2,0,1,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0,1,0,0,1,0},new byte[]{0,0,0,1,0}, 44, 44}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0,0,1,1,0,2,0,1,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0,1,0,0,1,0},new byte[]{0,1,0,0,0,0}, 5, 19}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0,0,1,1,0,2,0,1,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0,1,0,0,1,0},new byte[]{0,1,0,0,0,1,0,0}, -1, -1}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0,0,1,1,0,2,0,1,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0,1,0,0,1,0},new byte[]{0,0,0,0,0,0,0}, 7, 11}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0,0,1,1,0,2,0,1,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0,1,0,0,1,0},new byte[]{0,0,1,0,0,1,0,0,0,0}, -1, -1}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0,0,1,1,0,2,0,1,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0,1,0,0,1,0},new byte[]{0,0,0,0,1,0,0,0,0,0}, -1, -1}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0,0,1,1,0,2,0,1,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0,1,0,0,1,0},new byte[]{0,0,0,0,0,0,1,0,0,0,0,0}, -1, -1}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0,0,1,1,0,2,0,1,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0,1,0,0,1,0},new byte[]{0,0,1,0,0,0,0,0,0,0,0,0,0}, -1, -1}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0,0,1,1,0,2,0,1,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0,1,0,0,1,0},new byte[]{0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0}, -1, -1}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0,0,1,1,0,2,0,1,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0,1,0,0,1,0},new byte[]{0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0}, -1, -1}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0,0,1,1,0,2,0,1,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0,1,0,0,1,0},new byte[]{0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, -1, -1}; + yield return new object[] { new byte[]{0,0,0,0,71,0,1,0,0,0,0,0,0,0,0,0,0,0,71,0,1,0,0,0,0,1,1,0,2,0,1,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0,1,0,0,1,0},new byte[]{0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0}, -1, -1}; + yield return new object[] { new byte[]{159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133},new byte[]{159,133,159,133,159,133}, 0, 22}; + yield return new object[] { new byte[]{159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133},new byte[]{159,133,255,159,133}, -1, -1}; + yield return new object[] { new byte[]{159,133,159,133,159,133,159,133,159,133,159,127,159,127,159,127,159,127,159,127,159,127,159,127,159,127,159,127,159,127,159,127,159,127,159,127,159,127,159,127,160,86,160,86,160,86,160,86,160,80},new byte[]{160,86,160,86,160,86,160,86,160,80}, 40, 40}; + yield return new object[] { new byte[]{159,133,159,133,159,133,159,133,159,133,159,127,159,127,159,127,159,127,159,127,159,127,159,127,159,127,159,127,159,127,159,127,159,127,159,127,159,127,159,127,160,86,160,86,160,86,160,86,160,80,160,80,160,80,160,80,160,80,160,80,160,80,160,86,160,86,160,86,160,86},new byte[]{160,86,160,86,160,86,160,86}, 40, 62}; + yield return new object[] { new byte[]{159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133,159,133},new byte[]{0,0,0,1}, -1, -1}; + yield return new object[] { new byte[]{255,160,82,159,134,159,127,255,159,141,160,85,160,82,160,88,255,159,141,159,127,159,134,255,160,88,160,85,160,82,159,141,159,127,159,134,160,88,160,85,160,82,159,141,255,159,127,159,134,160,88,160,85,160,82,159,141,159,127,159,134,160,88,159,141,160,85,255,160,82,159,134,159,141,159,134,160,85,160,82,159,141,159,127,159,134,160,82,159,141,160,85,159,134,255,160,88,159,127,160,82,160,85,159,134,255,159,141,159,127,159,134,160,85,159,141},new byte[]{255,159,141,159,127,159,134,255}, 16, 16}; + yield return new object[] { new byte[]{48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,49,50},new byte[]{49,49}, 29, 29}; + yield return new object[] { new byte[]{48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,49},new byte[]{49,49}, 29, 29}; + yield return new object[] { new byte[]{48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,49,50},new byte[]{49,49}, 29, 29}; + yield return new object[] { new byte[]{49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,50},new byte[]{49,49}, -1, -1}; + yield return new object[] { new byte[]{48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,49,49},new byte[]{49,49,49}, 29, 29}; + yield return new object[] { new byte[]{48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,49,49,50},new byte[]{49,49,49}, 29, 29}; + yield return new object[] { new byte[]{49,49,49,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,50},new byte[]{49,49,49}, 0, 1}; + yield return new object[] { new byte[]{48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,49,50},new byte[]{48,48}, -1, -1}; + yield return new object[] { new byte[]{48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,49},new byte[]{48,48}, -1, -1}; + yield return new object[] { new byte[]{48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,49,50},new byte[]{48,48}, -1, -1}; + yield return new object[] { new byte[]{49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,50},new byte[]{48,48}, -1, -1}; + yield return new object[] { new byte[]{48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,49,49},new byte[]{48,48,48}, -1, -1}; + yield return new object[] { new byte[]{48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,49,49,50},new byte[]{48,48,48}, -1, -1}; + yield return new object[] { new byte[]{49,49,49,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,50},new byte[]{48,48,48}, -1, -1}; + yield return new object[] { new byte[]{48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,49,50},new byte[]{48,49,48,48}, -1, -1}; + yield return new object[] { new byte[]{49,48,49,49,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,50},new byte[]{49,48,49,49}, 0, 0}; + yield return new object[] { new byte[]{49,48,49,49,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,48,49,50},new byte[]{160,80,48,160,80,160,80}, -1, -1}; + yield return new object[] { new byte[]{49,48,49,49,49,49,49,49,49,49,49,49,49,49,49},new byte[]{49,48,49,49,49,49,49,49,49,49,49,49,49,49}, 0, 0}; + yield return new object[] { new byte[]{49,48,49,49,49,49,49,49,49,49,49,49,49,49,49,49,48,49,49,49,49,49,49,49,49,49,49,49,49},new byte[]{49,48,49,49,49,49,49,49,49,49,49,49,49,49}, 0, 15}; + yield return new object[] { new byte[]{49,48,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,48,49,49,49,49,49,49,49,49,49,49,49,49},new byte[]{49,48,49,49,49,49,49,49,49,49,49,49,49,49}, 0, 17}; + yield return new object[] { new byte[]{49,48,49,49,49,49,49,49,71,49,49,49,49,49,49,49,49,49,49,48,49,49,49,49,49,49,49,49,49,49,49,49,49,48,49,49,49,49,49,49,49,49,49,49,49,49},new byte[]{49,48,49,49,49,49,49,49,49,49,49,49,49,49}, 18, 32}; + yield return new object[] { new byte[]{49,48,49,49,49,49,49,49,71,49,49,49,49,49,49,49,49,49,49,48,49,49,49,49,49,49,49,49,49,49,49,49,49,48,49,49,49,49,49,49,49,49,49,49,49,49},new byte[]{49,49,49,49,49,49,49,49,49,49,49,49,49}, 20, 20}; + yield return new object[] { new byte[]{49,48,49,49,49,49,49,49,71,49,49,49,49,49,49,49,49,49,49,48,49,49,49,49,49,49,49,49,49,49,49,49,49,48,49,49,49,49,49,49,49,49,49,49,49,49},new byte[]{49,48,49,49,49,49,49,49,71,49,49,49,49,49,49,49,49,49,49,48,49,49,49,49,49,49,49,49,49,49,49,49,49,48,49,49,49,49,49,49,49,49,49,49,49,49}, 0, 0}; + yield return new object[] { new byte[]{49,48,49,49,49,49,49,49,71,49,49,49,49,49,49,49,49,49,49,48,49,49,49,49,49,49,49,49,49,49,49,49,49,48,49,49,49,49,49,49,49,49,49,49,49,49},new byte[]{49,48,49,49,49,49,49,49,71,49,49,49,49,49,49,49,49,49,49,48,49,49,49,49,49,49,49,49,49,49,49,49,49,48,49,49,49,49,49,49,49,49,49,49,49}, 0, 0}; + yield return new object[] { new byte[]{49,48,49,49,49,49,49,49,71,49,49,49,49,49,49,49,49,49,49,48,49,49,49,49,49,49,49,49,49,49,49,49,49,48,49,49,49,49,49,49,49,49,49,49,49,49},new byte[]{49,48,49,49,49,49,49,49,71,49,49,49,49,49,49,49,49,49,49,48,49,49,49,49,49,49,49,49,49,49,49,49,49,48,49,49,49,49,49,49,49,49,49,49,49,49,49}, -1, -1}; + yield return new object[] { new byte[]{49,48,49,49,49,49,49,49,71,49,49,49,49,49,49,49,49,49,49,48,49,49,49,49,49,49,49,49,49,49,49,49,49,48,49,49,49,49,49,49,49,49,49,49,49,49},new byte[]{49,48,49,49,49,49,49,49,71,49,49,49,49,49,49,49,49,49,49,48,49,49,49,49,49,49,49,49,49,49,49,49,49,48,49,49,49,49,49,49,49,49,49,49,49,49}, 0, 0}; + yield return new object[] { new byte[]{49,48,49,49,49,49,49,49,71,49,49,49,49,49,49,49,49,49,49,48,49,49,49,49,49,49,49,49,49,49,49,49,49,48,49,49,49,49,49,49,49,49,49,49,49,49},new byte[]{49,48,49,49,49,49,49,49,71,49,49,49,49,49,49,49,49,49,49,48,49,49,49,49,49,49,49,49,49,49,49,49,49,48,49,49,49,49,49,49,49,49,49,49,49}, 0, 0}; + yield return new object[] { new byte[]{71,71,71,71,71,71,71,71,71,71,71,71,71,71,49,48,49,49,49,49,49,49,71,49,49,49,49,49,49,49,49,49,49,48,49,49,49,49,49,49,49,49,49,49,49,49,49,48,49,49,49,49,49,49,49,49,49,49,49,49,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71},new byte[]{71,71,71,71,71,71,71,71,71,71,71,71,71,71,71}, 60, 60}; + yield return new object[] { new byte[]{71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,49,48,49,49,49,49,49,49,71,49,49,49,49,49,49,49,49,49,49,48,49,49,49,49,49,49,49,49,49,49,49,49,49,48,49,49,49,49,49,49,49,49,49,49,49,49,71,71,71,71,71,71,71,71,71,71,71,71,71,71},new byte[]{71,71,71,71,71,71,71,71,71,71,71,71,71,71,71}, 0, 0}; + } + + [Theory] + [MemberData(nameof(IndexOfSubSeqData_Byte))] + public static void ValueStartsAndEndsWithTheSameBytes(byte[] searchSpace, byte[] value, int expectedIndexOfValue, int expectedLastIndexOfValue) + { + Assert.Equal(expectedIndexOfValue, searchSpace.AsSpan().IndexOf(value)); + Assert.Equal(expectedLastIndexOfValue, searchSpace.AsSpan().LastIndexOf(value)); + } } } diff --git a/src/libraries/System.Memory/tests/Span/IndexOfSequence.char.cs b/src/libraries/System.Memory/tests/Span/IndexOfSequence.char.cs index bda626153a5d09..b341a79c9b1f33 100644 --- a/src/libraries/System.Memory/tests/Span/IndexOfSequence.char.cs +++ b/src/libraries/System.Memory/tests/Span/IndexOfSequence.char.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. using Xunit; +using System.Collections.Generic; +using System.Runtime.InteropServices; namespace System.SpanTests { @@ -115,5 +117,104 @@ public static void IndexOfSequenceLengthOneValueJustPasttVeryEnd_Char() int index = span.IndexOf(value); Assert.Equal(-1, index); } + + public static IEnumerable IndexOfSubSeqData_Char() + { + // searchSpace, value, expected IndexOf value, expected LastIndexOf value + yield return new object[] { "11111", "111", 0, 2 }; + yield return new object[] { "1111111111", "1x1", -1, -1 }; + yield return new object[] { "1111111111", "111", 0, 7 }; + yield return new object[] { "11111111111x12111", "1x121", 10, 10 }; + yield return new object[] { "11111111111x12111", "11121", -1, -1 }; + yield return new object[] { "1111111111x121111", "11121", -1, -1 }; + yield return new object[] { "11111x12111111111", "11121", -1, -1 }; + yield return new object[] { "11111111111x12111", "1x211", -1, -1 }; + yield return new object[] { "11111111111x12111", "11211", -1, -1 }; + yield return new object[] { "1111111111x121111", "11211", -1, -1 }; + yield return new object[] { "11111x12111111111", "11211", -1, -1 }; + yield return new object[] { "11111111111x12111", "12111", 12, 12 }; + yield return new object[] { "1111111111x121111", "12111", 11, 11 }; + yield return new object[] { "11111x12111111111", "12111", 6, 6 }; + yield return new object[] { "1111x1211111111111x12", "11121", -1, -1 }; + yield return new object[] { "1111x1211111111111x12", "11121", -1, -1 }; + yield return new object[] { "1111x1211111111111x12", "111121", -1, -1 }; + yield return new object[] { "1111x1211111111111x12", "1111121", -1, -1 }; + yield return new object[] { "1111x1211111111111x12", "1111121", -1, -1 }; + yield return new object[] { "1111x1211111111111x12", "1111121", -1, -1 }; + yield return new object[] { "1111x1211111111111x12", "1211211", -1, -1 }; + yield return new object[] { "1111x1211111111111x12", "1211111", 5, 5 }; + yield return new object[] { "1111x1211111111111x12", "1211111", 5, 5 }; + yield return new object[] { "1111x1211111111111x12", "1211111", 5, 5 }; + yield return new object[] { "1111x1211111111111x12111122131221221211221111112121121", "111", 0, 44 }; + yield return new object[] { "1111x1211111111111x12111122131221221211221111112121121", "1111", 0, 43 }; + yield return new object[] { "1111x1211111111111x12111122131221221211221111112121121", "11111", 7, 42 }; + yield return new object[] { "1111x1211111111111x12111122131221221211221111112121121", "111111", 7, 41 }; + yield return new object[] { "1111x1211111111111x12111122131221221211221111112121121", "1111111", 7, 11 }; + yield return new object[] { "1111x1211111111111x12111122131221221211221111112121121", "11111111", 7, 10 }; + yield return new object[] { "1111x1211111111111x12111122131221221211221111112121121", "111111111", 7, 9 }; + yield return new object[] { "1111x1211111111111x12111122131221221211221111112121121", "11111111111", 7, 7 }; + yield return new object[] { "1111x1211111111111x12111122131221221211221111112121121", "111111111111", -1, -1 }; + yield return new object[] { "1111x1211111111111x12111122131221221211221111112121121", "1111111111111", -1, -1 }; + yield return new object[] { "1111x1211111111111x12111122131221221211221111112121121", "11111111111111", -1, -1 }; + yield return new object[] { "1111x1211111111111x12111122131221221211221111112121121", "111111111111111", -1, -1 }; + yield return new object[] { "1111x1211111111111x12111122131221221211221111112121121", "11111111111111111", -1, -1 }; + yield return new object[] { "1111x1211111111111x12111122131221221211221111112121121", "111111111111111111", -1, -1 }; + yield return new object[] { "1111x1211111111111x12111122131221221211221111112121121", "1211", 5, 48 }; + yield return new object[] { "1111x1211111111111x12111122131221221211221111112121121", "11121", 44, 44 }; + yield return new object[] { "1111x1211111111111x12111122131221221211221111112121121", "121111", 5, 19 }; + yield return new object[] { "1111x1211111111111x12111122131221221211221111112121121", "12111211", -1, -1 }; + yield return new object[] { "1111x1211111111111x12111122131221221211221111112121121", "1111111", 7, 11 }; + yield return new object[] { "1111x1211111111111x12111122131221221211221111112121121", "1121121111", -1, -1 }; + yield return new object[] { "1111x1211111111111x12111122131221221211221111112121121", "1111211111", -1, -1 }; + yield return new object[] { "1111x1211111111111x12111122131221221211221111112121121", "111111211111", -1, -1 }; + yield return new object[] { "1111x1211111111111x12111122131221221211221111112121121", "1121111111111", -1, -1 }; + yield return new object[] { "1111x1211111111111x12111122131221221211221111112121121", "11122111112111111", -1, -1 }; + yield return new object[] { "1111x1211111111111x12111122131221221211221111112121121", "1111111211111111", -1, -1 }; + yield return new object[] { "1111x1211111111111x12111122131221221211221111112121121", "111211111111111111", -1, -1 }; + yield return new object[] { "1111x1211111111111x12111122131221221211221111112121121", "11111211111121111111", -1, -1 }; + yield return new object[] { "жжжжжжжжжжжжжж", "жжж", 0, 11 }; + yield return new object[] { "жжжжжжжжжжжжжжжжжжжжжжжжжжжж", "ж0ж", -1, -1 }; + yield return new object[] { "жжжжжаааааааааааааааччччс", "ччччс", 20, 20 }; + yield return new object[] { "жжжжжаааааааааааааааччччсссссссчччч", "чччч", 20, 31 }; + yield return new object[] { "жжжжжжжжжжжжжжжжжжжжжжжжжжжж", "1112", -1, -1 }; + yield return new object[] { "0уза0оцущ0оаз0щцуоазщцуо0азщцуоазщоц0узозцуоазуоцз0щауцз0оазцо", "0оаз0", 9, 9 }; + yield return new object[] { "abababababababababababababababbc", "bb", 29, 29 }; + yield return new object[] { "abababababababababababababababb", "bb", 29, 29 }; + yield return new object[] { "abababababababababababababababbc", "bb", 29, 29 }; + yield return new object[] { "babababababababababababababababc", "bb", -1, -1 }; + yield return new object[] { "abababababababababababababababbb", "bbb", 29, 29 }; + yield return new object[] { "abababababababababababababababbbc", "bbb", 29, 29 }; + yield return new object[] { "bbbbabababababababababababababababc", "bbb", 0, 1 }; + yield return new object[] { "abababababababababababababababbc", "aa", -1, -1 }; + yield return new object[] { "abababababababababababababababb", "aa", -1, -1 }; + yield return new object[] { "abababababababababababababababbc", "aa", -1, -1 }; + yield return new object[] { "babababababababababababababababc", "aa", -1, -1 }; + yield return new object[] { "abababababababababababababababbb", "aaa", -1, -1 }; + yield return new object[] { "abababababababababababababababbbc", "aaa", -1, -1 }; + yield return new object[] { "bbbbabababababababababababababababc", "aaa", -1, -1 }; + yield return new object[] { "ababababababababababababababababbc", "abaa", -1, -1 }; + yield return new object[] { "babbbabababababababababababababababc", "babb", 0, 0 }; + yield return new object[] { "babbbabababababababababababababababc", "сaсс", -1, -1 }; + yield return new object[] { "babbbbbbbbbbbbb", "babbbbbbbbbbbb", 0, 0 }; + yield return new object[] { "babbbbbbbbbbbbbbabbbbbbbbbbbb", "babbbbbbbbbbbb", 0, 15 }; + yield return new object[] { "babbbbbbbbbbbbbbbbabbbbbbbbbbbb", "babbbbbbbbbbbb", 0, 17 }; + yield return new object[] { "babbbbbbxbbbbbbbbbbabbbbbbbbbbbbbabbbbbbbbbbbb", "babbbbbbbbbbbb", 18, 32 }; + yield return new object[] { "babbbbbbxbbbbbbbbbbabbbbbbbbbbbbbabbbbbbbbbbbb", "bbbbbbbbbbbbb", 20, 20 }; + yield return new object[] { "babbbbbbxbbbbbbbbbbabbbbbbbbbbbbbabbbbbbbbbbbb", "babbbbbbxbbbbbbbbbbabbbbbbbbbbbbbabbbbbbbbbbbb", 0, 0 }; + yield return new object[] { "babbbbbbxbbbbbbbbbbabbbbbbbbbbbbbabbbbbbbbbbbb", "babbbbbbxbbbbbbbbbbabbbbbbbbbbbbbabbbbbbbbbbb", 0, 0 }; + yield return new object[] { "babbbbbbxbbbbbbbbbbabbbbbbbbbbbbbabbbbbbbbbbbb", "babbbbbbxbbbbbbbbbbabbbbbbbbbbbbbabbbbbbbbbbbbb", -1, -1 }; + yield return new object[] { "babbbbbbxbbbbbbbbbbabbbbbbbbbbbbbabbbbbbbbbbbb", "babbbbbbxbbbbbbbbbbabbbbbbbbbbbbbabbbbbbbbbbbb", 0, 0 }; + yield return new object[] { "babbbbbbxbbbbbbbbbbabbbbbbbbbbbbbabbbbbbbbbbbb", "babbbbbbxbbbbbbbbbbabbbbbbbbbbbbbabbbbbbbbbbb", 0, 0 }; + yield return new object[] { "xxxxxxxxxxxxxxbabbbbbbxbbbbbbbbbbabbbbbbbbbbbbbabbbbbbbbbbbbxxxxxxxxxxxxxxx", "xxxxxxxxxxxxxxx", 60, 60 }; + yield return new object[] { "xxxxxxxxxxxxxxxbabbbbbbxbbbbbbbbbbabbbbbbbbbbbbbabbbbbbbbbbbbxxxxxxxxxxxxxx", "xxxxxxxxxxxxxxx", 0, 0 }; + } + + [Theory] + [MemberData(nameof(IndexOfSubSeqData_Char))] + public static void ValueStartsAndEndsWithTheSameChars(string searchSpace, string value, int expectedIndexOfValue, int expectedLastIndexOfValue) + { + Assert.Equal(expectedIndexOfValue, searchSpace.AsSpan().IndexOf(value)); + Assert.Equal(expectedLastIndexOfValue, searchSpace.AsSpan().LastIndexOf(value)); + } } } diff --git a/src/libraries/System.Private.CoreLib/src/System/MemoryExtensions.cs b/src/libraries/System.Private.CoreLib/src/System/MemoryExtensions.cs index b49dea6f3638ac..3c7c13fa645f06 100644 --- a/src/libraries/System.Private.CoreLib/src/System/MemoryExtensions.cs +++ b/src/libraries/System.Private.CoreLib/src/System/MemoryExtensions.cs @@ -580,12 +580,25 @@ ref Unsafe.As(ref MemoryMarshal.GetReference(span)), [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int LastIndexOf(this ReadOnlySpan span, ReadOnlySpan value) where T : IEquatable { - if (Unsafe.SizeOf() == sizeof(byte) && RuntimeHelpers.IsBitwiseEquatable()) - return SpanHelpers.LastIndexOf( - ref Unsafe.As(ref MemoryMarshal.GetReference(span)), - span.Length, - ref Unsafe.As(ref MemoryMarshal.GetReference(value)), - value.Length); + if (RuntimeHelpers.IsBitwiseEquatable()) + { + if (Unsafe.SizeOf() == sizeof(byte)) + { + return SpanHelpers.LastIndexOf( + ref Unsafe.As(ref MemoryMarshal.GetReference(span)), + span.Length, + ref Unsafe.As(ref MemoryMarshal.GetReference(value)), + value.Length); + } + if (Unsafe.SizeOf() == sizeof(char)) + { + return SpanHelpers.LastIndexOf( + ref Unsafe.As(ref MemoryMarshal.GetReference(span)), + span.Length, + ref Unsafe.As(ref MemoryMarshal.GetReference(value)), + value.Length); + } + } return SpanHelpers.LastIndexOf(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(value), value.Length); } diff --git a/src/libraries/System.Private.CoreLib/src/System/Numerics/BitOperations.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/BitOperations.cs index 6a7141cd01cd48..419a1c9f5f1146 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Numerics/BitOperations.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/BitOperations.cs @@ -708,5 +708,25 @@ public static nuint RotateRight(nuint value, int offset) return (nuint)RotateRight((uint)value, offset); #endif } + + /// + /// Reset the lowest significant bit in the given value + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + internal static uint ResetLowestSetBit(uint value) + { + // It's lowered to BLSR on x86 + return value & (value - 1); + } + + /// + /// Reset specific bit in the given value + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + internal static uint ResetBit(uint value, int bitPos) + { + // TODO: Recognize BTR on x86 and LSL+BIC on ARM + return value & ~(uint)(1 << bitPos); + } } } diff --git a/src/libraries/System.Private.CoreLib/src/System/SpanHelpers.Byte.cs b/src/libraries/System.Private.CoreLib/src/System/SpanHelpers.Byte.cs index e94b1dfe672b2b..3a3bc586912ae8 100644 --- a/src/libraries/System.Private.CoreLib/src/System/SpanHelpers.Byte.cs +++ b/src/libraries/System.Private.CoreLib/src/System/SpanHelpers.Byte.cs @@ -22,12 +22,21 @@ public static int IndexOf(ref byte searchSpace, int searchSpaceLength, ref byte if (valueLength == 0) return 0; // A zero-length sequence is always treated as "found" at the start of the search space. - byte valueHead = value; - ref byte valueTail = ref Unsafe.Add(ref value, 1); int valueTailLength = valueLength - 1; - int remainingSearchSpaceLength = searchSpaceLength - valueTailLength; + if (valueTailLength == 0) + return IndexOf(ref searchSpace, value, searchSpaceLength); // for single-byte values use plain IndexOf int offset = 0; + byte valueHead = value; + int searchSpaceMinusValueTailLength = searchSpaceLength - valueTailLength; + if (Vector128.IsHardwareAccelerated && searchSpaceMinusValueTailLength >= Vector128.Count) + { + goto SEARCH_TWO_BYTES; + } + + ref byte valueTail = ref Unsafe.Add(ref value, 1); + int remainingSearchSpaceLength = searchSpaceMinusValueTailLength; + while (remainingSearchSpaceLength > 0) { // Do a quick search for the first element of "value". @@ -42,13 +51,264 @@ public static int IndexOf(ref byte searchSpace, int searchSpaceLength, ref byte break; // The unsearched portion is now shorter than the sequence we're looking for. So it can't be there. // Found the first element of "value". See if the tail matches. - if (SequenceEqual(ref Unsafe.Add(ref searchSpace, offset + 1), ref valueTail, (nuint)valueTailLength)) // The (nuint)-cast is necessary to pick the correct overload + if (SequenceEqual( + ref Unsafe.Add(ref searchSpace, offset + 1), + ref valueTail, (nuint)(uint)valueTailLength)) // The (nuint)-cast is necessary to pick the correct overload return offset; // The tail matched. Return a successful find. remainingSearchSpaceLength--; offset++; } return -1; + + // Based on http://0x80.pl/articles/simd-strfind.html#algorithm-1-generic-simd "Algorithm 1: Generic SIMD" by Wojciech Muła + // Some details about the implementation can also be found in https://github.com/dotnet/runtime/pull/63285 + SEARCH_TWO_BYTES: + if (Avx2.IsSupported && searchSpaceMinusValueTailLength - Vector256.Count >= 0) + { + // Find the last unique (which is not equal to ch1) byte + // the algorithm is fine if both are equal, just a little bit less efficient + byte ch2Val = Unsafe.Add(ref value, valueTailLength); + int ch1ch2Distance = valueTailLength; + while (ch2Val == value && ch1ch2Distance > 1) + ch2Val = Unsafe.Add(ref value, --ch1ch2Distance); + + Vector256 ch1 = Vector256.Create(value); + Vector256 ch2 = Vector256.Create(ch2Val); + + do + { + Debug.Assert(offset >= 0); + // Make sure we don't go out of bounds + Debug.Assert(offset + ch1ch2Distance + Vector256.Count <= searchSpaceLength); + + Vector256 cmpCh1 = Vector256.Equals(ch1, Vector256.LoadUnsafe(ref searchSpace, (nuint)offset)); + Vector256 cmpCh2 = Vector256.Equals(ch2, Vector256.LoadUnsafe(ref searchSpace, (nuint)(offset + ch1ch2Distance))); + Vector256 cmpAnd = (cmpCh1 & cmpCh2).AsByte(); + + // Early out: cmpAnd is all zeros + if (cmpAnd != Vector256.Zero) + { + uint mask = cmpAnd.ExtractMostSignificantBits(); + do + { + int bitPos = BitOperations.TrailingZeroCount(mask); + if (valueLength == 2 || // we already matched two bytes + SequenceEqual( + ref Unsafe.Add(ref searchSpace, offset + bitPos), + ref value, (nuint)(uint)valueLength)) // The (nuint)-cast is necessary to pick the correct overload + { + return offset + bitPos; + } + mask = BitOperations.ResetLowestSetBit(mask); // Clear the lowest set bit + } while (mask != 0); + } + offset += Vector256.Count; + + if (offset == searchSpaceMinusValueTailLength) + return -1; + + // Overlap with the current chunk for trailing elements + if (offset > searchSpaceMinusValueTailLength - Vector256.Count) + offset = searchSpaceMinusValueTailLength - Vector256.Count; + } while (true); + } + else // 128bit vector path (SSE2 or AdvSimd) + { + // Find the last unique (which is not equal to ch1) byte + // the algorithm is fine if both are equal, just a little bit less efficient + byte ch2Val = Unsafe.Add(ref value, valueTailLength); + int ch1ch2Distance = valueTailLength; + while (ch2Val == value && ch1ch2Distance > 1) + ch2Val = Unsafe.Add(ref value, --ch1ch2Distance); + + Vector128 ch1 = Vector128.Create(value); + Vector128 ch2 = Vector128.Create(ch2Val); + + do + { + Debug.Assert(offset >= 0); + // Make sure we don't go out of bounds + Debug.Assert(offset + ch1ch2Distance + Vector128.Count <= searchSpaceLength); + + Vector128 cmpCh1 = Vector128.Equals(ch1, Vector128.LoadUnsafe(ref searchSpace, (nuint)offset)); + Vector128 cmpCh2 = Vector128.Equals(ch2, Vector128.LoadUnsafe(ref searchSpace, (nuint)(offset + ch1ch2Distance))); + Vector128 cmpAnd = (cmpCh1 & cmpCh2).AsByte(); + + // Early out: cmpAnd is all zeros + if (cmpAnd != Vector128.Zero) + { + uint mask = cmpAnd.ExtractMostSignificantBits(); + do + { + int bitPos = BitOperations.TrailingZeroCount(mask); + if (valueLength == 2 || // we already matched two bytes + SequenceEqual( + ref Unsafe.Add(ref searchSpace, offset + bitPos), + ref value, (nuint)(uint)valueLength)) // The (nuint)-cast is necessary to pick the correct overload + { + return offset + bitPos; + } + // Clear the lowest set bit + mask = BitOperations.ResetLowestSetBit(mask); + } while (mask != 0); + } + offset += Vector128.Count; + + if (offset == searchSpaceMinusValueTailLength) + return -1; + + // Overlap with the current chunk for trailing elements + if (offset > searchSpaceMinusValueTailLength - Vector128.Count) + offset = searchSpaceMinusValueTailLength - Vector128.Count; + } while (true); + } + } + + public static int LastIndexOf(ref byte searchSpace, int searchSpaceLength, ref byte value, int valueLength) + { + Debug.Assert(searchSpaceLength >= 0); + Debug.Assert(valueLength >= 0); + + if (valueLength == 0) + return searchSpaceLength; // A zero-length sequence is always treated as "found" at the end of the search space. + + int valueTailLength = valueLength - 1; + if (valueTailLength == 0) + return LastIndexOf(ref searchSpace, value, searchSpaceLength); // for single-byte values use plain LastIndexOf + + int offset = 0; + byte valueHead = value; + int searchSpaceMinusValueTailLength = searchSpaceLength - valueTailLength; + if (Vector128.IsHardwareAccelerated && searchSpaceMinusValueTailLength >= Vector128.Count) + { + goto SEARCH_TWO_BYTES; + } + + ref byte valueTail = ref Unsafe.Add(ref value, 1); + + while (true) + { + Debug.Assert(0 <= offset && offset <= searchSpaceLength); // Ensures no deceptive underflows in the computation of "remainingSearchSpaceLength". + int remainingSearchSpaceLength = searchSpaceLength - offset - valueTailLength; + if (remainingSearchSpaceLength <= 0) + break; // The unsearched portion is now shorter than the sequence we're looking for. So it can't be there. + + // Do a quick search for the first element of "value". + int relativeIndex = LastIndexOf(ref searchSpace, valueHead, remainingSearchSpaceLength); + if (relativeIndex < 0) + break; + + // Found the first element of "value". See if the tail matches. + if (SequenceEqual( + ref Unsafe.Add(ref searchSpace, relativeIndex + 1), + ref valueTail, (nuint)(uint)valueTailLength)) // The (nuint)-cast is necessary to pick the correct overload + return relativeIndex; // The tail matched. Return a successful find. + + offset += remainingSearchSpaceLength - relativeIndex; + } + return -1; + + // Based on http://0x80.pl/articles/simd-strfind.html#algorithm-1-generic-simd "Algorithm 1: Generic SIMD" by Wojciech Muła + // Some details about the implementation can also be found in https://github.com/dotnet/runtime/pull/63285 + SEARCH_TWO_BYTES: + if (Avx2.IsSupported && searchSpaceMinusValueTailLength >= Vector256.Count) + { + offset = searchSpaceMinusValueTailLength - Vector256.Count; + + // Find the last unique (which is not equal to ch1) byte + // the algorithm is fine if both are equal, just a little bit less efficient + byte ch2Val = Unsafe.Add(ref value, valueTailLength); + int ch1ch2Distance = valueTailLength; + while (ch2Val == value && ch1ch2Distance > 1) + ch2Val = Unsafe.Add(ref value, --ch1ch2Distance); + + Vector256 ch1 = Vector256.Create(value); + Vector256 ch2 = Vector256.Create(ch2Val); + do + { + Vector256 cmpCh1 = Vector256.Equals(ch1, Vector256.LoadUnsafe(ref searchSpace, (nuint)offset)); + Vector256 cmpCh2 = Vector256.Equals(ch2, Vector256.LoadUnsafe(ref searchSpace, (nuint)(offset + ch1ch2Distance))); + Vector256 cmpAnd = (cmpCh1 & cmpCh2).AsByte(); + + // Early out: cmpAnd is all zeros + if (cmpAnd != Vector256.Zero) + { + uint mask = cmpAnd.ExtractMostSignificantBits(); + do + { + // unlike IndexOf, here we use LZCNT to process matches starting from the end + int bitPos = 31 - BitOperations.LeadingZeroCount(mask); + if (valueLength == 2 || // we already matched two bytes + SequenceEqual( + ref Unsafe.Add(ref searchSpace, offset + bitPos), + ref value, (nuint)(uint)valueLength)) // The (nuint)-cast is necessary to pick the correct overload + { + return bitPos + offset; + } + // Clear the highest set bit. + mask = BitOperations.ResetBit(mask, bitPos); + } while (mask != 0); + } + + offset -= Vector256.Count; + if (offset == -Vector256.Count) + return -1; + // Overlap with the current chunk if there is not enough room for the next one + if (offset < 0) + offset = 0; + } while (true); + } + else // 128bit vector path (SSE2 or AdvSimd) + { + offset = searchSpaceMinusValueTailLength - Vector128.Count; + + // Find the last unique (which is not equal to ch1) byte + // the algorithm is fine if both are equal, just a little bit less efficient + byte ch2Val = Unsafe.Add(ref value, valueTailLength); + int ch1ch2Distance = valueTailLength; + while (ch2Val == value && ch1ch2Distance > 1) + ch2Val = Unsafe.Add(ref value, --ch1ch2Distance); + + Vector128 ch1 = Vector128.Create(value); + Vector128 ch2 = Vector128.Create(ch2Val); + + do + { + Vector128 cmpCh1 = Vector128.Equals(ch1, Vector128.LoadUnsafe(ref searchSpace, (nuint)offset)); + Vector128 cmpCh2 = Vector128.Equals(ch2, Vector128.LoadUnsafe(ref searchSpace, (nuint)(offset + ch1ch2Distance))); + Vector128 cmpAnd = (cmpCh1 & cmpCh2).AsByte(); + + // Early out: cmpAnd is all zeros + // it's especially important for ARM where ExtractMostSignificantBits is not cheap + if (cmpAnd != Vector128.Zero) + { + uint mask = cmpAnd.ExtractMostSignificantBits(); + do + { + // unlike IndexOf, here we use LZCNT to process matches starting from the end + int bitPos = 31 - BitOperations.LeadingZeroCount(mask); + if (valueLength == 2 || // we already matched two bytes + SequenceEqual( + ref Unsafe.Add(ref searchSpace, offset + bitPos), + ref value, (nuint)(uint)valueLength)) // The (nuint)-cast is necessary to pick the correct overload + { + return bitPos + offset; + } + // Clear the highest set bit. + mask = BitOperations.ResetBit(mask, bitPos); + } while (mask != 0); + } + + offset -= Vector128.Count; + if (offset == -Vector128.Count) + return -1; + // Overlap with the current chunk if there is not enough room for the next one + if (offset < 0) + offset = 0; + + } while (true); + } } // Adapted from IndexOf(...) @@ -408,40 +668,6 @@ public static unsafe int IndexOf(ref byte searchSpace, byte value, int length) return (int)(offset + 7); } - public static int LastIndexOf(ref byte searchSpace, int searchSpaceLength, ref byte value, int valueLength) - { - Debug.Assert(searchSpaceLength >= 0); - Debug.Assert(valueLength >= 0); - - if (valueLength == 0) - return searchSpaceLength; // A zero-length sequence is always treated as "found" at the end of the search space. - - byte valueHead = value; - ref byte valueTail = ref Unsafe.Add(ref value, 1); - int valueTailLength = valueLength - 1; - - int offset = 0; - while (true) - { - Debug.Assert(0 <= offset && offset <= searchSpaceLength); // Ensures no deceptive underflows in the computation of "remainingSearchSpaceLength". - int remainingSearchSpaceLength = searchSpaceLength - offset - valueTailLength; - if (remainingSearchSpaceLength <= 0) - break; // The unsearched portion is now shorter than the sequence we're looking for. So it can't be there. - - // Do a quick search for the first element of "value". - int relativeIndex = LastIndexOf(ref searchSpace, valueHead, remainingSearchSpaceLength); - if (relativeIndex < 0) - break; - - // Found the first element of "value". See if the tail matches. - if (SequenceEqual(ref Unsafe.Add(ref searchSpace, relativeIndex + 1), ref valueTail, (nuint)(uint)valueTailLength)) // The (nunit)-cast is necessary to pick the correct overload - return relativeIndex; // The tail matched. Return a successful find. - - offset += remainingSearchSpaceLength - relativeIndex; - } - return -1; - } - [MethodImpl(MethodImplOptions.AggressiveOptimization)] public static int LastIndexOf(ref byte searchSpace, byte value, int length) { @@ -1564,13 +1790,11 @@ public static unsafe bool SequenceEqual(ref byte first, ref byte second, nuint l // This becomes a conditional jmp foward to not favor it. goto NotEqual; } - // Use Vector128.Size as Vector128.Count doesn't inline at R2R time - // https://github.com/dotnet/runtime/issues/32714 - else if (length >= Vector128.Size) + else if (length >= (nuint)Vector128.Count) { Vector128 vecResult; nuint offset = 0; - nuint lengthToExamine = length - Vector128.Size; + nuint lengthToExamine = length - (nuint)Vector128.Count; // Unsigned, so it shouldn't have overflowed larger than length (rather than negative) Debug.Assert(lengthToExamine < length); if (lengthToExamine != 0) @@ -1584,7 +1808,7 @@ public static unsafe bool SequenceEqual(ref byte first, ref byte second, nuint l { goto NotEqual; } - offset += Vector128.Size; + offset += (nuint)Vector128.Count; } while (lengthToExamine > offset); } diff --git a/src/libraries/System.Private.CoreLib/src/System/SpanHelpers.Char.cs b/src/libraries/System.Private.CoreLib/src/System/SpanHelpers.Char.cs index 753e5301b503b1..fb00b062538f2f 100644 --- a/src/libraries/System.Private.CoreLib/src/System/SpanHelpers.Char.cs +++ b/src/libraries/System.Private.CoreLib/src/System/SpanHelpers.Char.cs @@ -22,38 +22,315 @@ public static int IndexOf(ref char searchSpace, int searchSpaceLength, ref char if (valueLength == 0) return 0; // A zero-length sequence is always treated as "found" at the start of the search space. - char valueHead = value; - ref char valueTail = ref Unsafe.Add(ref value, 1); int valueTailLength = valueLength - 1; - int remainingSearchSpaceLength = searchSpaceLength - valueTailLength; + if (valueTailLength == 0) + { + // for single-char values use plain IndexOf + return IndexOf(ref searchSpace, value, searchSpaceLength); + } + + int offset = 0; + char valueHead = value; + int searchSpaceMinusValueTailLength = searchSpaceLength - valueTailLength; + if (Vector128.IsHardwareAccelerated && searchSpaceMinusValueTailLength >= Vector128.Count) + { + goto SEARCH_TWO_CHARS; + } + + ref byte valueTail = ref Unsafe.As(ref Unsafe.Add(ref value, 1)); + int remainingSearchSpaceLength = searchSpaceMinusValueTailLength; - int index = 0; while (remainingSearchSpaceLength > 0) { // Do a quick search for the first element of "value". - int relativeIndex = IndexOf(ref Unsafe.Add(ref searchSpace, index), valueHead, remainingSearchSpaceLength); + int relativeIndex = IndexOf(ref Unsafe.Add(ref searchSpace, offset), valueHead, remainingSearchSpaceLength); if (relativeIndex < 0) break; remainingSearchSpaceLength -= relativeIndex; - index += relativeIndex; + offset += relativeIndex; if (remainingSearchSpaceLength <= 0) break; // The unsearched portion is now shorter than the sequence we're looking for. So it can't be there. // Found the first element of "value". See if the tail matches. if (SequenceEqual( - ref Unsafe.As(ref Unsafe.Add(ref searchSpace, index + 1)), - ref Unsafe.As(ref valueTail), - (nuint)(uint)valueTailLength * 2)) + ref Unsafe.As(ref Unsafe.Add(ref searchSpace, offset + 1)), + ref valueTail, + (nuint)(uint)valueTailLength * 2)) { - return index; // The tail matched. Return a successful find. + return offset; // The tail matched. Return a successful find. } remainingSearchSpaceLength--; - index++; + offset++; } return -1; + + // Based on http://0x80.pl/articles/simd-strfind.html#algorithm-1-generic-simd "Algorithm 1: Generic SIMD" by Wojciech Muła + // Some details about the implementation can also be found in https://github.com/dotnet/runtime/pull/63285 + SEARCH_TWO_CHARS: + if (Avx2.IsSupported && searchSpaceMinusValueTailLength - Vector256.Count >= 0) + { + // Find the last unique (which is not equal to ch1) character + // the algorithm is fine if both are equal, just a little bit less efficient + ushort ch2Val = Unsafe.Add(ref value, valueTailLength); + int ch1ch2Distance = valueTailLength; + while (ch2Val == valueHead && ch1ch2Distance > 1) + ch2Val = Unsafe.Add(ref value, --ch1ch2Distance); + + Vector256 ch1 = Vector256.Create((ushort)valueHead); + Vector256 ch2 = Vector256.Create(ch2Val); + + do + { + // Make sure we don't go out of bounds + Debug.Assert(offset + ch1ch2Distance + Vector256.Count <= searchSpaceLength); + + Vector256 cmpCh1 = Vector256.Equals(ch1, LoadVector256(ref searchSpace, offset)); + Vector256 cmpCh2 = Vector256.Equals(ch2, LoadVector256(ref searchSpace, offset + ch1ch2Distance)); + Vector256 cmpAnd = (cmpCh1 & cmpCh2).AsByte(); + + // Early out: cmpAnd is all zeros + if (cmpAnd != Vector256.Zero) + { + uint mask = cmpAnd.ExtractMostSignificantBits(); + do + { + int bitPos = BitOperations.TrailingZeroCount(mask); + // div by 2 (shr) because we work with 2-byte chars + int charPos = (int)((uint)bitPos / 2); + if (valueLength == 2 || // we already matched two chars + SequenceEqual( + ref Unsafe.As(ref Unsafe.Add(ref searchSpace, offset + charPos)), + ref Unsafe.As(ref value), (nuint)(uint)valueLength * 2)) + { + return offset + charPos; + } + + // Clear two the lowest set bits + if (Bmi1.IsSupported) + mask = Bmi1.ResetLowestSetBit(Bmi1.ResetLowestSetBit(mask)); + else + mask &= ~(uint)(0b11 << bitPos); + } while (mask != 0); + } + offset += Vector256.Count; + + if (offset == searchSpaceMinusValueTailLength) + return -1; + + // Overlap with the current chunk for trailing elements + if (offset > searchSpaceMinusValueTailLength - Vector256.Count) + offset = searchSpaceMinusValueTailLength - Vector256.Count; + } while (true); + } + else // 128bit vector path (SSE2 or AdvSimd) + { + // Find the last unique (which is not equal to ch1) character + // the algorithm is fine if both are equal, just a little bit less efficient + ushort ch2Val = Unsafe.Add(ref value, valueTailLength); + int ch1ch2Distance = valueTailLength; + while (ch2Val == valueHead && ch1ch2Distance > 1) + ch2Val = Unsafe.Add(ref value, --ch1ch2Distance); + + Vector128 ch1 = Vector128.Create((ushort)valueHead); + Vector128 ch2 = Vector128.Create(ch2Val); + + do + { + // Make sure we don't go out of bounds + Debug.Assert(offset + ch1ch2Distance + Vector128.Count <= searchSpaceLength); + + Vector128 cmpCh1 = Vector128.Equals(ch1, LoadVector128(ref searchSpace, offset)); + Vector128 cmpCh2 = Vector128.Equals(ch2, LoadVector128(ref searchSpace, offset + ch1ch2Distance)); + Vector128 cmpAnd = (cmpCh1 & cmpCh2).AsByte(); + + // Early out: cmpAnd is all zeros + if (cmpAnd != Vector128.Zero) + { + uint mask = cmpAnd.ExtractMostSignificantBits(); + do + { + int bitPos = BitOperations.TrailingZeroCount(mask); + // div by 2 (shr) because we work with 2-byte chars + int charPos = (int)((uint)bitPos / 2); + if (valueLength == 2 || // we already matched two chars + SequenceEqual( + ref Unsafe.As(ref Unsafe.Add(ref searchSpace, offset + charPos)), + ref Unsafe.As(ref value), (nuint)(uint)valueLength * 2)) + { + return offset + charPos; + } + + // Clear two lowest set bits + if (Bmi1.IsSupported) + mask = Bmi1.ResetLowestSetBit(Bmi1.ResetLowestSetBit(mask)); + else + mask &= ~(uint)(0b11 << bitPos); + } while (mask != 0); + } + offset += Vector128.Count; + + if (offset == searchSpaceMinusValueTailLength) + return -1; + + // Overlap with the current chunk for trailing elements + if (offset > searchSpaceMinusValueTailLength - Vector128.Count) + offset = searchSpaceMinusValueTailLength - Vector128.Count; + } while (true); + } + } + + public static int LastIndexOf(ref char searchSpace, int searchSpaceLength, ref char value, int valueLength) + { + Debug.Assert(searchSpaceLength >= 0); + Debug.Assert(valueLength >= 0); + + if (valueLength == 0) + return searchSpaceLength; // A zero-length sequence is always treated as "found" at the end of the search space. + + int valueTailLength = valueLength - 1; + if (valueTailLength == 0) + return LastIndexOf(ref searchSpace, value, searchSpaceLength); // for single-char values use plain LastIndexOf + + int offset = 0; + char valueHead = value; + int searchSpaceMinusValueTailLength = searchSpaceLength - valueTailLength; + if (Vector128.IsHardwareAccelerated && searchSpaceMinusValueTailLength >= Vector128.Count) + { + goto SEARCH_TWO_CHARS; + } + + ref byte valueTail = ref Unsafe.As(ref Unsafe.Add(ref value, 1)); + + while (true) + { + Debug.Assert(0 <= offset && offset <= searchSpaceLength); // Ensures no deceptive underflows in the computation of "remainingSearchSpaceLength". + int remainingSearchSpaceLength = searchSpaceLength - offset - valueTailLength; + if (remainingSearchSpaceLength <= 0) + break; // The unsearched portion is now shorter than the sequence we're looking for. So it can't be there. + + // Do a quick search for the first element of "value". + int relativeIndex = LastIndexOf(ref searchSpace, valueHead, remainingSearchSpaceLength); + if (relativeIndex == -1) + break; + + // Found the first element of "value". See if the tail matches. + if (SequenceEqual( + ref Unsafe.As(ref Unsafe.Add(ref searchSpace, relativeIndex + 1)), + ref valueTail, (nuint)(uint)valueTailLength * 2)) + { + return relativeIndex; // The tail matched. Return a successful find. + } + + offset += remainingSearchSpaceLength - relativeIndex; + } + return -1; + + // Based on http://0x80.pl/articles/simd-strfind.html#algorithm-1-generic-simd "Algorithm 1: Generic SIMD" by Wojciech Muła + // Some details about the implementation can also be found in https://github.com/dotnet/runtime/pull/63285 + SEARCH_TWO_CHARS: + if (Avx2.IsSupported && searchSpaceMinusValueTailLength >= Vector256.Count) + { + offset = searchSpaceMinusValueTailLength - Vector256.Count; + + // Find the last unique (which is not equal to ch1) char + // the algorithm is fine if both are equal, just a little bit less efficient + char ch2Val = Unsafe.Add(ref value, valueTailLength); + int ch1ch2Distance = valueTailLength; + while (ch2Val == valueHead && ch1ch2Distance > 1) + ch2Val = Unsafe.Add(ref value, --ch1ch2Distance); + + Vector256 ch1 = Vector256.Create((ushort)valueHead); + Vector256 ch2 = Vector256.Create((ushort)ch2Val); + + do + { + + Vector256 cmpCh1 = Vector256.Equals(ch1, LoadVector256(ref searchSpace, (nuint)offset)); + Vector256 cmpCh2 = Vector256.Equals(ch2, LoadVector256(ref searchSpace, (nuint)(offset + ch1ch2Distance))); + Vector256 cmpAnd = (cmpCh1 & cmpCh2).AsByte(); + + // Early out: cmpAnd is all zeros + if (cmpAnd != Vector256.Zero) + { + uint mask = cmpAnd.ExtractMostSignificantBits(); + do + { + // unlike IndexOf, here we use LZCNT to process matches starting from the end + int bitPos = 30 - BitOperations.LeadingZeroCount(mask); + int charPos = (int)((uint)bitPos / 2); + + if (valueLength == 2 || // we already matched two chars + SequenceEqual( + ref Unsafe.As(ref Unsafe.Add(ref searchSpace, offset + charPos)), + ref Unsafe.As(ref value), (nuint)(uint)valueLength * 2)) + { + return charPos + offset; + } + mask &= ~(uint)(0b11 << bitPos); // clear two highest set bits. + } while (mask != 0); + } + + offset -= Vector256.Count; + if (offset == -Vector256.Count) + return -1; + // Overlap with the current chunk if there is not enough room for the next one + if (offset < 0) + offset = 0; + } while (true); + } + else // 128bit vector path (SSE2 or AdvSimd) + { + offset = searchSpaceMinusValueTailLength - Vector128.Count; + + // Find the last unique (which is not equal to ch1) char + // the algorithm is fine if both are equal, just a little bit less efficient + char ch2Val = Unsafe.Add(ref value, valueTailLength); + int ch1ch2Distance = valueTailLength; + while (ch2Val == value && ch1ch2Distance > 1) + ch2Val = Unsafe.Add(ref value, --ch1ch2Distance); + + Vector128 ch1 = Vector128.Create((ushort)value); + Vector128 ch2 = Vector128.Create((ushort)ch2Val); + + do + { + Vector128 cmpCh1 = Vector128.Equals(ch1, LoadVector128(ref searchSpace, (nuint)offset)); + Vector128 cmpCh2 = Vector128.Equals(ch2, LoadVector128(ref searchSpace, (nuint)(offset + ch1ch2Distance))); + Vector128 cmpAnd = (cmpCh1 & cmpCh2).AsByte(); + + // Early out: cmpAnd is all zeros + // it's especially important for ARM where ExtractMostSignificantBits is not cheap + if (cmpAnd != Vector128.Zero) + { + uint mask = cmpAnd.ExtractMostSignificantBits(); + do + { + // unlike IndexOf, here we use LZCNT to process matches starting from the end + int bitPos = 30 - BitOperations.LeadingZeroCount(mask); + int charPos = (int)((uint)bitPos / 2); + + if (valueLength == 2 || // we already matched two chars + SequenceEqual( + ref Unsafe.As(ref Unsafe.Add(ref searchSpace, offset + charPos)), + ref Unsafe.As(ref value), (nuint)(uint)valueLength * 2)) + { + return charPos + offset; + } + mask &= ~(uint)(0b11 << bitPos); // clear two the highest set bits. + } while (mask != 0); + } + + offset -= Vector128.Count; + if (offset == -Vector128.Count) + return -1; + // Overlap with the current chunk if there is not enough room for the next one + if (offset < 0) + offset = 0; + } while (true); + } } [MethodImpl(MethodImplOptions.AggressiveOptimization)] diff --git a/src/libraries/System.Private.CoreLib/src/System/SpanHelpers.T.cs b/src/libraries/System.Private.CoreLib/src/System/SpanHelpers.T.cs index 91d2a34a477963..27944aff4876c6 100644 --- a/src/libraries/System.Private.CoreLib/src/System/SpanHelpers.T.cs +++ b/src/libraries/System.Private.CoreLib/src/System/SpanHelpers.T.cs @@ -774,11 +774,17 @@ public static int LastIndexOf(ref T searchSpace, int searchSpaceLength, ref T if (valueLength == 0) return searchSpaceLength; // A zero-length sequence is always treated as "found" at the end of the search space. - T valueHead = value; - ref T valueTail = ref Unsafe.Add(ref value, 1); int valueTailLength = valueLength - 1; + if (valueTailLength == 0) + { + return LastIndexOf(ref searchSpace, value, searchSpaceLength); + } int index = 0; + + T valueHead = value; + ref T valueTail = ref Unsafe.Add(ref value, 1); + while (true) { Debug.Assert(0 <= index && index <= searchSpaceLength); // Ensures no deceptive underflows in the computation of "remainingSearchSpaceLength". From 4e165d3cc623282baa627ae468220c00f71626c6 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 25 Jan 2022 14:46:37 -0500 Subject: [PATCH 066/161] [main] Update dependencies from dotnet/arcade dotnet/xharness dotnet/icu dotnet/hotreload-utils dotnet/llvm-project (#64265) * Update dependencies from https://github.com/dotnet/arcade build 20220124.13 Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.ApiCompat , Microsoft.DotNet.XUnitExtensions , Microsoft.DotNet.GenAPI , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.GenFacades , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.Helix.Sdk From Version 2.5.1-beta.22071.6 -> To Version 2.5.1-beta.22074.13 * Update dependencies from https://github.com/dotnet/xharness build 20220124.1 Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit From Version 1.0.0-prerelease.22071.1 -> To Version 1.0.0-prerelease.22074.1 * Update dependencies from https://github.com/dotnet/icu build 20220124.5 Microsoft.NETCore.Runtime.ICU.Transport From Version 7.0.0-preview.2.22071.2 -> To Version 7.0.0-preview.2.22074.5 * Update dependencies from https://github.com/dotnet/hotreload-utils build 20220124.1 Microsoft.DotNet.HotReload.Utils.Generator.BuildTool From Version 1.0.2-alpha.0.22069.1 -> To Version 1.0.2-alpha.0.22074.1 * Update dependencies from https://github.com/dotnet/llvm-project build 20220124.2 runtime.win-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.win-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.linux-arm64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.linux-arm64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.linux-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.linux-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.osx.10.12-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.osx.10.12-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools From Version 11.1.0-alpha.1.22067.2 -> To Version 11.1.0-alpha.1.22074.2 Co-authored-by: dotnet-maestro[bot] --- .config/dotnet-tools.json | 2 +- eng/Version.Details.xml | 128 +++++++++--------- eng/Versions.props | 56 ++++---- eng/common/templates/job/execute-sdl.yml | 10 +- eng/common/templates/job/onelocbuild.yml | 19 ++- eng/common/templates/jobs/jobs.yml | 10 +- .../templates/post-build/post-build.yml | 42 ++++-- .../post-build/setup-maestro-vars.yml | 1 + global.json | 8 +- 9 files changed, 162 insertions(+), 114 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 26dc5ae6a75f47..f6ec0a4e1da7e2 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -15,7 +15,7 @@ ] }, "microsoft.dotnet.xharness.cli": { - "version": "1.0.0-prerelease.22071.1", + "version": "1.0.0-prerelease.22074.1", "commands": [ "xharness" ] diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b01aa4c37ed5bd..0e09fa1f297b36 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,8 +1,8 @@ - + https://github.com/dotnet/icu - 8a4a45cc99e7d6e5244c16f581171633091b96b3 + 80a658fa6aa6601d67bfe5a294e0d1b7e1184a5c https://github.com/dotnet/msquic @@ -50,77 +50,77 @@ - + https://github.com/dotnet/arcade - e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 + b6483cac5832aa5207692517f9a49ce1741a3041 - + https://github.com/dotnet/arcade - e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 + b6483cac5832aa5207692517f9a49ce1741a3041 - + https://github.com/dotnet/arcade - e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 + b6483cac5832aa5207692517f9a49ce1741a3041 - + https://github.com/dotnet/arcade - e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 + b6483cac5832aa5207692517f9a49ce1741a3041 - + https://github.com/dotnet/arcade - e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 + b6483cac5832aa5207692517f9a49ce1741a3041 - + https://github.com/dotnet/arcade - e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 + b6483cac5832aa5207692517f9a49ce1741a3041 - + https://github.com/dotnet/arcade - e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 + b6483cac5832aa5207692517f9a49ce1741a3041 - + https://github.com/dotnet/arcade - e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 + b6483cac5832aa5207692517f9a49ce1741a3041 - + https://github.com/dotnet/arcade - e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 + b6483cac5832aa5207692517f9a49ce1741a3041 - + https://github.com/dotnet/arcade - e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 + b6483cac5832aa5207692517f9a49ce1741a3041 - + https://github.com/dotnet/arcade - e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 + b6483cac5832aa5207692517f9a49ce1741a3041 - + https://github.com/dotnet/arcade - e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 + b6483cac5832aa5207692517f9a49ce1741a3041 - + https://github.com/dotnet/arcade - e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 + b6483cac5832aa5207692517f9a49ce1741a3041 - + https://github.com/dotnet/arcade - e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 + b6483cac5832aa5207692517f9a49ce1741a3041 - + https://github.com/dotnet/arcade - e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 + b6483cac5832aa5207692517f9a49ce1741a3041 - + https://github.com/dotnet/arcade - e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 + b6483cac5832aa5207692517f9a49ce1741a3041 - + https://github.com/dotnet/arcade - e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 + b6483cac5832aa5207692517f9a49ce1741a3041 - + https://github.com/dotnet/arcade - e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 + b6483cac5832aa5207692517f9a49ce1741a3041 https://github.com/microsoft/vstest @@ -170,37 +170,37 @@ https://github.com/dotnet/runtime-assets a597df23119faf540d95cebab14b82f084c47384 - + https://github.com/dotnet/llvm-project - 79a6d232058e2c2f1d9e833355b72f07fe342a3b + 44adf6c047663fe20c388bfb769e18dd3c91f7e0 - + https://github.com/dotnet/llvm-project - 79a6d232058e2c2f1d9e833355b72f07fe342a3b + 44adf6c047663fe20c388bfb769e18dd3c91f7e0 - + https://github.com/dotnet/llvm-project - 79a6d232058e2c2f1d9e833355b72f07fe342a3b + 44adf6c047663fe20c388bfb769e18dd3c91f7e0 - + https://github.com/dotnet/llvm-project - 79a6d232058e2c2f1d9e833355b72f07fe342a3b + 44adf6c047663fe20c388bfb769e18dd3c91f7e0 - + https://github.com/dotnet/llvm-project - 79a6d232058e2c2f1d9e833355b72f07fe342a3b + 44adf6c047663fe20c388bfb769e18dd3c91f7e0 - + https://github.com/dotnet/llvm-project - 79a6d232058e2c2f1d9e833355b72f07fe342a3b + 44adf6c047663fe20c388bfb769e18dd3c91f7e0 - + https://github.com/dotnet/llvm-project - 79a6d232058e2c2f1d9e833355b72f07fe342a3b + 44adf6c047663fe20c388bfb769e18dd3c91f7e0 - + https://github.com/dotnet/llvm-project - 79a6d232058e2c2f1d9e833355b72f07fe342a3b + 44adf6c047663fe20c388bfb769e18dd3c91f7e0 https://github.com/dotnet/runtime @@ -238,21 +238,21 @@ https://github.com/dotnet/linker e485816b48273d03bd6266a64dad9bea97f861d5 - + https://github.com/dotnet/xharness - bd2a12f9cc6c93c249f987b42c1c761550369674 + 0137095821e2e5a9e030d97248503387b8d72a18 - + https://github.com/dotnet/xharness - bd2a12f9cc6c93c249f987b42c1c761550369674 + 0137095821e2e5a9e030d97248503387b8d72a18 - + https://github.com/dotnet/xharness - bd2a12f9cc6c93c249f987b42c1c761550369674 + 0137095821e2e5a9e030d97248503387b8d72a18 - + https://github.com/dotnet/arcade - e1ea8873d2e0175c1d1e49b3884cd2e9c6ef5007 + b6483cac5832aa5207692517f9a49ce1741a3041 https://dev.azure.com/dnceng/internal/_git/dotnet-optimization @@ -270,9 +270,9 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-optimization 91d6b3c1f51888d166701510189505f35714665c - + https://github.com/dotnet/hotreload-utils - b6504c8dca937ff1a59d3283374241eacf26684a + d3e96c2e8ed4d58de217c44423c9ba3b90333724 https://github.com/dotnet/runtime-assets diff --git a/eng/Versions.props b/eng/Versions.props index 535f0f7e4f01e4..5beaf9c02f194a 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -54,21 +54,21 @@ 2.0.0-alpha.1.21525.11 - 7.0.0-beta.22071.6 - 7.0.0-beta.22071.6 - 7.0.0-beta.22071.6 - 7.0.0-beta.22071.6 - 7.0.0-beta.22071.6 - 7.0.0-beta.22071.6 - 2.5.1-beta.22071.6 - 7.0.0-beta.22071.6 - 7.0.0-beta.22071.6 - 7.0.0-beta.22071.6 - 7.0.0-beta.22071.6 - 7.0.0-beta.22071.6 - 7.0.0-beta.22071.6 - 7.0.0-beta.22071.6 - 7.0.0-beta.22071.6 + 7.0.0-beta.22074.13 + 7.0.0-beta.22074.13 + 7.0.0-beta.22074.13 + 7.0.0-beta.22074.13 + 7.0.0-beta.22074.13 + 7.0.0-beta.22074.13 + 2.5.1-beta.22074.13 + 7.0.0-beta.22074.13 + 7.0.0-beta.22074.13 + 7.0.0-beta.22074.13 + 7.0.0-beta.22074.13 + 7.0.0-beta.22074.13 + 7.0.0-beta.22074.13 + 7.0.0-beta.22074.13 + 7.0.0-beta.22074.13 6.0.0-preview.1.102 @@ -160,10 +160,10 @@ 1.0.1-prerelease-00006 16.9.0-preview-20201201-01 - 1.0.0-prerelease.22071.1 - 1.0.0-prerelease.22071.1 - 1.0.0-prerelease.22071.1 - 1.0.2-alpha.0.22069.1 + 1.0.0-prerelease.22074.1 + 1.0.0-prerelease.22074.1 + 1.0.0-prerelease.22074.1 + 1.0.2-alpha.0.22074.1 2.4.2-pre.22 0.12.0-pre.20 2.4.2 @@ -180,18 +180,18 @@ 7.0.100-1.22063.2 $(MicrosoftNETILLinkTasksVersion) - 7.0.0-preview.2.22071.2 + 7.0.0-preview.2.22074.5 7.0.0-alpha.1.21529.3 - 11.1.0-alpha.1.22067.2 - 11.1.0-alpha.1.22067.2 - 11.1.0-alpha.1.22067.2 - 11.1.0-alpha.1.22067.2 - 11.1.0-alpha.1.22067.2 - 11.1.0-alpha.1.22067.2 - 11.1.0-alpha.1.22067.2 - 11.1.0-alpha.1.22067.2 + 11.1.0-alpha.1.22074.2 + 11.1.0-alpha.1.22074.2 + 11.1.0-alpha.1.22074.2 + 11.1.0-alpha.1.22074.2 + 11.1.0-alpha.1.22074.2 + 11.1.0-alpha.1.22074.2 + 11.1.0-alpha.1.22074.2 + 11.1.0-alpha.1.22074.2 7.0.0-alpha.2.22071.3 $(MicrosoftNETWorkloadEmscriptenManifest70100Version) diff --git a/eng/common/templates/job/execute-sdl.yml b/eng/common/templates/job/execute-sdl.yml index a4837c32c3869c..24cec0424e5d64 100644 --- a/eng/common/templates/job/execute-sdl.yml +++ b/eng/common/templates/job/execute-sdl.yml @@ -47,8 +47,14 @@ jobs: - name: GuardianVersion value: ${{ coalesce(parameters.overrideGuardianVersion, '$(DefaultGuardianVersion)') }} pool: - name: NetCore1ESPool-Internal - demands: ImageOverride -equals Build.Server.Amd64.VS2019 + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: VSEngSS-MicroBuild2022-1ES + demands: Cmd + # If it's not devdiv, it's dnceng + ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: + name: NetCore1ESPool-Internal + demands: ImageOverride -equals Build.Server.Amd64.VS2019 steps: - checkout: self clean: true diff --git a/eng/common/templates/job/onelocbuild.yml b/eng/common/templates/job/onelocbuild.yml index 0b93fd5b490ebb..9d1e3042d8a6c0 100644 --- a/eng/common/templates/job/onelocbuild.yml +++ b/eng/common/templates/job/onelocbuild.yml @@ -3,10 +3,8 @@ parameters: dependsOn: '' # Optional: A defined YAML pool - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#pool - pool: - name: NetCore1ESPool-Internal - demands: ImageOverride -equals Build.Server.Amd64.VS2019 - + pool: '' + CeapexPat: $(dn-bot-ceapex-package-r) # PAT for the loc AzDO instance https://dev.azure.com/ceapex GithubPat: $(BotAccount-dotnet-bot-repo-PAT) @@ -32,7 +30,18 @@ jobs: displayName: OneLocBuild - pool: ${{ parameters.pool }} + ${{ if ne(parameters.pool, '') }}: + pool: ${{ parameters.pool }} + ${{ if eq(parameters.pool, '') }}: + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: VSEngSS-MicroBuild2022-1ES + demands: Cmd + # If it's not devdiv, it's dnceng + ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: + name: NetCore1ESPool-Internal + demands: ImageOverride -equals Build.Server.Amd64.VS2019 variables: - group: OneLocBuildVariables # Contains the CeapexPat and GithubPat diff --git a/eng/common/templates/jobs/jobs.yml b/eng/common/templates/jobs/jobs.yml index dafa603dc5d900..554e71cfc436dd 100644 --- a/eng/common/templates/jobs/jobs.yml +++ b/eng/common/templates/jobs/jobs.yml @@ -83,8 +83,14 @@ jobs: - ${{ if eq(parameters.enableSourceBuild, true) }}: - Source_Build_Complete pool: - name: NetCore1ESPool-Internal - demands: ImageOverride -equals Build.Server.Amd64.VS2019 + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: VSEngSS-MicroBuild2022-1ES + demands: Cmd + # If it's not devdiv, it's dnceng + ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: + name: NetCore1ESPool-Internal + demands: ImageOverride -equals Build.Server.Amd64.VS2019 runAsPublic: ${{ parameters.runAsPublic }} publishUsingPipelines: ${{ parameters.enablePublishUsingPipelines }} diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index 9583d27dbbf89d..2f176571f020cf 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -94,8 +94,14 @@ stages: displayName: NuGet Validation condition: eq( ${{ parameters.enableNugetValidation }}, 'true') pool: - name: NetCore1ESPool-Internal - demands: ImageOverride -equals Build.Server.Amd64.VS2019 + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: VSEngSS-MicroBuild2022-1ES + demands: Cmd + # If it's not devdiv, it's dnceng + ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: + name: NetCore1ESPool-Internal + demands: ImageOverride -equals Build.Server.Amd64.VS2019 steps: - template: setup-maestro-vars.yml @@ -125,8 +131,14 @@ stages: displayName: Signing Validation condition: and( eq( ${{ parameters.enableSigningValidation }}, 'true'), ne( variables['PostBuildSign'], 'true')) pool: - name: NetCore1ESPool-Internal - demands: ImageOverride -equals Build.Server.Amd64.VS2019 + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: VSEngSS-MicroBuild2022-1ES + demands: Cmd + # If it's not devdiv, it's dnceng + ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: + name: NetCore1ESPool-Internal + demands: ImageOverride -equals Build.Server.Amd64.VS2019 steps: - template: setup-maestro-vars.yml parameters: @@ -179,8 +191,14 @@ stages: displayName: SourceLink Validation condition: eq( ${{ parameters.enableSourceLinkValidation }}, 'true') pool: - name: NetCore1ESPool-Internal - demands: ImageOverride -equals Build.Server.Amd64.VS2019 + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: VSEngSS-MicroBuild2022-1ES + demands: Cmd + # If it's not devdiv, it's dnceng + ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: + name: NetCore1ESPool-Internal + demands: ImageOverride -equals Build.Server.Amd64.VS2019 steps: - template: setup-maestro-vars.yml parameters: @@ -230,14 +248,22 @@ stages: displayName: Publish Using Darc timeoutInMinutes: 120 pool: - name: NetCore1ESPool-Internal - demands: ImageOverride -equals Build.Server.Amd64.VS2019 + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: VSEngSS-MicroBuild2022-1ES + demands: Cmd + # If it's not devdiv, it's dnceng + ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: + name: NetCore1ESPool-Internal + demands: ImageOverride -equals Build.Server.Amd64.VS2019 steps: - template: setup-maestro-vars.yml parameters: BARBuildId: ${{ parameters.BARBuildId }} PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + - task: NuGetAuthenticate@0 + - task: PowerShell@2 displayName: Publish Using Darc inputs: diff --git a/eng/common/templates/post-build/setup-maestro-vars.yml b/eng/common/templates/post-build/setup-maestro-vars.yml index 826d3ed5f74c20..0c87f149a4ad77 100644 --- a/eng/common/templates/post-build/setup-maestro-vars.yml +++ b/eng/common/templates/post-build/setup-maestro-vars.yml @@ -16,6 +16,7 @@ steps: displayName: Set Release Configs Vars inputs: targetType: inline + pwsh: true script: | try { if (!$Env:PromoteToMaestroChannels -or $Env:PromoteToMaestroChannels.Trim() -eq '') { diff --git a/global.json b/global.json index f32ffc29ff09d7..c6832999bdb02a 100644 --- a/global.json +++ b/global.json @@ -12,10 +12,10 @@ "python3": "3.7.1" }, "msbuild-sdks": { - "Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk": "7.0.0-beta.22071.6", - "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22071.6", - "Microsoft.DotNet.Helix.Sdk": "7.0.0-beta.22071.6", - "Microsoft.DotNet.SharedFramework.Sdk": "7.0.0-beta.22071.6", + "Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk": "7.0.0-beta.22074.13", + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22074.13", + "Microsoft.DotNet.Helix.Sdk": "7.0.0-beta.22074.13", + "Microsoft.DotNet.SharedFramework.Sdk": "7.0.0-beta.22074.13", "Microsoft.Build.NoTargets": "3.1.0", "Microsoft.Build.Traversal": "3.0.23", "Microsoft.NET.Sdk.IL": "7.0.0-alpha.1.22073.5" From 7483b24b73a962bdf8e7be8426a7b43ba4ff09de Mon Sep 17 00:00:00 2001 From: Bradley Grainger Date: Tue, 25 Jan 2022 12:02:24 -0800 Subject: [PATCH 067/161] Add CancellationToken to TextReader.ReadXAsync (#61898) Co-authored-by: Adam Sitnik Co-authored-by: Stephen Toub --- .../src/System/IO/SyncTextReader.cs | 15 ++++ .../tests/StreamReader/StreamReaderTests.cs | 59 ++++++++++++++ .../StringReader/StringReader.CtorTests.cs | 27 +++++++ .../tests/TextReader/TextReaderTests.cs | 21 +++++ .../src/System/IO/File.cs | 2 +- .../src/System/IO/StreamReader.cs | 81 ++++++++++++++++--- .../src/System/IO/StringReader.cs | 63 +++++++++++++++ .../src/System/IO/TextReader.cs | 56 +++++++++++-- .../System.Runtime/ref/System.Runtime.cs | 6 ++ 9 files changed, 311 insertions(+), 19 deletions(-) diff --git a/src/libraries/System.Console/src/System/IO/SyncTextReader.cs b/src/libraries/System.Console/src/System/IO/SyncTextReader.cs index 7a2661691e6247..33ef898edb688c 100644 --- a/src/libraries/System.Console/src/System/IO/SyncTextReader.cs +++ b/src/libraries/System.Console/src/System/IO/SyncTextReader.cs @@ -3,6 +3,7 @@ using System.Diagnostics; using System.Runtime.InteropServices; +using System.Threading; using System.Threading.Tasks; namespace System.IO @@ -95,11 +96,25 @@ public override string ReadToEnd() return Task.FromResult(ReadLine()); } + public override ValueTask ReadLineAsync(CancellationToken cancellationToken) + { + return cancellationToken.IsCancellationRequested ? + ValueTask.FromCanceled(cancellationToken) : + new ValueTask(ReadLine()); + } + public override Task ReadToEndAsync() { return Task.FromResult(ReadToEnd()); } + public override Task ReadToEndAsync(CancellationToken cancellationToken) + { + return cancellationToken.IsCancellationRequested ? + Task.FromCanceled(cancellationToken) : + Task.FromResult(ReadToEnd()); + } + public override Task ReadBlockAsync(char[] buffer, int index, int count) { if (buffer == null) diff --git a/src/libraries/System.IO/tests/StreamReader/StreamReaderTests.cs b/src/libraries/System.IO/tests/StreamReader/StreamReaderTests.cs index 4a2b91f8862b57..fccc269868ed7e 100644 --- a/src/libraries/System.IO/tests/StreamReader/StreamReaderTests.cs +++ b/src/libraries/System.IO/tests/StreamReader/StreamReaderTests.cs @@ -110,6 +110,44 @@ public async Task ReadToEndAsync() Assert.Equal(5000, result.Length); } + [Fact] + public async Task ReadToEndAsync_WithCancellationToken() + { + using var sw = new StreamReader(GetLargeStream()); + var result = await sw.ReadToEndAsync(default); + + Assert.Equal(5000, result.Length); + } + + [Fact] + public async Task ReadToEndAsync_WithCanceledCancellationToken() + { + using var sw = new StreamReader(GetLargeStream()); + using var cts = new CancellationTokenSource(); + cts.Cancel(); + var token = cts.Token; + + var ex = await Assert.ThrowsAnyAsync(async () => await sw.ReadToEndAsync(token)); + Assert.Equal(token, ex.CancellationToken); + } + + [Fact] + [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser.")] + public async Task ReadToEndAsync_WithCancellation() + { + string path = GetTestFilePath(); + + // create large (~100MB) file + File.WriteAllLines(path, Enumerable.Repeat("A very large file used for testing StreamReader cancellation. 0123456789012345678901234567890123456789.", 1_000_000)); + + using StreamReader reader = File.OpenText(path); + using CancellationTokenSource cts = new (TimeSpan.FromMilliseconds(50)); + var token = cts.Token; + + var ex = await Assert.ThrowsAnyAsync(async () => await reader.ReadToEndAsync(token)); + Assert.Equal(token, ex.CancellationToken); + } + [Fact] public void GetBaseStream() { @@ -301,6 +339,27 @@ public void VanillaReadLines2() Assert.Equal(valueString.Substring(1, valueString.IndexOf('\r') - 1), data); } + [Fact] + public async Task VanillaReadLineAsync() + { + var baseInfo = GetCharArrayStream(); + var sr = baseInfo.Item2; + + string valueString = new string(baseInfo.Item1); + + var data = await sr.ReadLineAsync(); + Assert.Equal(valueString.Substring(0, valueString.IndexOf('\r')), data); + + data = await sr.ReadLineAsync(default); + Assert.Equal(valueString.Substring(valueString.IndexOf('\r') + 1, 3), data); + + data = await sr.ReadLineAsync(); + Assert.Equal(valueString.Substring(valueString.IndexOf('\n') + 1, 2), data); + + data = await sr.ReadLineAsync(default); + Assert.Equal((valueString.Substring(valueString.LastIndexOf('\n') + 1)), data); + } + [Fact] public async Task ContinuousNewLinesAndTabsAsync() { diff --git a/src/libraries/System.IO/tests/StringReader/StringReader.CtorTests.cs b/src/libraries/System.IO/tests/StringReader/StringReader.CtorTests.cs index 9e500923164f38..3c4446f07f47a7 100644 --- a/src/libraries/System.IO/tests/StringReader/StringReader.CtorTests.cs +++ b/src/libraries/System.IO/tests/StringReader/StringReader.CtorTests.cs @@ -68,6 +68,23 @@ public static void ReadLine() } } + [Fact] + public static async Task ReadLineAsync() + { + string str1 = "Hello\0\t\v \\ World"; + string str2 = str1 + Environment.NewLine + str1; + + using (StringReader sr = new StringReader(str1)) + { + Assert.Equal(str1, await sr.ReadLineAsync()); + } + using (StringReader sr = new StringReader(str2)) + { + Assert.Equal(str1, await sr.ReadLineAsync(default)); + Assert.Equal(str1, await sr.ReadLineAsync(default)); + } + } + [Fact] public static void ReadPseudoRandomString() { @@ -155,6 +172,14 @@ public static void ReadToEndPseudoRandom() { Assert.Equal(str1, sr.ReadToEnd()); } + [Fact] + public static async Task ReadToEndAsyncString() + { + string str1 = "Hello\0\t\v \\ World"; + StringReader sr = new StringReader(str1); + Assert.Equal(str1, await sr.ReadToEndAsync(default)); + } + [Fact] public static void Closed_DisposedExceptions() { @@ -278,6 +303,8 @@ public async Task Precanceled_ThrowsException() await Assert.ThrowsAnyAsync(() => reader.ReadAsync(Memory.Empty, new CancellationToken(true)).AsTask()); await Assert.ThrowsAnyAsync(() => reader.ReadBlockAsync(Memory.Empty, new CancellationToken(true)).AsTask()); + await Assert.ThrowsAnyAsync(() => reader.ReadLineAsync(new CancellationToken(true)).AsTask()); + await Assert.ThrowsAnyAsync(() => reader.ReadToEndAsync(new CancellationToken(true))); } private static void ValidateDisposedExceptions(StringReader sr) diff --git a/src/libraries/System.IO/tests/TextReader/TextReaderTests.cs b/src/libraries/System.IO/tests/TextReader/TextReaderTests.cs index e6ba6d818f2867..48f83d7108e53d 100644 --- a/src/libraries/System.IO/tests/TextReader/TextReaderTests.cs +++ b/src/libraries/System.IO/tests/TextReader/TextReaderTests.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Threading; using System.Threading.Tasks; using Xunit; @@ -54,6 +55,26 @@ public async Task ReadToEndAsync() } } + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] + public async Task ReadToEndAsync_WithCancellationToken() + { + using var tr = new CharArrayTextReader(TestDataProvider.LargeData); + var result = await tr.ReadToEndAsync(default); + Assert.Equal(5000, result.Length); + } + + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] + public async Task ReadToEndAsync_WithCanceledCancellationToken() + { + using var tr = new CharArrayTextReader(TestDataProvider.LargeData); + using var cts = new CancellationTokenSource(); + cts.Cancel(); + var token = cts.Token; + + var ex = await Assert.ThrowsAnyAsync(async () => await tr.ReadToEndAsync(token)); + Assert.Equal(token, ex.CancellationToken); + } + [Fact] public void TestRead() { diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/File.cs b/src/libraries/System.Private.CoreLib/src/System/IO/File.cs index 2b4c61f1eb0baa..007a16d590b0aa 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/File.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/File.cs @@ -649,7 +649,7 @@ private static async Task InternalReadAllLinesAsync(string path, Encod cancellationToken.ThrowIfCancellationRequested(); string? line; List lines = new List(); - while ((line = await sr.ReadLineAsync().ConfigureAwait(false)) != null) + while ((line = await sr.ReadLineAsync(cancellationToken).ConfigureAwait(false)) != null) { lines.Add(line); cancellationToken.ThrowIfCancellationRequested(); diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/StreamReader.cs b/src/libraries/System.Private.CoreLib/src/System/IO/StreamReader.cs index 3b3e03a806ff54..b5aca3d1dfbcf7 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/StreamReader.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/StreamReader.cs @@ -845,7 +845,37 @@ private int ReadBuffer(Span userBuffer, out bool readToUserBuffer) return sb.ToString(); } - public override Task ReadLineAsync() + public override Task ReadLineAsync() => + ReadLineAsync(default).AsTask(); + + /// + /// Reads a line of characters asynchronously from the current stream and returns the data as a string. + /// + /// The token to monitor for cancellation requests. + /// A value task that represents the asynchronous read operation. The value of the TResult + /// parameter contains the next line from the stream, or is if all of the characters have been read. + /// The number of characters in the next line is larger than . + /// The stream reader has been disposed. + /// The reader is currently in use by a previous read operation. + /// + /// The following example shows how to read and print all lines from the file until the end of the file is reached or the operation timed out. + /// + /// using CancellationTokenSource tokenSource = new (TimeSpan.FromSeconds(1)); + /// using StreamReader reader = File.OpenText("existingfile.txt"); + /// + /// string line; + /// while ((line = await reader.ReadLineAsync(tokenSource.Token)) is not null) + /// { + /// Console.WriteLine(line); + /// } + /// + /// + /// + /// If this method is canceled via , some data + /// that has been read from the current but not stored (by the + /// ) or returned (to the caller) may be lost. + /// + public override ValueTask ReadLineAsync(CancellationToken cancellationToken) { // If we have been inherited into a subclass, the following implementation could be incorrect // since it does not call through to Read() which a subclass might have overridden. @@ -853,21 +883,21 @@ private int ReadBuffer(Span userBuffer, out bool readToUserBuffer) // and delegate to our base class (which will call into Read) when we are not sure. if (GetType() != typeof(StreamReader)) { - return base.ReadLineAsync(); + return base.ReadLineAsync(cancellationToken); } ThrowIfDisposed(); CheckAsyncTaskInProgress(); - Task task = ReadLineAsyncInternal(); + Task task = ReadLineAsyncInternal(cancellationToken); _asyncReadTask = task; - return task; + return new ValueTask(task); } - private async Task ReadLineAsyncInternal() + private async Task ReadLineAsyncInternal(CancellationToken cancellationToken) { - if (_charPos == _charLen && (await ReadBufferAsync(CancellationToken.None).ConfigureAwait(false)) == 0) + if (_charPos == _charLen && (await ReadBufferAsync(cancellationToken).ConfigureAwait(false)) == 0) { return null; } @@ -903,7 +933,7 @@ private int ReadBuffer(Span userBuffer, out bool readToUserBuffer) _charPos = tmpCharPos = i + 1; - if (ch == '\r' && (tmpCharPos < tmpCharLen || (await ReadBufferAsync(CancellationToken.None).ConfigureAwait(false)) > 0)) + if (ch == '\r' && (tmpCharPos < tmpCharLen || (await ReadBufferAsync(cancellationToken).ConfigureAwait(false)) > 0)) { tmpCharPos = _charPos; if (_charBuffer[tmpCharPos] == '\n') @@ -921,12 +951,37 @@ private int ReadBuffer(Span userBuffer, out bool readToUserBuffer) i = tmpCharLen - tmpCharPos; sb ??= new StringBuilder(i + 80); sb.Append(tmpCharBuffer, tmpCharPos, i); - } while (await ReadBufferAsync(CancellationToken.None).ConfigureAwait(false) > 0); + } while (await ReadBufferAsync(cancellationToken).ConfigureAwait(false) > 0); return sb.ToString(); } - public override Task ReadToEndAsync() + public override Task ReadToEndAsync() => ReadToEndAsync(default); + + /// + /// Reads all characters from the current position to the end of the stream asynchronously and returns them as one string. + /// + /// The token to monitor for cancellation requests. + /// A task that represents the asynchronous read operation. The value of the TResult parameter contains + /// a string with the characters from the current position to the end of the stream. + /// The number of characters is larger than . + /// The stream reader has been disposed. + /// The reader is currently in use by a previous read operation. + /// + /// The following example shows how to read the contents of a file by using the method. + /// + /// using CancellationTokenSource tokenSource = new (TimeSpan.FromSeconds(1)); + /// using StreamReader reader = File.OpenText("existingfile.txt"); + /// + /// Console.WriteLine(await reader.ReadToEndAsync(tokenSource.Token)); + /// + /// + /// + /// If this method is canceled via , some data + /// that has been read from the current but not stored (by the + /// ) or returned (to the caller) may be lost. + /// + public override Task ReadToEndAsync(CancellationToken cancellationToken) { // If we have been inherited into a subclass, the following implementation could be incorrect // since it does not call through to Read() which a subclass might have overridden. @@ -934,19 +989,19 @@ public override Task ReadToEndAsync() // and delegate to our base class (which will call into Read) when we are not sure. if (GetType() != typeof(StreamReader)) { - return base.ReadToEndAsync(); + return base.ReadToEndAsync(cancellationToken); } ThrowIfDisposed(); CheckAsyncTaskInProgress(); - Task task = ReadToEndAsyncInternal(); + Task task = ReadToEndAsyncInternal(cancellationToken); _asyncReadTask = task; return task; } - private async Task ReadToEndAsyncInternal() + private async Task ReadToEndAsyncInternal(CancellationToken cancellationToken) { // Call ReadBuffer, then pull data out of charBuffer. StringBuilder sb = new StringBuilder(_charLen - _charPos); @@ -955,7 +1010,7 @@ private async Task ReadToEndAsyncInternal() int tmpCharPos = _charPos; sb.Append(_charBuffer, tmpCharPos, _charLen - tmpCharPos); _charPos = _charLen; // We consumed these characters - await ReadBufferAsync(CancellationToken.None).ConfigureAwait(false); + await ReadBufferAsync(cancellationToken).ConfigureAwait(false); } while (_charLen > 0); return sb.ToString(); diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/StringReader.cs b/src/libraries/System.Private.CoreLib/src/System/IO/StringReader.cs index 3d50897ec7f386..a8e07ad382d151 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/StringReader.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/StringReader.cs @@ -224,11 +224,74 @@ public override string ReadToEnd() return Task.FromResult(ReadLine()); } + /// + /// Reads a line of characters asynchronously from the current string and returns the data as a string. + /// + /// The token to monitor for cancellation requests. + /// A value task that represents the asynchronous read operation. The value of the TResult + /// parameter contains the next line from the string reader, or is if all of the characters have been read. + /// The number of characters in the next line is larger than . + /// The string reader has been disposed. + /// The reader is currently in use by a previous read operation. + /// + /// The following example shows how to read one line at a time from a string asynchronously. + /// + /// using System.Text; + /// + /// StringBuilder stringToRead = new(); + /// stringToRead.AppendLine("Characters in 1st line to read"); + /// stringToRead.AppendLine("and 2nd line"); + /// stringToRead.AppendLine("and the end"); + /// + /// string readText; + /// using CancellationTokenSource tokenSource = new (TimeSpan.FromSeconds(1)); + /// using StringReader reader = new (stringToRead.ToString()); + /// while ((readText = await reader.ReadLineAsync(tokenSource.Token)) is not null) + /// { + /// Console.WriteLine(readText); + /// } + /// + /// + public override ValueTask ReadLineAsync(CancellationToken cancellationToken) => + cancellationToken.IsCancellationRequested + ? ValueTask.FromCanceled(cancellationToken) + : new ValueTask(ReadLine()); + public override Task ReadToEndAsync() { return Task.FromResult(ReadToEnd()); } + /// + /// Reads all characters from the current position to the end of the string asynchronously and returns them as a single string. + /// + /// The token to monitor for cancellation requests. + /// A task that represents the asynchronous read operation. The value of the TResult parameter contains + /// a string with the characters from the current position to the end of the string. + /// The number of characters is larger than . + /// The string reader has been disposed. + /// The reader is currently in use by a previous read operation. + /// + /// The following example shows how to read an entire string asynchronously. + /// + /// using System.Text; + /// + /// StringBuilder stringToRead = new(); + /// stringToRead.AppendLine("Characters in 1st line to read"); + /// stringToRead.AppendLine("and 2nd line"); + /// stringToRead.AppendLine("and the end"); + /// + /// using CancellationTokenSource tokenSource = new (TimeSpan.FromSeconds(1)); + /// using StringReader reader = new (stringToRead.ToString()); + /// var readText = await reader.ReadToEndAsync(tokenSource.Token); + /// Console.WriteLine(readText); + /// + /// + public override Task ReadToEndAsync(CancellationToken cancellationToken) => + cancellationToken.IsCancellationRequested + ? Task.FromCanceled(cancellationToken) + : Task.FromResult(ReadToEnd()); + public override Task ReadBlockAsync(char[] buffer, int index, int count) { if (buffer == null) diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/TextReader.cs b/src/libraries/System.Private.CoreLib/src/System/IO/TextReader.cs index 05211d6dc7a331..583fb3c2652ae6 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/TextReader.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/TextReader.cs @@ -203,18 +203,56 @@ public virtual int ReadBlock(Span buffer) } #region Task based Async APIs - public virtual Task ReadLineAsync() => + public virtual Task ReadLineAsync() => ReadLineCoreAsync(default); + + /// + /// Reads a line of characters asynchronously and returns the data as a string. + /// + /// The token to monitor for cancellation requests. + /// A value task that represents the asynchronous read operation. The value of the TResult + /// parameter contains the next line from the text reader, or is if all of the characters have been read. + /// The number of characters in the next line is larger than . + /// The text reader has been disposed. + /// The reader is currently in use by a previous read operation. + /// + /// The class is an abstract class. Therefore, you do not instantiate it in + /// your code. For an example of using the method, see the + /// method. + /// If the current represents the standard input stream returned by + /// the Console.In property, the method + /// executes synchronously rather than asynchronously. + /// + public virtual ValueTask ReadLineAsync(CancellationToken cancellationToken) => + new ValueTask(ReadLineCoreAsync(cancellationToken)); + + private Task ReadLineCoreAsync(CancellationToken cancellationToken) => Task.Factory.StartNew(static state => ((TextReader)state!).ReadLine(), this, - CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default); - - public virtual async Task ReadToEndAsync() + cancellationToken, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default); + + public virtual Task ReadToEndAsync() => ReadToEndAsync(default); + + /// + /// Reads all characters from the current position to the end of the text reader asynchronously and returns them as one string. + /// + /// The token to monitor for cancellation requests. + /// A task that represents the asynchronous read operation. The value of the TResult parameter contains + /// a string with the characters from the current position to the end of the text reader. + /// The number of characters is larger than . + /// The text reader has been disposed. + /// The reader is currently in use by a previous read operation. + /// + /// The class is an abstract class. Therefore, you do not instantiate it in + /// your code. For an example of using the method, see the + /// method. + /// + public virtual async Task ReadToEndAsync(CancellationToken cancellationToken) { var sb = new StringBuilder(4096); char[] chars = ArrayPool.Shared.Rent(4096); try { int len; - while ((len = await ReadAsyncInternal(chars, default).ConfigureAwait(false)) != 0) + while ((len = await ReadAsyncInternal(chars, cancellationToken).ConfigureAwait(false)) != 0) { sb.Append(chars, 0, len); } @@ -368,9 +406,17 @@ protected override void Dispose(bool disposing) [MethodImpl(MethodImplOptions.Synchronized)] public override Task ReadLineAsync() => Task.FromResult(ReadLine()); + [MethodImpl(MethodImplOptions.Synchronized)] + public override ValueTask ReadLineAsync(CancellationToken cancellationToken) + => cancellationToken.IsCancellationRequested ? ValueTask.FromCanceled(cancellationToken) : new ValueTask(ReadLine()); + [MethodImpl(MethodImplOptions.Synchronized)] public override Task ReadToEndAsync() => Task.FromResult(ReadToEnd()); + [MethodImpl(MethodImplOptions.Synchronized)] + public override Task ReadToEndAsync(CancellationToken cancellationToken) + => cancellationToken.IsCancellationRequested ? Task.FromCanceled(cancellationToken) : Task.FromResult(ReadToEnd()); + [MethodImpl(MethodImplOptions.Synchronized)] public override Task ReadBlockAsync(char[] buffer, int index, int count) { diff --git a/src/libraries/System.Runtime/ref/System.Runtime.cs b/src/libraries/System.Runtime/ref/System.Runtime.cs index b8b136aeb3b5a7..82211a2cca7c8d 100644 --- a/src/libraries/System.Runtime/ref/System.Runtime.cs +++ b/src/libraries/System.Runtime/ref/System.Runtime.cs @@ -10868,8 +10868,10 @@ protected override void Dispose(bool disposing) { } public override System.Threading.Tasks.ValueTask ReadBlockAsync(System.Memory buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public override string? ReadLine() { throw null; } public override System.Threading.Tasks.Task ReadLineAsync() { throw null; } + public override System.Threading.Tasks.ValueTask ReadLineAsync(System.Threading.CancellationToken cancellationToken) { throw null; } public override string ReadToEnd() { throw null; } public override System.Threading.Tasks.Task ReadToEndAsync() { throw null; } + public override System.Threading.Tasks.Task ReadToEndAsync(System.Threading.CancellationToken cancellationToken) { throw null; } } public partial class StreamWriter : System.IO.TextWriter { @@ -10933,8 +10935,10 @@ protected override void Dispose(bool disposing) { } public override System.Threading.Tasks.ValueTask ReadBlockAsync(System.Memory buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public override string? ReadLine() { throw null; } public override System.Threading.Tasks.Task ReadLineAsync() { throw null; } + public override System.Threading.Tasks.ValueTask ReadLineAsync(System.Threading.CancellationToken cancellationToken) { throw null; } public override string ReadToEnd() { throw null; } public override System.Threading.Tasks.Task ReadToEndAsync() { throw null; } + public override System.Threading.Tasks.Task ReadToEndAsync(System.Threading.CancellationToken cancellationToken) { throw null; } } public partial class StringWriter : System.IO.TextWriter { @@ -10985,8 +10989,10 @@ protected virtual void Dispose(bool disposing) { } public virtual System.Threading.Tasks.ValueTask ReadBlockAsync(System.Memory buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual string? ReadLine() { throw null; } public virtual System.Threading.Tasks.Task ReadLineAsync() { throw null; } + public virtual System.Threading.Tasks.ValueTask ReadLineAsync(System.Threading.CancellationToken cancellationToken) { throw null; } public virtual string ReadToEnd() { throw null; } public virtual System.Threading.Tasks.Task ReadToEndAsync() { throw null; } + public virtual System.Threading.Tasks.Task ReadToEndAsync(System.Threading.CancellationToken cancellationToken) { throw null; } public static System.IO.TextReader Synchronized(System.IO.TextReader reader) { throw null; } } public abstract partial class TextWriter : System.MarshalByRefObject, System.IAsyncDisposable, System.IDisposable From fb284a84f4175bbcc88a89cef72a63a39d73f64e Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Tue, 25 Jan 2022 15:09:34 -0500 Subject: [PATCH 068/161] Restrict parallelism in LLVM FullAOT compile, to prevent OOM (#63800) * Restrict parallelism in FullAOT compile, to prevent OOM * Reduce parallelism further, due to more OOM --- eng/pipelines/common/templates/runtimes/run-test-job.yml | 2 +- eng/pipelines/runtime.yml | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/eng/pipelines/common/templates/runtimes/run-test-job.yml b/eng/pipelines/common/templates/runtimes/run-test-job.yml index 6aa8a54f24c0f8..f944ad47ba2037 100644 --- a/eng/pipelines/common/templates/runtimes/run-test-job.yml +++ b/eng/pipelines/common/templates/runtimes/run-test-job.yml @@ -319,7 +319,7 @@ jobs: - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) $(logRootNameArg)MonoAot $(monoAotBuildshCommand) $(buildConfig) $(archType) $(runtimeVariantArg) displayName: "LLVM AOT compile CoreCLR tests" - ${{ if eq(parameters.archType, 'arm64') }}: - - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) $(logRootNameArg)MonoAot $(monoAotBuildshCommand) $(buildConfig) $(archType) cross $(runtimeVariantArg) + - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) $(logRootNameArg)MonoAot $(monoAotBuildshCommand) $(buildConfig) $(archType) cross $(runtimeVariantArg) -maxcpucount:2 displayName: "LLVM AOT cross-compile CoreCLR tests" env: __MonoToolPrefix: aarch64-linux-gnu- diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml index 7fb2493bac4790..1c376cad61b93e 100644 --- a/eng/pipelines/runtime.yml +++ b/eng/pipelines/runtime.yml @@ -1110,8 +1110,7 @@ jobs: runtimeFlavor: mono platforms: - Linux_x64 - # Disabled pending outcome of https://github.com/dotnet/runtime/issues/60234 investigation - #- Linux_arm64 + - Linux_arm64 helixQueueGroup: pr helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml jobParameters: From 33940e671a16ca558cc9d145369e16fd0ae2132e Mon Sep 17 00:00:00 2001 From: Vladimir Sadov Date: Tue, 25 Jan 2022 13:10:05 -0800 Subject: [PATCH 069/161] Moved AssemblyName helpers to managed (#62866) * Moved ComputePublicKeyToken to managed * Managed assembly name parsing (adapted from nativeaot) * Fix for HostActivation failures. * PR feedback (RuntimeAssemblyName is back to CoreRT + other comments) * remove AssemblyNameNative::Init form the .hpp * remove AppX compat ifdef * renamed instance fields to convention used in C# * `Argument_InvalidAssemblyName` should be `InvalidAssemblyName`. Majority of use is `FileLoadException`. * remove `this.` * PR feedback (assign to fileds, bypass properties) * missed this change in the rebase * "low-hanging fruit" perf tweaks. * move one-user helpers to where they are used. * removed ActiveIssue for #45032 * remove AssemblyNameHelpers.cs form corelib * Remove the List when detecting duplicates. Support PublicKey. * whitespace * Fix managed implementation to match the new tests. * Some minor cleanup. * Do not validate culture too early * PR feedback * use SR.InvalidAssemblyName * Report the input string when throwing FileLoadException * tweaked couple comments --- .../System/Reflection/AssemblyName.CoreCLR.cs | 18 - .../Runtime/Augments/RuntimeAugments.cs | 5 + .../src/System.Private.CoreLib.csproj | 6 +- .../System/Reflection/AssemblyName.CoreRT.cs | 19 - .../System/Reflection/AssemblyNameHelpers.cs | 47 +- .../System/Reflection/AssemblyNameLexer.cs | 136 ------ .../System/Reflection/AssemblyNameParser.cs | 230 ---------- .../Reflection/AssemblyRuntimeNameHelpers.cs | 52 +++ .../System/Reflection/RuntimeAssemblyName.cs | 27 +- .../Core/Execution/ExecutionDomain.cs | 2 +- .../Runtime/TypeParsing/TypeLexer.cs | 4 +- src/coreclr/vm/assembly.cpp | 2 +- src/coreclr/vm/assemblyname.cpp | 73 +-- src/coreclr/vm/assemblyname.hpp | 2 - src/coreclr/vm/assemblynative.cpp | 5 +- src/coreclr/vm/assemblyspec.cpp | 174 +++---- src/coreclr/vm/assemblyspec.hpp | 4 +- src/coreclr/vm/ecalllist.h | 2 - .../src/Resources/Strings.resx | 7 +- .../System.Private.CoreLib.Shared.projitems | 4 +- .../src/System/Reflection/AssemblyName.cs | 30 +- .../AssemblyNameHelpers.StrongName.cs | 3 +- .../System/Reflection/AssemblyNameParser.cs | 427 ++++++++++++++++++ .../src/System/ThrowHelper.cs | 6 + .../tests/AssemblyNameTests.cs | 1 - .../System/Reflection/AssemblyName.Mono.cs | 50 -- src/mono/mono/metadata/icall-decl.h | 1 - src/mono/mono/metadata/icall-def-netcore.h | 2 - src/mono/mono/metadata/icall.c | 15 - 29 files changed, 628 insertions(+), 726 deletions(-) delete mode 100644 src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/AssemblyNameLexer.cs delete mode 100644 src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/AssemblyNameParser.cs create mode 100644 src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/AssemblyRuntimeNameHelpers.cs rename src/{coreclr/nativeaot => libraries}/System.Private.CoreLib/src/System/Reflection/AssemblyNameHelpers.StrongName.cs (98%) create mode 100644 src/libraries/System.Private.CoreLib/src/System/Reflection/AssemblyNameParser.cs diff --git a/src/coreclr/System.Private.CoreLib/src/System/Reflection/AssemblyName.CoreCLR.cs b/src/coreclr/System.Private.CoreLib/src/System/Reflection/AssemblyName.CoreCLR.cs index f45b3837abdd93..0a3cd42ba900a5 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/Reflection/AssemblyName.CoreCLR.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/Reflection/AssemblyName.CoreCLR.cs @@ -11,18 +11,6 @@ namespace System.Reflection { public sealed partial class AssemblyName : ICloneable, IDeserializationCallback, ISerializable { - public AssemblyName(string assemblyName) - { - if (assemblyName == null) - throw new ArgumentNullException(nameof(assemblyName)); - if ((assemblyName.Length == 0) || - (assemblyName[0] == '\0')) - throw new ArgumentException(SR.Format_StringZeroLength); - - _name = assemblyName; - nInit(); - } - internal AssemblyName(string? name, byte[]? publicKey, byte[]? publicKeyToken, @@ -44,9 +32,6 @@ internal AssemblyName(string? name, _flags = flags; } - [MethodImpl(MethodImplOptions.InternalCall)] - internal extern void nInit(); - // This call opens and closes the file, but does not add the // assembly to the domain. [MethodImpl(MethodImplOptions.InternalCall)] @@ -58,9 +43,6 @@ internal static AssemblyName GetFileInformationCore(string assemblyFile) return nGetFileInformation(fullPath); } - [MethodImpl(MethodImplOptions.InternalCall)] - private extern byte[]? ComputePublicKeyToken(); - internal void SetProcArchIndex(PortableExecutableKinds pek, ImageFileMachine ifm) { #pragma warning disable SYSLIB0037 // AssemblyName.ProcessorArchitecture is obsolete diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeAugments.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeAugments.cs index 2cc2f40a841f89..198172362464a0 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeAugments.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeAugments.cs @@ -1091,5 +1091,10 @@ public static bool IsPrimitive(RuntimeTypeHandle typeHandle) { return typeHandle.ToEETypePtr().IsPrimitive && !typeHandle.ToEETypePtr().IsEnum; } + + public static byte[] ComputePublicKeyToken(byte[] publicKey) + { + return System.Reflection.AssemblyNameHelpers.ComputePublicKeyToken(publicKey); + } } } diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj b/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj index cf0cab0700ebac..bc79d83f0d4768 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj @@ -123,12 +123,10 @@ - - - - + + diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/AssemblyName.CoreRT.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/AssemblyName.CoreRT.cs index bc3ef378043153..7efcf64288a621 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/AssemblyName.CoreRT.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/AssemblyName.CoreRT.cs @@ -7,25 +7,6 @@ namespace System.Reflection { public sealed partial class AssemblyName : ICloneable, IDeserializationCallback, ISerializable { - public AssemblyName(string assemblyName) - : this() - { - if (assemblyName == null) - throw new ArgumentNullException(nameof(assemblyName)); - if ((assemblyName.Length == 0) || - (assemblyName[0] == '\0')) - throw new ArgumentException(SR.Format_StringZeroLength); - - _name = assemblyName; - RuntimeAssemblyName runtimeAssemblyName = AssemblyNameParser.Parse(_name); - runtimeAssemblyName.CopyToAssemblyName(this); - } - - private byte[] ComputePublicKeyToken() - { - return AssemblyNameHelpers.ComputePublicKeyToken(_publicKey); - } - private static AssemblyName GetFileInformationCore(string assemblyFile) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_AssemblyName_GetAssemblyName); diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/AssemblyNameHelpers.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/AssemblyNameHelpers.cs index b259e2b6bfbdc3..a79f9f7f653071 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/AssemblyNameHelpers.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/AssemblyNameHelpers.cs @@ -9,41 +9,8 @@ namespace System.Reflection { - [System.Runtime.CompilerServices.ReflectionBlocked] - public static partial class AssemblyNameHelpers + internal static partial class AssemblyNameHelpers { - // - // Converts an AssemblyName to a RuntimeAssemblyName that is free from any future mutations on the AssemblyName. - // - public static RuntimeAssemblyName ToRuntimeAssemblyName(this AssemblyName assemblyName) - { - if (assemblyName.Name == null) - throw new ArgumentException(); - - AssemblyNameFlags flags = assemblyName.Flags; - AssemblyContentType contentType = assemblyName.ContentType; -#pragma warning disable SYSLIB0037 // AssemblyName.ProcessorArchitecture is obsolete - ProcessorArchitecture processorArchitecture = assemblyName.ProcessorArchitecture; -#pragma warning restore SYSLIB0037 - AssemblyNameFlags combinedFlags = CombineAssemblyNameFlags(flags, contentType, processorArchitecture); - byte[]? pkOriginal; - if (0 != (flags & AssemblyNameFlags.PublicKey)) - pkOriginal = assemblyName.GetPublicKey(); - else - pkOriginal = assemblyName.GetPublicKeyToken(); - - // AssemblyName's PKT property getters do NOT copy the array before giving it out. Make our own copy - // as the original is wide open to tampering by anyone. - byte[]? pkCopy = null; - if (pkOriginal != null) - { - pkCopy = new byte[pkOriginal.Length]; - ((ICollection)pkOriginal).CopyTo(pkCopy, 0); - } - - return new RuntimeAssemblyName(assemblyName.Name, assemblyName.Version, assemblyName.CultureName, combinedFlags, pkCopy); - } - // // These helpers convert between the combined flags+contentType+processorArchitecture value and the separated parts. // @@ -55,19 +22,9 @@ internal static AssemblyContentType ExtractAssemblyContentType(this AssemblyName return (AssemblyContentType)((((int)flags) >> 9) & 0x7); } - internal static ProcessorArchitecture ExtractProcessorArchitecture(this AssemblyNameFlags flags) - { - return (ProcessorArchitecture)((((int)flags) >> 4) & 0x7); - } - - public static AssemblyNameFlags ExtractAssemblyNameFlags(this AssemblyNameFlags combinedFlags) + internal static AssemblyNameFlags ExtractAssemblyNameFlags(this AssemblyNameFlags combinedFlags) { return combinedFlags & unchecked((AssemblyNameFlags)0xFFFFF10F); } - - internal static AssemblyNameFlags CombineAssemblyNameFlags(AssemblyNameFlags flags, AssemblyContentType contentType, ProcessorArchitecture processorArchitecture) - { - return (AssemblyNameFlags)(((int)flags) | (((int)contentType) << 9) | ((int)processorArchitecture << 4)); - } } } diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/AssemblyNameLexer.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/AssemblyNameLexer.cs deleted file mode 100644 index 84555ab310d454..00000000000000 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/AssemblyNameLexer.cs +++ /dev/null @@ -1,136 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.IO; -using System.Text; -using System.Globalization; -using System.Collections.Generic; -using System.Runtime.InteropServices; - -namespace System.Reflection -{ - // - // A simple lexer for assembly display names. - // - internal struct AssemblyNameLexer - { - internal AssemblyNameLexer(string s) - { - // Convert string to char[] with NUL terminator. (An actual NUL terminator in the input string will be treated - // as an actual end of string: this is compatible with desktop behavior.) - char[] chars = new char[s.Length + 1]; - s.CopyTo(0, chars, 0, s.Length); - _chars = chars; - _index = 0; - } - - // - // Return the next token in assembly name. If you expect the result to be DisplayNameToken.String, - // use GetNext(out String) instead. - // - internal Token GetNext() - { - return GetNext(out _); - } - - // - // Return the next token in assembly name. If the result is DisplayNameToken.String, - // sets "tokenString" to the tokenized string. - // - internal Token GetNext(out string tokenString) - { - tokenString = null; - while (char.IsWhiteSpace(_chars[_index])) - _index++; - - char c = _chars[_index++]; - if (c == 0) - return Token.End; - if (c == ',') - return Token.Comma; - if (c == '=') - return Token.Equals; - - StringBuilder sb = new StringBuilder(); - - char quoteChar = (char)0; - if (c == '\'' || c == '\"') - { - quoteChar = c; - c = _chars[_index++]; - } - - for (;;) - { - if (c == 0) - { - _index--; - break; // Terminate: End of string (desktop compat: if string was quoted, permitted to terminate without end-quote.) - } - - if (quoteChar != 0 && c == quoteChar) - break; // Terminate: Found closing quote of quoted string. - - if (quoteChar == 0 && (c == ',' || c == '=')) - { - _index--; - break; // Terminate: Found start of a new ',' or '=' token. - } - - if (quoteChar == 0 && (c == '\'' || c == '\"')) - throw new FileLoadException(); // Desktop compat: Unescaped quote illegal unless entire string is quoted. - - if (c == '\\') - { - c = _chars[_index++]; - - switch (c) - { - case '\\': - case ',': - case '=': - case '\'': - case '"': - sb.Append(c); - break; - case 't': - sb.Append('\t'); - break; - case 'r': - sb.Append('\r'); - break; - case 'n': - sb.Append('\n'); - break; - default: - throw new FileLoadException(); // Unrecognized escape - } - } - else - { - sb.Append(c); - } - - c = _chars[_index++]; - } - - tokenString = sb.ToString(); - if (quoteChar == 0) - tokenString = tokenString.Trim(); // Unless quoted, whitespace at beginning or end doesn't count. - return Token.String; - } - - // Token categories for display name lexer. - internal enum Token - { - Equals = 1, - Comma = 2, - String = 3, - End = 4, - } - - private readonly char[] _chars; - private int _index; - } -} diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/AssemblyNameParser.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/AssemblyNameParser.cs deleted file mode 100644 index 5d8f2ef1c34b0a..00000000000000 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/AssemblyNameParser.cs +++ /dev/null @@ -1,230 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.IO; -using System.Text; -using System.Diagnostics; -using System.Globalization; -using System.Collections.Generic; -using System.Runtime.InteropServices; - -namespace System.Reflection -{ - // - // Parses an assembly name. - // - [System.Runtime.CompilerServices.ReflectionBlocked] - public static class AssemblyNameParser - { - public static void Parse(AssemblyName blank, string s) - { - if (s == null) - throw new ArgumentNullException(nameof(s)); - RuntimeAssemblyName runtimeAssemblyName = Parse(s); - runtimeAssemblyName.CopyToAssemblyName(blank); - } - - public static RuntimeAssemblyName Parse(string s) - { - Debug.Assert(s != null); - - int indexOfNul = s.IndexOf((char)0); - if (indexOfNul != -1) - s = s.Substring(0, indexOfNul); - if (s.Length == 0) - throw new ArgumentException(SR.Format_StringZeroLength); - - AssemblyNameLexer lexer = new AssemblyNameLexer(s); - - // Name must come first. - string name; - AssemblyNameLexer.Token token = lexer.GetNext(out name); - if (token != AssemblyNameLexer.Token.String) - throw new FileLoadException(SR.InvalidAssemblyName); - - if (name == string.Empty || name.IndexOfAny(s_illegalCharactersInSimpleName) != -1) - throw new FileLoadException(SR.InvalidAssemblyName); - - Version? version = null; - string? cultureName = null; - byte[]? pkt = null; - AssemblyNameFlags flags = 0; - - LowLevelList alreadySeen = new LowLevelList(); - token = lexer.GetNext(); - while (token != AssemblyNameLexer.Token.End) - { - if (token != AssemblyNameLexer.Token.Comma) - throw new FileLoadException(SR.InvalidAssemblyName); - string attributeName; - - token = lexer.GetNext(out attributeName); - if (token != AssemblyNameLexer.Token.String) - throw new FileLoadException(SR.InvalidAssemblyName); - token = lexer.GetNext(); - - // Compat note: Inside AppX apps, the desktop CLR's AssemblyName parser skips past any elements that don't follow the "=" pattern. - // (when running classic Windows apps, such an illegal construction throws an exception as expected.) - // Naturally, at least one app unwittingly takes advantage of this. - if (token == AssemblyNameLexer.Token.Comma || token == AssemblyNameLexer.Token.End) - continue; - - if (token != AssemblyNameLexer.Token.Equals) - throw new FileLoadException(SR.InvalidAssemblyName); - string attributeValue; - token = lexer.GetNext(out attributeValue); - if (token != AssemblyNameLexer.Token.String) - throw new FileLoadException(SR.InvalidAssemblyName); - - if (attributeName == string.Empty) - throw new FileLoadException(SR.InvalidAssemblyName); - - for (int i = 0; i < alreadySeen.Count; i++) - { - if (alreadySeen[i].Equals(attributeName, StringComparison.OrdinalIgnoreCase)) - throw new FileLoadException(SR.InvalidAssemblyName); // Cannot specify the same attribute twice. - } - alreadySeen.Add(attributeName); - - if (attributeName.Equals("Version", StringComparison.OrdinalIgnoreCase)) - { - version = ParseVersion(attributeValue); - } - - if (attributeName.Equals("Culture", StringComparison.OrdinalIgnoreCase)) - { - cultureName = ParseCulture(attributeValue); - } - - if (attributeName.Equals("PublicKeyToken", StringComparison.OrdinalIgnoreCase)) - { - pkt = ParsePKT(attributeValue); - } - - if (attributeName.Equals("ProcessorArchitecture", StringComparison.OrdinalIgnoreCase)) - { - flags |= (AssemblyNameFlags)(((int)ParseProcessorArchitecture(attributeValue)) << 4); - } - - if (attributeName.Equals("Retargetable", StringComparison.OrdinalIgnoreCase)) - { - if (attributeValue.Equals("Yes", StringComparison.OrdinalIgnoreCase)) - flags |= AssemblyNameFlags.Retargetable; - else if (attributeValue.Equals("No", StringComparison.OrdinalIgnoreCase)) - { - // nothing to do - } - else - throw new FileLoadException(SR.InvalidAssemblyName); - } - - if (attributeName.Equals("ContentType", StringComparison.OrdinalIgnoreCase)) - { - if (attributeValue.Equals("WindowsRuntime", StringComparison.OrdinalIgnoreCase)) - flags |= (AssemblyNameFlags)(((int)AssemblyContentType.WindowsRuntime) << 9); - else - throw new FileLoadException(SR.InvalidAssemblyName); - } - - // Desktop compat: If we got here, the attribute name is unknown to us. Ignore it (as long it's not duplicated.) - token = lexer.GetNext(); - } - return new RuntimeAssemblyName(name, version, cultureName, flags, pkt); - } - - private static Version ParseVersion(string attributeValue) - { - string[] parts = attributeValue.Split('.'); - if (parts.Length > 4) - throw new FileLoadException(SR.InvalidAssemblyName); - ushort[] versionNumbers = new ushort[4]; - for (int i = 0; i < versionNumbers.Length; i++) - { - if (i >= parts.Length) - versionNumbers[i] = ushort.MaxValue; - else - { - // Desktop compat: TryParse is a little more forgiving than Fusion. - for (int j = 0; j < parts[i].Length; j++) - { - if (!char.IsDigit(parts[i][j])) - throw new FileLoadException(SR.InvalidAssemblyName); - } - if (!(ushort.TryParse(parts[i], out versionNumbers[i]))) - { - throw new FileLoadException(SR.InvalidAssemblyName); - } - } - } - - if (versionNumbers[0] == ushort.MaxValue || versionNumbers[1] == ushort.MaxValue) - throw new FileLoadException(SR.InvalidAssemblyName); - if (versionNumbers[2] == ushort.MaxValue) - return new Version(versionNumbers[0], versionNumbers[1]); - if (versionNumbers[3] == ushort.MaxValue) - return new Version(versionNumbers[0], versionNumbers[1], versionNumbers[2]); - return new Version(versionNumbers[0], versionNumbers[1], versionNumbers[2], versionNumbers[3]); - } - - private static string ParseCulture(string attributeValue) - { - if (attributeValue.Equals("Neutral", StringComparison.OrdinalIgnoreCase)) - { - return ""; - } - else - { - CultureInfo culture = CultureInfo.GetCultureInfo(attributeValue); // Force a CultureNotFoundException if not a valid culture. - return culture.Name; - } - } - - private static byte[] ParsePKT(string attributeValue) - { - if (attributeValue.Equals("null", StringComparison.OrdinalIgnoreCase) || attributeValue == string.Empty) - return Array.Empty(); - - if (attributeValue.Length != 8 * 2) - throw new FileLoadException(SR.InvalidAssemblyName); - - byte[] pkt = new byte[8]; - int srcIndex = 0; - for (int i = 0; i < 8; i++) - { - char hi = attributeValue[srcIndex++]; - char lo = attributeValue[srcIndex++]; - pkt[i] = (byte)((ParseHexNybble(hi) << 4) | ParseHexNybble(lo)); - } - return pkt; - } - - private static ProcessorArchitecture ParseProcessorArchitecture(string attributeValue) - { - if (attributeValue.Equals("msil", StringComparison.OrdinalIgnoreCase)) - return ProcessorArchitecture.MSIL; - if (attributeValue.Equals("x86", StringComparison.OrdinalIgnoreCase)) - return ProcessorArchitecture.X86; - if (attributeValue.Equals("ia64", StringComparison.OrdinalIgnoreCase)) - return ProcessorArchitecture.IA64; - if (attributeValue.Equals("amd64", StringComparison.OrdinalIgnoreCase)) - return ProcessorArchitecture.Amd64; - if (attributeValue.Equals("arm", StringComparison.OrdinalIgnoreCase)) - return ProcessorArchitecture.Arm; - throw new FileLoadException(SR.InvalidAssemblyName); - } - - private static byte ParseHexNybble(char c) - { - if (c >= '0' && c <= '9') - return (byte)(c - '0'); - if (c >= 'a' && c <= 'f') - return (byte)(c - 'a' + 10); - if (c >= 'A' && c <= 'F') - return (byte)(c - 'A' + 10); - throw new FileLoadException(SR.InvalidAssemblyName); - } - - private static readonly char[] s_illegalCharactersInSimpleName = { '/', '\\', ':' }; - } -} diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/AssemblyRuntimeNameHelpers.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/AssemblyRuntimeNameHelpers.cs new file mode 100644 index 00000000000000..fc4ed2816e5802 --- /dev/null +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/AssemblyRuntimeNameHelpers.cs @@ -0,0 +1,52 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Globalization; +using System.IO; +using System.Text; +using System.Collections.Generic; + +namespace System.Reflection +{ + [System.Runtime.CompilerServices.ReflectionBlocked] + public static class AssemblyRuntimeNameHelpers + { + // + // Converts an AssemblyName to a RuntimeAssemblyName that is free from any future mutations on the AssemblyName. + // + public static RuntimeAssemblyName ToRuntimeAssemblyName(this AssemblyName assemblyName) + { + if (assemblyName.Name == null) + throw new ArgumentException(SR.InvalidAssemblyName); + + AssemblyNameFlags flags = assemblyName.Flags; + AssemblyContentType contentType = assemblyName.ContentType; +#pragma warning disable SYSLIB0037 // AssemblyName.ProcessorArchitecture is obsolete + ProcessorArchitecture processorArchitecture = assemblyName.ProcessorArchitecture; +#pragma warning restore SYSLIB0037 + AssemblyNameFlags combinedFlags = CombineAssemblyNameFlags(flags, contentType, processorArchitecture); + byte[]? pkOriginal; + if (0 != (flags & AssemblyNameFlags.PublicKey)) + pkOriginal = assemblyName.GetPublicKey(); + else + pkOriginal = assemblyName.GetPublicKeyToken(); + + // AssemblyName's PKT property getters do NOT copy the array before giving it out. Make our own copy + // as the original is wide open to tampering by anyone. + byte[]? pkCopy = null; + if (pkOriginal != null) + { + pkCopy = new byte[pkOriginal.Length]; + Array.Copy(pkOriginal, pkCopy, pkOriginal.Length); + } + + return new RuntimeAssemblyName(assemblyName.Name, assemblyName.Version, assemblyName.CultureName, combinedFlags, pkCopy); + } + + internal static AssemblyNameFlags CombineAssemblyNameFlags(AssemblyNameFlags flags, AssemblyContentType contentType, ProcessorArchitecture processorArchitecture) + { + return (AssemblyNameFlags)(((int)flags) | (((int)contentType) << 9) | ((int)processorArchitecture << 4)); + } + } +} diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/RuntimeAssemblyName.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/RuntimeAssemblyName.cs index 90c0fe5ff824a8..f4dbc0d667140d 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/RuntimeAssemblyName.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/RuntimeAssemblyName.cs @@ -16,7 +16,7 @@ namespace System.Reflection // public sealed class RuntimeAssemblyName : IEquatable { - public RuntimeAssemblyName(string name, Version version, string cultureName, AssemblyNameFlags flags, byte[] publicKeyOrToken) + public RuntimeAssemblyName(string name, Version? version, string? cultureName, AssemblyNameFlags flags, byte[]? publicKeyOrToken) { Debug.Assert(name != null); this.Name = name; @@ -34,20 +34,26 @@ public RuntimeAssemblyName(string name, Version version, string cultureName, Ass this.PublicKeyOrToken = publicKeyOrToken; } + public static RuntimeAssemblyName Parse(string name) + { + AssemblyNameParser.AssemblyNameParts parts = AssemblyNameParser.Parse(name); + return new RuntimeAssemblyName(parts._name, parts._version, parts._cultureName, parts._flags, parts._publicKeyOrToken); + } + // Simple name. public string Name { get; } // Optional version. - public Version Version { get; } + public Version? Version { get; } // Optional culture name. - public string CultureName { get; } + public string? CultureName { get; } // Optional flags (this is actually an OR of the classic flags and the ContentType.) public AssemblyNameFlags Flags { get; } // Optional public key (if Flags.PublicKey == true) or public key token. - public byte[] PublicKeyOrToken { get; } + public byte[]? PublicKeyOrToken { get; } // Equality - this compares every bit of data in the RuntimeAssemblyName which is acceptable for use as keys in a cache // where semantic duplication is permissible. This method is *not* meant to define ref->def binding rules or @@ -73,8 +79,8 @@ public bool Equals(RuntimeAssemblyName? other) if (this.Flags != other.Flags) return false; - byte[] thisPK = this.PublicKeyOrToken; - byte[] otherPK = other.PublicKeyOrToken; + byte[]? thisPK = this.PublicKeyOrToken; + byte[]? otherPK = other.PublicKeyOrToken; if (thisPK == null) { if (otherPK != null) @@ -139,7 +145,7 @@ public void CopyToAssemblyName(AssemblyName blank) blank.Flags = this.Flags.ExtractAssemblyNameFlags(); blank.ContentType = this.Flags.ExtractAssemblyContentType(); #pragma warning disable SYSLIB0037 // AssemblyName.ProcessorArchitecture is obsolete - blank.ProcessorArchitecture = this.Flags.ExtractProcessorArchitecture(); + blank.ProcessorArchitecture = ExtractProcessorArchitecture(this.Flags); #pragma warning restore SYSLIB0037 if (this.PublicKeyOrToken != null) @@ -162,9 +168,14 @@ public string FullName { get { - byte[] pkt = (0 != (Flags & AssemblyNameFlags.PublicKey)) ? AssemblyNameHelpers.ComputePublicKeyToken(PublicKeyOrToken) : PublicKeyOrToken; + byte[]? pkt = (0 != (Flags & AssemblyNameFlags.PublicKey)) ? AssemblyNameHelpers.ComputePublicKeyToken(PublicKeyOrToken) : PublicKeyOrToken; return AssemblyNameFormatter.ComputeDisplayName(Name, Version, CultureName, pkt, Flags.ExtractAssemblyNameFlags(), Flags.ExtractAssemblyContentType()); } } + + internal static ProcessorArchitecture ExtractProcessorArchitecture(AssemblyNameFlags flags) + { + return (ProcessorArchitecture)((((int)flags) >> 4) & 0x7); + } } } diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/Internal/Reflection/Core/Execution/ExecutionDomain.cs b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/Internal/Reflection/Core/Execution/ExecutionDomain.cs index 53edc6a6ec5e49..2227d4a59682b4 100644 --- a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/Internal/Reflection/Core/Execution/ExecutionDomain.cs +++ b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/Internal/Reflection/Core/Execution/ExecutionDomain.cs @@ -89,7 +89,7 @@ private static CoreTypeResolver CreateCoreTypeResolver(FuncVerifyIsAssembly(); AssemblySpec spec; - spec.InitializeSpec(TokenFromRid(mdtAssembly,1),pImage->GetMDImport(),NULL); + spec.InitializeSpec(TokenFromRid(1,mdtAssembly),pImage->GetMDImport(),NULL); spec.AssemblyNameInit(&gc.result, pImage); HELPER_METHOD_FRAME_END(); return OBJECTREFToObject(gc.result); } FCIMPLEND - -FCIMPL1(Object*, AssemblyNameNative::GetPublicKeyToken, Object* refThisUNSAFE) -{ - FCALL_CONTRACT; - - U1ARRAYREF orOutputArray = NULL; - OBJECTREF refThis = (OBJECTREF) refThisUNSAFE; - HELPER_METHOD_FRAME_BEGIN_RET_1(refThis); - - if (refThis == NULL) - COMPlusThrow(kNullReferenceException, W("NullReference_This")); - - ASSEMBLYNAMEREF orThis = (ASSEMBLYNAMEREF)refThis; - U1ARRAYREF orPublicKey = orThis->GetPublicKey(); - - if (orPublicKey != NULL) { - DWORD cb = orPublicKey->GetNumComponents(); - StrongNameBufferHolder pbToken; - - if (cb) { - CQuickBytes qb; - BYTE *pbKey = (BYTE*) qb.AllocThrows(cb); - memcpy(pbKey, orPublicKey->GetDataPtr(), cb); - - { - GCX_PREEMP(); - IfFailThrow(StrongNameTokenFromPublicKey(pbKey, cb, &pbToken, &cb)); - } - } - - orOutputArray = (U1ARRAYREF)AllocatePrimitiveArray(ELEMENT_TYPE_U1, cb); - memcpyNoGCRefs(orOutputArray->m_Array, pbToken, cb); - } - - HELPER_METHOD_FRAME_END(); - return OBJECTREFToObject(orOutputArray); -} -FCIMPLEND - - -FCIMPL1(void, AssemblyNameNative::Init, Object * refThisUNSAFE) -{ - FCALL_CONTRACT; - - ASSEMBLYNAMEREF pThis = (ASSEMBLYNAMEREF) (OBJECTREF) refThisUNSAFE; - HRESULT hr = S_OK; - - HELPER_METHOD_FRAME_BEGIN_1(pThis); - - if (pThis == NULL) - COMPlusThrow(kNullReferenceException, W("NullReference_This")); - - ACQUIRE_STACKING_ALLOCATOR(pStackingAllocator); - - AssemblySpec spec; - hr = spec.InitializeSpec(pStackingAllocator, (ASSEMBLYNAMEREF *) &pThis, TRUE); - - if (SUCCEEDED(hr)) - { - spec.AssemblyNameInit(&pThis,NULL); - } - else - { - ThrowHR(hr); - } - - HELPER_METHOD_FRAME_END(); -} -FCIMPLEND - - diff --git a/src/coreclr/vm/assemblyname.hpp b/src/coreclr/vm/assemblyname.hpp index 9e818fc1a9f7cc..a336cfaf9ae701 100644 --- a/src/coreclr/vm/assemblyname.hpp +++ b/src/coreclr/vm/assemblyname.hpp @@ -19,8 +19,6 @@ class AssemblyNameNative { public: static FCDECL1(Object*, GetFileInformation, StringObject* filenameUNSAFE); - static FCDECL1(Object*, GetPublicKeyToken, Object* refThisUNSAFE); - static FCDECL1(void, Init, Object * refThisUNSAFE); }; #endif // _AssemblyName_H diff --git a/src/coreclr/vm/assemblynative.cpp b/src/coreclr/vm/assemblynative.cpp index a51280e21e4a34..19a5d62c0b9ed0 100644 --- a/src/coreclr/vm/assemblynative.cpp +++ b/src/coreclr/vm/assemblynative.cpp @@ -86,9 +86,8 @@ extern "C" void QCALLTYPE AssemblyNative_InternalLoad(QCall::ObjectHandleOnStack } // Initialize spec - spec.InitializeSpec(pStackingAllocator, - &assemblyNameRef, - FALSE); + spec.InitializeSpec(pStackingAllocator, &assemblyNameRef); + GCPROTECT_END(); spec.SetCodeBase(NULL); diff --git a/src/coreclr/vm/assemblyspec.cpp b/src/coreclr/vm/assemblyspec.cpp index 0cea7dc7121070..5bdb2cbd65259e 100644 --- a/src/coreclr/vm/assemblyspec.cpp +++ b/src/coreclr/vm/assemblyspec.cpp @@ -250,8 +250,7 @@ void AssemblySpec::InitializeSpec(PEAssembly * pFile) // This uses thread storage to allocate space. Please use Checkpoint and release it. -HRESULT AssemblySpec::InitializeSpec(StackingAllocator* alloc, ASSEMBLYNAMEREF* pName, - BOOL fParse /*=TRUE*/) +void AssemblySpec::InitializeSpec(StackingAllocator* alloc, ASSEMBLYNAMEREF* pName) { CONTRACTL { @@ -271,11 +270,6 @@ HRESULT AssemblySpec::InitializeSpec(StackingAllocator* alloc, ASSEMBLYNAMEREF* WCHAR* pString; int iString; ((STRINGREF) (*pName)->GetSimpleName())->RefInterpretGetStringValuesDangerousForGC(&pString, &iString); - - // we will not parse names that contain nulls - if (fParse && (wcslen(pString) != (size_t)iString)) - ThrowHR(FUSION_E_INVALID_NAME); - DWORD lgth = WszWideCharToMultiByte(CP_UTF8, 0, pString, iString, NULL, 0, NULL, NULL); if (lgth + 1 < lgth) ThrowHR(E_INVALIDARG); @@ -295,108 +289,86 @@ HRESULT AssemblySpec::InitializeSpec(StackingAllocator* alloc, ASSEMBLYNAMEREF* SetName(lpName); } - if (fParse) - { - HRESULT hr = ParseName(); - // Sometimes Fusion flags invalid characters in the name, sometimes it doesn't - // depending on where the invalid characters are - // We want to Raise the assembly resolve event on all invalid characters - // but calling ParseName before checking for invalid characters gives Fusion a chance to - // parse the rest of the name (to get a public key token, etc.) - if ((hr == FUSION_E_INVALID_NAME) || (!IsValidAssemblyName())) { - // This is the only case where we do not throw on an error - // We don't want to throw so as to give the caller a chance to call RaiseAssemblyResolveEvent - // The only caller that cares is System.Reflection.Assembly.InternalLoad which calls us through - // AssemblyNameNative::Init - return FUSION_E_INVALID_NAME; - } - else - IfFailThrow(hr); + AssemblyMetaDataInternal asmInfo; + // Flags + DWORD dwFlags = (*pName)->GetFlags(); + + // Version + VERSIONREF version = (VERSIONREF) (*pName)->GetVersion(); + if(version == NULL) { + asmInfo.usMajorVersion = (USHORT)-1; + asmInfo.usMinorVersion = (USHORT)-1; + asmInfo.usBuildNumber = (USHORT)-1; + asmInfo.usRevisionNumber = (USHORT)-1; } else { - AssemblyMetaDataInternal asmInfo; - // Flags - DWORD dwFlags = (*pName)->GetFlags(); - - // Version - VERSIONREF version = (VERSIONREF) (*pName)->GetVersion(); - if(version == NULL) { - asmInfo.usMajorVersion = (USHORT)-1; - asmInfo.usMinorVersion = (USHORT)-1; - asmInfo.usBuildNumber = (USHORT)-1; - asmInfo.usRevisionNumber = (USHORT)-1; - } - else { - asmInfo.usMajorVersion = (USHORT)version->GetMajor(); - asmInfo.usMinorVersion = (USHORT)version->GetMinor(); - asmInfo.usBuildNumber = (USHORT)version->GetBuild(); - asmInfo.usRevisionNumber = (USHORT)version->GetRevision(); - } + asmInfo.usMajorVersion = (USHORT)version->GetMajor(); + asmInfo.usMinorVersion = (USHORT)version->GetMinor(); + asmInfo.usBuildNumber = (USHORT)version->GetBuild(); + asmInfo.usRevisionNumber = (USHORT)version->GetRevision(); + } - asmInfo.szLocale = 0; + asmInfo.szLocale = 0; - if ((*pName)->GetCultureInfo() != NULL) - { - struct _gc { - OBJECTREF cultureinfo; - STRINGREF pString; - } gc; - - gc.cultureinfo = (*pName)->GetCultureInfo(); - gc.pString = NULL; - - GCPROTECT_BEGIN(gc); - - MethodDescCallSite getName(METHOD__CULTURE_INFO__GET_NAME, &gc.cultureinfo); - - ARG_SLOT args[] = { - ObjToArgSlot(gc.cultureinfo) - }; - gc.pString = getName.Call_RetSTRINGREF(args); - if (gc.pString != NULL) { - WCHAR* pString; - int iString; - gc.pString->RefInterpretGetStringValuesDangerousForGC(&pString, &iString); - DWORD lgth = WszWideCharToMultiByte(CP_UTF8, 0, pString, iString, NULL, 0, NULL, NULL); - S_UINT32 lengthWillNull = S_UINT32(lgth) + S_UINT32(1); - LPSTR lpLocale = (LPSTR) alloc->Alloc(lengthWillNull); - if (lengthWillNull.IsOverflow()) - { - COMPlusThrowHR(COR_E_OVERFLOW); - } - WszWideCharToMultiByte(CP_UTF8, 0, pString, iString, - lpLocale, lengthWillNull.Value(), NULL, NULL); - lpLocale[lgth] = '\0'; - asmInfo.szLocale = lpLocale; - } - GCPROTECT_END(); - } + if ((*pName)->GetCultureInfo() != NULL) + { + struct _gc { + OBJECTREF cultureinfo; + STRINGREF pString; + } gc; - // Strong name - DWORD cbPublicKeyOrToken=0; - BYTE* pbPublicKeyOrToken=NULL; - // Note that we prefer to take a public key token if present, - // even if flags indicate a full public key - if ((*pName)->GetPublicKeyToken() != NULL) { - dwFlags &= ~afPublicKey; - PBYTE pArray = NULL; - pArray = (*pName)->GetPublicKeyToken()->GetDirectPointerToNonObjectElements(); - cbPublicKeyOrToken = (*pName)->GetPublicKeyToken()->GetNumComponents(); - pbPublicKeyOrToken = pArray; - } - else if ((*pName)->GetPublicKey() != NULL) { - dwFlags |= afPublicKey; - PBYTE pArray = NULL; - pArray = (*pName)->GetPublicKey()->GetDirectPointerToNonObjectElements(); - cbPublicKeyOrToken = (*pName)->GetPublicKey()->GetNumComponents(); - pbPublicKeyOrToken = pArray; + gc.cultureinfo = (*pName)->GetCultureInfo(); + gc.pString = NULL; + + GCPROTECT_BEGIN(gc); + + MethodDescCallSite getName(METHOD__CULTURE_INFO__GET_NAME, &gc.cultureinfo); + + ARG_SLOT args[] = { + ObjToArgSlot(gc.cultureinfo) + }; + gc.pString = getName.Call_RetSTRINGREF(args); + if (gc.pString != NULL) { + WCHAR* pString; + int iString; + gc.pString->RefInterpretGetStringValuesDangerousForGC(&pString, &iString); + DWORD lgth = WszWideCharToMultiByte(CP_UTF8, 0, pString, iString, NULL, 0, NULL, NULL); + S_UINT32 lengthWillNull = S_UINT32(lgth) + S_UINT32(1); + LPSTR lpLocale = (LPSTR) alloc->Alloc(lengthWillNull); + if (lengthWillNull.IsOverflow()) + { + COMPlusThrowHR(COR_E_OVERFLOW); + } + WszWideCharToMultiByte(CP_UTF8, 0, pString, iString, + lpLocale, lengthWillNull.Value(), NULL, NULL); + lpLocale[lgth] = '\0'; + asmInfo.szLocale = lpLocale; } - BaseAssemblySpec::Init(GetName(),&asmInfo,pbPublicKeyOrToken,cbPublicKeyOrToken,dwFlags); - } + GCPROTECT_END(); + } + + // Strong name + DWORD cbPublicKeyOrToken=0; + BYTE* pbPublicKeyOrToken=NULL; + // Note that we prefer to take a public key token if present, + // even if flags indicate a full public key + if ((*pName)->GetPublicKeyToken() != NULL) { + dwFlags &= ~afPublicKey; + PBYTE pArray = NULL; + pArray = (*pName)->GetPublicKeyToken()->GetDirectPointerToNonObjectElements(); + cbPublicKeyOrToken = (*pName)->GetPublicKeyToken()->GetNumComponents(); + pbPublicKeyOrToken = pArray; + } + else if ((*pName)->GetPublicKey() != NULL) { + dwFlags |= afPublicKey; + PBYTE pArray = NULL; + pArray = (*pName)->GetPublicKey()->GetDirectPointerToNonObjectElements(); + cbPublicKeyOrToken = (*pName)->GetPublicKey()->GetNumComponents(); + pbPublicKeyOrToken = pArray; + } + BaseAssemblySpec::Init(GetName(),&asmInfo,pbPublicKeyOrToken,cbPublicKeyOrToken,dwFlags); CloneFieldsToStackingAllocator(alloc); - - return S_OK; } void AssemblySpec::AssemblyNameInit(ASSEMBLYNAMEREF* pAsmName, PEImage* pImageInfo) diff --git a/src/coreclr/vm/assemblyspec.hpp b/src/coreclr/vm/assemblyspec.hpp index d6ce12300170ed..9f49c1d78cf751 100644 --- a/src/coreclr/vm/assemblyspec.hpp +++ b/src/coreclr/vm/assemblyspec.hpp @@ -103,9 +103,7 @@ class AssemblySpec : public BaseAssemblySpec void InitializeSpec(PEAssembly* pPEAssembly); - HRESULT InitializeSpec(StackingAllocator* alloc, - ASSEMBLYNAMEREF* pName, - BOOL fParse); + void InitializeSpec(StackingAllocator* alloc, ASSEMBLYNAMEREF* pName); void AssemblyNameInit(ASSEMBLYNAMEREF* pName, PEImage* pImageInfo); //[in,out], [in] diff --git a/src/coreclr/vm/ecalllist.h b/src/coreclr/vm/ecalllist.h index f3ada145b68395..8a11c4fb930ab8 100644 --- a/src/coreclr/vm/ecalllist.h +++ b/src/coreclr/vm/ecalllist.h @@ -292,8 +292,6 @@ FCFuncStart(gAssemblyLoadContextFuncs) FCFuncEnd() FCFuncStart(gAssemblyNameFuncs) - FCFuncElement("nInit", AssemblyNameNative::Init) - FCFuncElement("ComputePublicKeyToken", AssemblyNameNative::GetPublicKeyToken) FCFuncElement("nGetFileInformation", AssemblyNameNative::GetFileInformation) FCFuncEnd() diff --git a/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx b/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx index e9d5e447ee90fc..8564b3894fa410 100644 --- a/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx +++ b/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx @@ -1104,8 +1104,8 @@ Target array type is not compatible with the type of items in the collection. - - Assembly names may not begin with whitespace or contain the characters '/', or '\\' or ':'. + + The given assembly name or codebase was invalid. Not a valid calendar for the given culture. @@ -3877,9 +3877,6 @@ A type initializer threw an exception. To determine which type, inspect the InnerException's StackTrace property. - - The given assembly name or codebase was invalid - Invalid assembly public key. diff --git a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems index d5ce32af96642c..8cf5cf0dda601b 100644 --- a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems +++ b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems @@ -562,6 +562,8 @@ + + @@ -2369,4 +2371,4 @@ - \ No newline at end of file + diff --git a/src/libraries/System.Private.CoreLib/src/System/Reflection/AssemblyName.cs b/src/libraries/System.Private.CoreLib/src/System/Reflection/AssemblyName.cs index 198c6804b7e4f2..a1822fbe83a1ac 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Reflection/AssemblyName.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Reflection/AssemblyName.cs @@ -25,6 +25,32 @@ public sealed partial class AssemblyName : ICloneable, IDeserializationCallback, private AssemblyVersionCompatibility _versionCompatibility; private AssemblyNameFlags _flags; + public AssemblyName(string assemblyName) + : this() + { + if (assemblyName == null) + throw new ArgumentNullException(nameof(assemblyName)); + if ((assemblyName.Length == 0) || + (assemblyName[0] == '\0')) + throw new ArgumentException(SR.Format_StringZeroLength); + + AssemblyNameParser.AssemblyNameParts parts = AssemblyNameParser.Parse(assemblyName); + _name = parts._name; + _version = parts._version; + _flags = parts._flags; + if ((parts._flags & AssemblyNameFlags.PublicKey) != 0) + { + _publicKey = parts._publicKeyOrToken; + } + else + { + _publicKeyToken = parts._publicKeyOrToken; + } + + if (parts._cultureName != null) + _cultureInfo = new CultureInfo(parts._cultureName); + } + public AssemblyName() { _versionCompatibility = AssemblyVersionCompatibility.SameMachine; @@ -166,7 +192,7 @@ public void SetPublicKey(byte[]? publicKey) // The compressed version of the public key formed from a truncated hash. // Will throw a SecurityException if _publicKey is invalid - public byte[]? GetPublicKeyToken() => _publicKeyToken ??= ComputePublicKeyToken(); + public byte[]? GetPublicKeyToken() => _publicKeyToken ??= AssemblyNameHelpers.ComputePublicKeyToken(_publicKey); public void SetPublicKeyToken(byte[]? publicKeyToken) { @@ -219,7 +245,7 @@ public string FullName return string.Empty; // Do not call GetPublicKeyToken() here - that latches the result into AssemblyName which isn't a side effect we want. - byte[]? pkt = _publicKeyToken ?? ComputePublicKeyToken(); + byte[]? pkt = _publicKeyToken ?? AssemblyNameHelpers.ComputePublicKeyToken(_publicKey); return AssemblyNameFormatter.ComputeDisplayName(Name, Version, CultureName, pkt, Flags, ContentType); } } diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/AssemblyNameHelpers.StrongName.cs b/src/libraries/System.Private.CoreLib/src/System/Reflection/AssemblyNameHelpers.StrongName.cs similarity index 98% rename from src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/AssemblyNameHelpers.StrongName.cs rename to src/libraries/System.Private.CoreLib/src/System/Reflection/AssemblyNameHelpers.StrongName.cs index 85e437548102e3..ef05ef39f8a7e9 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/AssemblyNameHelpers.StrongName.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Reflection/AssemblyNameHelpers.StrongName.cs @@ -2,12 +2,11 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Buffers.Binary; -using System.Runtime; using System.Security; namespace System.Reflection { - public static partial class AssemblyNameHelpers + internal static partial class AssemblyNameHelpers { public static byte[]? ComputePublicKeyToken(byte[]? publicKey) { diff --git a/src/libraries/System.Private.CoreLib/src/System/Reflection/AssemblyNameParser.cs b/src/libraries/System.Private.CoreLib/src/System/Reflection/AssemblyNameParser.cs new file mode 100644 index 00000000000000..ab3be2c8f06d20 --- /dev/null +++ b/src/libraries/System.Private.CoreLib/src/System/Reflection/AssemblyNameParser.cs @@ -0,0 +1,427 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Text; + +namespace System.Reflection +{ + // + // Parses an assembly name. + // + internal ref struct AssemblyNameParser + { + public struct AssemblyNameParts + { + public AssemblyNameParts(string name, Version? version, string? cultureName, AssemblyNameFlags flags, byte[]? publicKeyOrToken) + { + _name = name; + _version = version; + _cultureName = cultureName; + _flags = flags; + _publicKeyOrToken = publicKeyOrToken; + } + + public string _name; + public Version? _version; + public string? _cultureName; + public AssemblyNameFlags _flags; + public byte[]? _publicKeyOrToken; + } + + // Token categories for the lexer. + private enum Token + { + Equals = 1, + Comma = 2, + String = 3, + End = 4, + } + + private enum AttributeKind + { + Version = 1, + Culture = 2, + PublicKeyOrToken = 4, + ProcessorArchitecture = 8, + Retargetable = 16, + ContentType = 32 + } + + private static readonly char[] s_illegalCharactersInSimpleName = { '/', '\\', ':' }; + private string _input; + private int _index; + + private AssemblyNameParser(string input) + { + Debug.Assert(input != null); + if (input.Length == 0) + throw new ArgumentException(SR.Format_StringZeroLength); + + _input = input; + _index = 0; + } + + public static AssemblyNameParts Parse(string s) + { + return new AssemblyNameParser(s).Parse(); + } + + private void RecordNewSeenOrThrow(ref AttributeKind seenAttributes, AttributeKind newAttribute) + { + if ((seenAttributes & newAttribute) != 0) + { + ThrowHelper.ThrowFileLoadException_InvalidAssemblyName(_input); + } + else + { + seenAttributes |= newAttribute; + } + } + + private AssemblyNameParts Parse() + { + // Name must come first. + string name; + Token token = GetNextToken(out name); + if (token != Token.String) + ThrowHelper.ThrowFileLoadException_InvalidAssemblyName(_input); + + if (name == string.Empty || name.IndexOfAny(s_illegalCharactersInSimpleName) != -1) + ThrowHelper.ThrowFileLoadException_InvalidAssemblyName(_input); + + Version? version = null; + string? cultureName = null; + byte[]? pkt = null; + AssemblyNameFlags flags = 0; + + AttributeKind alreadySeen = default; + token = GetNextToken(); + while (token != Token.End) + { + if (token != Token.Comma) + ThrowHelper.ThrowFileLoadException_InvalidAssemblyName(_input); + string attributeName; + + token = GetNextToken(out attributeName); + if (token != Token.String) + ThrowHelper.ThrowFileLoadException_InvalidAssemblyName(_input); + token = GetNextToken(); + + if (token != Token.Equals) + ThrowHelper.ThrowFileLoadException_InvalidAssemblyName(_input); + string attributeValue; + token = GetNextToken(out attributeValue); + if (token != Token.String) + ThrowHelper.ThrowFileLoadException_InvalidAssemblyName(_input); + + if (attributeName == string.Empty) + ThrowHelper.ThrowFileLoadException_InvalidAssemblyName(_input); + + if (attributeName.Equals("Version", StringComparison.OrdinalIgnoreCase)) + { + RecordNewSeenOrThrow(ref alreadySeen, AttributeKind.Version); + version = ParseVersion(attributeValue); + } + + if (attributeName.Equals("Culture", StringComparison.OrdinalIgnoreCase)) + { + RecordNewSeenOrThrow(ref alreadySeen, AttributeKind.Culture); + cultureName = ParseCulture(attributeValue); + } + + if (attributeName.Equals("PublicKey", StringComparison.OrdinalIgnoreCase)) + { + RecordNewSeenOrThrow(ref alreadySeen, AttributeKind.PublicKeyOrToken); + pkt = ParsePKT(attributeValue, isToken: false); + flags |= AssemblyNameFlags.PublicKey; + } + + if (attributeName.Equals("PublicKeyToken", StringComparison.OrdinalIgnoreCase)) + { + RecordNewSeenOrThrow(ref alreadySeen, AttributeKind.PublicKeyOrToken); + pkt = ParsePKT(attributeValue, isToken: true); + } + + if (attributeName.Equals("ProcessorArchitecture", StringComparison.OrdinalIgnoreCase)) + { + RecordNewSeenOrThrow(ref alreadySeen, AttributeKind.ProcessorArchitecture); + flags |= (AssemblyNameFlags)(((int)ParseProcessorArchitecture(attributeValue)) << 4); + } + + if (attributeName.Equals("Retargetable", StringComparison.OrdinalIgnoreCase)) + { + RecordNewSeenOrThrow(ref alreadySeen, AttributeKind.Retargetable); + if (attributeValue.Equals("Yes", StringComparison.OrdinalIgnoreCase)) + flags |= AssemblyNameFlags.Retargetable; + else if (attributeValue.Equals("No", StringComparison.OrdinalIgnoreCase)) + { + // nothing to do + } + else + ThrowHelper.ThrowFileLoadException_InvalidAssemblyName(_input); + } + + if (attributeName.Equals("ContentType", StringComparison.OrdinalIgnoreCase)) + { + RecordNewSeenOrThrow(ref alreadySeen, AttributeKind.ContentType); + if (attributeValue.Equals("WindowsRuntime", StringComparison.OrdinalIgnoreCase)) + flags |= (AssemblyNameFlags)(((int)AssemblyContentType.WindowsRuntime) << 9); + else + ThrowHelper.ThrowFileLoadException_InvalidAssemblyName(_input); + } + + // Desktop compat: If we got here, the attribute name is unknown to us. Ignore it. + token = GetNextToken(); + } + + return new AssemblyNameParts(name, version, cultureName, flags, pkt); + } + + private Version ParseVersion(string attributeValue) + { + string[] parts = attributeValue.Split('.'); + if (parts.Length > 4) + ThrowHelper.ThrowFileLoadException_InvalidAssemblyName(_input); + ushort[] versionNumbers = new ushort[4]; + for (int i = 0; i < versionNumbers.Length; i++) + { + if (i >= parts.Length) + versionNumbers[i] = ushort.MaxValue; + else + { + // Desktop compat: TryParse is a little more forgiving than Fusion. + for (int j = 0; j < parts[i].Length; j++) + { + if (!char.IsDigit(parts[i][j])) + ThrowHelper.ThrowFileLoadException_InvalidAssemblyName(_input); + } + if (!(ushort.TryParse(parts[i], out versionNumbers[i]))) + { + ThrowHelper.ThrowFileLoadException_InvalidAssemblyName(_input); + } + } + } + + if (versionNumbers[0] == ushort.MaxValue || versionNumbers[1] == ushort.MaxValue) + ThrowHelper.ThrowFileLoadException_InvalidAssemblyName(_input); + if (versionNumbers[2] == ushort.MaxValue) + return new Version(versionNumbers[0], versionNumbers[1]); + if (versionNumbers[3] == ushort.MaxValue) + return new Version(versionNumbers[0], versionNumbers[1], versionNumbers[2]); + return new Version(versionNumbers[0], versionNumbers[1], versionNumbers[2], versionNumbers[3]); + } + + private string ParseCulture(string attributeValue) + { + if (attributeValue.Equals("Neutral", StringComparison.OrdinalIgnoreCase)) + { + return ""; + } + + return attributeValue; + } + + private byte[] ParsePKT(string attributeValue, bool isToken) + { + if (attributeValue.Equals("null", StringComparison.OrdinalIgnoreCase) || attributeValue == string.Empty) + return Array.Empty(); + + if (isToken && attributeValue.Length != 8 * 2) + ThrowHelper.ThrowFileLoadException_InvalidAssemblyName(_input); + + byte[] pkt = new byte[attributeValue.Length / 2]; + int srcIndex = 0; + for (int i = 0; i < pkt.Length; i++) + { + char hi = attributeValue[srcIndex++]; + char lo = attributeValue[srcIndex++]; + pkt[i] = (byte)((ParseHexNybble(hi) << 4) | ParseHexNybble(lo)); + } + return pkt; + } + + private ProcessorArchitecture ParseProcessorArchitecture(string attributeValue) + { + if (attributeValue.Equals("msil", StringComparison.OrdinalIgnoreCase)) + return ProcessorArchitecture.MSIL; + if (attributeValue.Equals("x86", StringComparison.OrdinalIgnoreCase)) + return ProcessorArchitecture.X86; + if (attributeValue.Equals("ia64", StringComparison.OrdinalIgnoreCase)) + return ProcessorArchitecture.IA64; + if (attributeValue.Equals("amd64", StringComparison.OrdinalIgnoreCase)) + return ProcessorArchitecture.Amd64; + if (attributeValue.Equals("arm", StringComparison.OrdinalIgnoreCase)) + return ProcessorArchitecture.Arm; + ThrowHelper.ThrowFileLoadException_InvalidAssemblyName(_input); + return default; // unreachable + } + + private byte ParseHexNybble(char c) + { + if (c >= '0' && c <= '9') + return (byte)(c - '0'); + if (c >= 'a' && c <= 'f') + return (byte)(c - 'a' + 10); + if (c >= 'A' && c <= 'F') + return (byte)(c - 'A' + 10); + ThrowHelper.ThrowFileLoadException_InvalidAssemblyName(_input); + return default; // unreachable + } + + // + // Return the next token in assembly name. If you expect the result to be Token.String, + // use GetNext(out String) instead. + // + private Token GetNextToken() + { + return GetNextToken(out _); + } + + private static bool IsWhiteSpace(char ch) + { + switch (ch) + { + case '\n': + case '\r': + case ' ': + case '\t': + return true; + default: + return false; + } + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private char GetNextChar() + { + char ch; + if (_index < _input.Length) + { + ch = _input[_index++]; + if (ch == '\0') + { + ThrowHelper.ThrowFileLoadException_InvalidAssemblyName(_input); + } + } + else + { + ch = '\0'; + } + + return ch; + } + + // + // Return the next token in assembly name. If the result is Token.String, + // sets "tokenString" to the tokenized string. + // + private Token GetNextToken(out string tokenString) + { + tokenString = string.Empty; + char c; + + while (true) + { + c = GetNextChar(); + switch (c) + { + case ',': + return Token.Comma; + case '=': + return Token.Equals; + case '\0': + return Token.End; + } + + if (!IsWhiteSpace(c)) + { + break; + } + } + + ValueStringBuilder sb = new ValueStringBuilder(stackalloc char[64]); + + char quoteChar = '\0'; + if (c == '\'' || c == '\"') + { + quoteChar = c; + c = GetNextChar(); + } + + for (; ; ) + { + if (c == 0) + { + if (quoteChar != 0) + { + // EOS and unclosed quotes is an error + ThrowHelper.ThrowFileLoadException_InvalidAssemblyName(_input); + } + else + { + // Reached end of input and therefore of string + break; + } + } + + if (quoteChar != 0 && c == quoteChar) + break; // Terminate: Found closing quote of quoted string. + + if (quoteChar == 0 && (c == ',' || c == '=')) + { + _index--; + break; // Terminate: Found start of a new ',' or '=' token. + } + + if (quoteChar == 0 && (c == '\'' || c == '\"')) + ThrowHelper.ThrowFileLoadException_InvalidAssemblyName(_input); + + if (c == '\\') + { + c = GetNextChar(); + + switch (c) + { + case '\\': + case ',': + case '=': + case '\'': + case '"': + sb.Append(c); + break; + case 't': + sb.Append('\t'); + break; + case 'r': + sb.Append('\r'); + break; + case 'n': + sb.Append('\n'); + break; + default: + ThrowHelper.ThrowFileLoadException_InvalidAssemblyName(_input); + return default; //unreachable + } + } + else + { + sb.Append(c); + } + + c = GetNextChar(); + } + + + if (quoteChar == 0) + { + while (sb.Length > 0 && IsWhiteSpace(sb[sb.Length - 1])) + sb.Length--; + } + + tokenString = sb.ToString(); + return Token.String; + } + } +} diff --git a/src/libraries/System.Private.CoreLib/src/System/ThrowHelper.cs b/src/libraries/System.Private.CoreLib/src/System/ThrowHelper.cs index 01e4a44dfc19d0..781cd38aaadb30 100644 --- a/src/libraries/System.Private.CoreLib/src/System/ThrowHelper.cs +++ b/src/libraries/System.Private.CoreLib/src/System/ThrowHelper.cs @@ -494,6 +494,12 @@ internal static void ThrowFormatException_BadFormatSpecifier() throw new FormatException(SR.Argument_BadFormatSpecifier); } + [DoesNotReturn] + internal static void ThrowFileLoadException_InvalidAssemblyName(string name) + { + throw new FileLoadException(SR.InvalidAssemblyName, name); + } + [DoesNotReturn] internal static void ThrowArgumentOutOfRangeException_PrecisionTooLarge() { diff --git a/src/libraries/System.Reflection/tests/AssemblyNameTests.cs b/src/libraries/System.Reflection/tests/AssemblyNameTests.cs index 7e9b8c5849b22d..34a7023e2e6078 100644 --- a/src/libraries/System.Reflection/tests/AssemblyNameTests.cs +++ b/src/libraries/System.Reflection/tests/AssemblyNameTests.cs @@ -124,7 +124,6 @@ public void Ctor_String_Invalid_Legacy(string assemblyName, Type exceptionType) [InlineData("na=me", typeof(FileLoadException))] [InlineData("na\'me", typeof(FileLoadException))] [InlineData("na\"me", typeof(FileLoadException))] - [ActiveIssue ("https://github.com/dotnet/runtime/issues/45032", TestRuntimes.Mono)] public void Ctor_String_Invalid_Issue(string assemblyName, Type exceptionType) { Assert.Throws(exceptionType, () => new AssemblyName(assemblyName)); diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/AssemblyName.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/AssemblyName.Mono.cs index 12b2a5936c3ded..67ff341eec5df9 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/AssemblyName.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/AssemblyName.Mono.cs @@ -12,50 +12,6 @@ namespace System.Reflection { public partial class AssemblyName { - public AssemblyName(string assemblyName) - { - if (assemblyName == null) - throw new ArgumentNullException(nameof(assemblyName)); - if (assemblyName.Length == 0 || assemblyName[0] == '\0') - throw new ArgumentException(SR.Format_StringZeroLength); - - if (assemblyName.Contains('\0')) - throw new FileLoadException("The assembly name is invalid."); - - using (SafeStringMarshal name = RuntimeMarshal.MarshalString(assemblyName)) - { - // TODO: Should use CoreRT AssemblyNameParser - if (!ParseAssemblyName(name.Value, out MonoAssemblyName nativeName, out bool isVersionDefined, out bool isTokenDefined)) - throw new FileLoadException("The assembly name is invalid."); - - try - { - unsafe - { - FillName(&nativeName, null, isVersionDefined, false, isTokenDefined); - } - } - finally - { - RuntimeMarshal.FreeAssemblyName(ref nativeName, false); - } - } - } - - private unsafe byte[]? ComputePublicKeyToken() - { - if (_publicKey == null) - return null; - if (_publicKey.Length == 0) - return Array.Empty(); - - var token = new byte[8]; - fixed (byte* pkt = token) - fixed (byte* pk = _publicKey) - get_public_token(pkt, pk, _publicKey.Length); - return token; - } - internal static AssemblyName Create(IntPtr monoAssembly, string? codeBase) { AssemblyName aname = new AssemblyName(); @@ -141,13 +97,7 @@ private static AssemblyName GetFileInformationCore(string assemblyFile) } } - [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern unsafe void get_public_token(byte* token, byte* pubkey, int len); - [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern unsafe MonoAssemblyName* GetNativeName(IntPtr assemblyPtr); - - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern bool ParseAssemblyName(IntPtr name, out MonoAssemblyName aname, out bool is_version_definited, out bool is_token_defined); } } diff --git a/src/mono/mono/metadata/icall-decl.h b/src/mono/mono/metadata/icall-decl.h index 5b75710e6456ad..1a960fdaa86555 100644 --- a/src/mono/mono/metadata/icall-decl.h +++ b/src/mono/mono/metadata/icall-decl.h @@ -60,7 +60,6 @@ typedef enum { // This is sorted. // grep ICALL_EXPORT | sort | uniq ICALL_EXPORT MonoAssemblyName* ves_icall_System_Reflection_AssemblyName_GetNativeName (MonoAssembly*); -ICALL_EXPORT MonoBoolean ves_icall_System_Reflection_AssemblyName_ParseAssemblyName (const char*, MonoAssemblyName*, MonoBoolean*, MonoBoolean* is_token_defined_arg); ICALL_EXPORT MonoBoolean ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_SufficientExecutionStack (void); ICALL_EXPORT MonoBoolean ves_icall_System_Threading_Thread_YieldInternal (void); ICALL_EXPORT MonoThread *ves_icall_System_Threading_Thread_GetCurrentThread (void); diff --git a/src/mono/mono/metadata/icall-def-netcore.h b/src/mono/mono/metadata/icall-def-netcore.h index 45c65207a08497..ae7984fada9b04 100644 --- a/src/mono/mono/metadata/icall-def-netcore.h +++ b/src/mono/mono/metadata/icall-def-netcore.h @@ -176,8 +176,6 @@ HANDLES(ASSEM_7, "InternalLoad", ves_icall_System_Reflection_Assembly_InternalLo ICALL_TYPE(ASSEMN, "System.Reflection.AssemblyName", ASSEMN_0) NOHANDLES(ICALL(ASSEMN_0, "GetNativeName", ves_icall_System_Reflection_AssemblyName_GetNativeName)) -NOHANDLES(ICALL(ASSEMN_3, "ParseAssemblyName", ves_icall_System_Reflection_AssemblyName_ParseAssemblyName)) -NOHANDLES(ICALL(ASSEMN_2, "get_public_token", mono_digest_get_public_token)) ICALL_TYPE(MCATTR, "System.Reflection.CustomAttribute", MCATTR_1) HANDLES(MCATTR_1, "GetCustomAttributesDataInternal", ves_icall_MonoCustomAttrs_GetCustomAttributesDataInternal, MonoArray, 1, (MonoObject)) diff --git a/src/mono/mono/metadata/icall.c b/src/mono/mono/metadata/icall.c index 39806dd249178b..92e0526e1c2b4c 100644 --- a/src/mono/mono/metadata/icall.c +++ b/src/mono/mono/metadata/icall.c @@ -5379,21 +5379,6 @@ gint32 ves_icall_AssemblyExtensions_ApplyUpdateEnabled (gint32 just_component_ch return mono_metadata_update_available () && (just_component_check || mono_metadata_update_enabled (NULL)); } -MonoBoolean -ves_icall_System_Reflection_AssemblyName_ParseAssemblyName (const char *name, MonoAssemblyName *aname, MonoBoolean *is_version_defined_arg, MonoBoolean *is_token_defined_arg) -{ - gboolean is_version_defined = FALSE; - gboolean is_token_defined = FALSE; - gboolean result = FALSE; - - result = mono_assembly_name_parse_full (name, aname, TRUE, &is_version_defined, &is_token_defined); - - *is_version_defined_arg = (MonoBoolean)is_version_defined; - *is_token_defined_arg = (MonoBoolean)is_token_defined; - - return result; -} - MonoReflectionTypeHandle ves_icall_System_Reflection_RuntimeModule_GetGlobalType (MonoImage *image, MonoError *error) { From ca1340bb034fca163375a6da88f22b1843d633ef Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Tue, 25 Jan 2022 18:01:02 -0500 Subject: [PATCH 070/161] Disable RegexReductionTests tests on browser --- .../System.Text.RegularExpressions/tests/RegexReductionTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Text.RegularExpressions/tests/RegexReductionTests.cs b/src/libraries/System.Text.RegularExpressions/tests/RegexReductionTests.cs index 65ef818124a425..f4fcbf92dadf1c 100644 --- a/src/libraries/System.Text.RegularExpressions/tests/RegexReductionTests.cs +++ b/src/libraries/System.Text.RegularExpressions/tests/RegexReductionTests.cs @@ -6,6 +6,7 @@ namespace System.Text.RegularExpressions.Tests { + [ActiveIssue("https://github.com/dotnet/runtime/issues/64300", TestPlatforms.Browser)] public class RegexReductionTests { // These tests depend on using reflection to access internals of Regex in order to validate From bdc0d1a409a24d4092e7b108c13fc4ff1c643d1f Mon Sep 17 00:00:00 2001 From: Roman Marusyk Date: Wed, 26 Jan 2022 01:08:51 +0200 Subject: [PATCH 071/161] Fix formatting of resource string where excess arguments are passed (#63824) * Fix formatting of resource string where excess arguments are passed. #63607 * Fix BuildCharExceptionArgs and ECCurve.Validate * Fix CA2208 * Fix CA2208. Remove paramName becaus it is in error message * Code review fixes * Code review fixes --- .../Microsoft/VisualBasic/FileIO/TextFieldParser.vb | 8 ++++---- .../src/Microsoft/Win32/Registry.cs | 2 +- .../AccessControl/RegistrySecurity.Windows.cs | 2 +- .../src/System/Drawing/RectangleConverter.cs | 2 +- .../BasicEventSourceTest/TestsManifestNegative.cs | 12 ++++++------ .../src/System/Drawing/RectangleConverter.cs | 1 - .../src/System/IO/IsolatedStorage/IsolatedStorage.cs | 2 +- .../System.IO.Packaging/src/Resources/Strings.resx | 4 ++-- .../System.Net.NameResolution/src/System/Net/Dns.cs | 6 +++--- .../src/System/Net/Sockets/SocketAsyncEventArgs.cs | 8 ++++---- .../src/System/Collections/Hashtable.cs | 2 +- .../src/System/Diagnostics/Tracing/EventSource.cs | 6 +++--- .../src/System/IO/UnmanagedMemoryAccessor.cs | 4 ++-- .../System.Private.CoreLib/src/System/Random.cs | 2 +- .../src/System/Text/DecoderReplacementFallback.cs | 2 +- .../src/System/Text/EncoderReplacementFallback.cs | 2 +- .../tests/Xslt/XslTransformApi/CXslTransform.cs | 2 +- .../System/Reflection/Metadata/Internal/BlobHeap.cs | 2 +- .../src/System/Numerics/BigNumber.cs | 2 +- .../src/Resources/Strings.resx | 2 +- .../Cryptography/CspKeyContainerInfo.Windows.cs | 4 ++-- .../Cryptography/X509Certificates/X509Chain.cs | 4 ++-- .../src/Resources/Strings.resx | 2 +- .../src/System/Security/Cryptography/ECCurve.cs | 4 ++-- .../Fallback/DecoderReplacementFallbackTests.cs | 12 ++++++------ .../Fallback/EncoderReplacementFallbackTests.cs | 12 ++++++------ 26 files changed, 55 insertions(+), 56 deletions(-) diff --git a/src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/FileIO/TextFieldParser.vb b/src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/FileIO/TextFieldParser.vb index 77219110807c4b..d97358dcd5a5b3 100644 --- a/src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/FileIO/TextFieldParser.vb +++ b/src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/FileIO/TextFieldParser.vb @@ -375,7 +375,7 @@ Namespace Microsoft.VisualBasic.FileIO Public Function PeekChars(ByVal numberOfChars As Integer) As String If numberOfChars <= 0 Then - Throw GetArgumentExceptionWithArgName("numberOfChars", SR.TextFieldParser_NumberOfCharsMustBePositive, "numberOfChars") + Throw GetArgumentExceptionWithArgName("numberOfChars", SR.TextFieldParser_NumberOfCharsMustBePositive) End If If m_Reader Is Nothing Or m_Buffer Is Nothing Then @@ -1151,7 +1151,7 @@ Namespace Microsoft.VisualBasic.FileIO Dim Bound As Integer = Widths.Length - 1 For i As Integer = 0 To Bound - 1 If Widths(i) < 1 Then - Throw GetArgumentExceptionWithArgName("FieldWidths", SR.TextFieldParser_FieldWidthsMustPositive, "FieldWidths") + Throw GetArgumentExceptionWithArgName("FieldWidths", SR.TextFieldParser_FieldWidthsMustPositive) End If Next End Sub @@ -1163,11 +1163,11 @@ Namespace Microsoft.VisualBasic.FileIO ''' Private Sub ValidateAndEscapeDelimiters() If m_Delimiters Is Nothing Then - Throw GetArgumentExceptionWithArgName("Delimiters", SR.TextFieldParser_DelimitersNothing, "Delimiters") + Throw GetArgumentExceptionWithArgName("Delimiters", SR.TextFieldParser_DelimitersNothing) End If If m_Delimiters.Length = 0 Then - Throw GetArgumentExceptionWithArgName("Delimiters", SR.TextFieldParser_DelimitersNothing, "Delimiters") + Throw GetArgumentExceptionWithArgName("Delimiters", SR.TextFieldParser_DelimitersNothing) End If Dim Length As Integer = m_Delimiters.Length diff --git a/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/Registry.cs b/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/Registry.cs index 56cbc26afe977c..49eeecff31ab0c 100644 --- a/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/Registry.cs +++ b/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/Registry.cs @@ -64,7 +64,7 @@ private static RegistryKey GetBaseKeyFromKeyName(string keyName, out string subK return baseKey; } - throw new ArgumentException(SR.Format(SR.Arg_RegInvalidKeyName, nameof(keyName)), nameof(keyName)); + throw new ArgumentException(SR.Arg_RegInvalidKeyName, nameof(keyName)); } public static object? GetValue(string keyName, string? valueName, object? defaultValue) diff --git a/src/libraries/Microsoft.Win32.Registry/src/System/Security/AccessControl/RegistrySecurity.Windows.cs b/src/libraries/Microsoft.Win32.Registry/src/System/Security/AccessControl/RegistrySecurity.Windows.cs index f5ff293848ffa7..f16e03965ed186 100644 --- a/src/libraries/Microsoft.Win32.Registry/src/System/Security/AccessControl/RegistrySecurity.Windows.cs +++ b/src/libraries/Microsoft.Win32.Registry/src/System/Security/AccessControl/RegistrySecurity.Windows.cs @@ -19,7 +19,7 @@ public sealed partial class RegistrySecurity : NativeObjectSecurity break; case Interop.Errors.ERROR_INVALID_NAME: - exception = new ArgumentException(SR.Format(SR.Arg_RegInvalidKeyName, nameof(name))); + exception = new ArgumentException(SR.Arg_RegInvalidKeyName, nameof(name)); break; case Interop.Errors.ERROR_INVALID_HANDLE: diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/System/Drawing/RectangleConverter.cs b/src/libraries/System.ComponentModel.TypeConverter/src/System/Drawing/RectangleConverter.cs index 9037db51752749..9c0393da53ab33 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/src/System/Drawing/RectangleConverter.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/src/System/Drawing/RectangleConverter.cs @@ -50,7 +50,7 @@ public override bool CanConvertTo(ITypeDescriptorContext? context, Type? destina if (values.Length != 4) { - throw new ArgumentException(SR.Format(SR.TextParseFailedFormat, "text", text, "x, y, width, height")); + throw new ArgumentException(SR.Format(SR.TextParseFailedFormat, text, "x, y, width, height")); } return new Rectangle(values[0], values[1], values[2], values[3]); diff --git a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsManifestNegative.cs b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsManifestNegative.cs index 2ee59adf59464f..012a03bcad1c16 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsManifestNegative.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsManifestNegative.cs @@ -82,13 +82,13 @@ public void Test_GenerateManifest_InvalidEventSources() Assert.NotNull(EventSource.GenerateManifest(typeof(Sdt.EventWithReturnEventSource), string.Empty, EventManifestOptions.AllowEventSourceOverride)); e = AssertExtensions.Throws(null, () => EventSource.GenerateManifest(typeof(Sdt.NegativeEventIdEventSource), string.Empty)); - AsserExceptionStringsEqual(() => GetResourceString("EventSource_NeedPositiveId", "WriteInteger"), e); + AsserExceptionStringsEqual(() => GetResourceString("EventSource_NeedPositiveId"), e); e = AssertExtensions.Throws(null, () => EventSource.GenerateManifest(typeof(Sdt.NegativeEventIdEventSource), string.Empty, strictOptions)); - AsserExceptionStringsEqual(() => GetResourceString("EventSource_NeedPositiveId", "WriteInteger"), e); + AsserExceptionStringsEqual(() => GetResourceString("EventSource_NeedPositiveId"), e); e = AssertExtensions.Throws(null, () => EventSource.GenerateManifest(typeof(Sdt.NegativeEventIdEventSource), string.Empty, EventManifestOptions.AllowEventSourceOverride)); - AsserExceptionStringsEqual(() => GetResourceString("EventSource_NeedPositiveId", "WriteInteger"), e); + AsserExceptionStringsEqual(() => GetResourceString("EventSource_NeedPositiveId"), e); e = AssertExtensions.Throws(null, () => EventSource.GenerateManifest(typeof(Sdt.OutOfRangeKwdEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => string.Join(Environment.NewLine, @@ -124,7 +124,7 @@ public void Test_GenerateManifest_InvalidEventSources() e = AssertExtensions.Throws(null, () => EventSource.GenerateManifest(typeof(Sdt.EnumKindMismatchEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => string.Join(Environment.NewLine, - GetResourceString("EventSource_EnumKindMismatch", "Op1", "EventKeywords", "Opcodes"), + GetResourceString("EventSource_EnumKindMismatch", "EventKeywords", "Opcodes"), GetResourceString("EventSource_UndefinedKeyword", "0x1", "WriteInteger")), e); @@ -144,14 +144,14 @@ public void Test_GenerateManifest_InvalidEventSources() e = AssertExtensions.Throws(null, () => EventSource.GenerateManifest(typeof(Sdt.EventIdReusedEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => string.Join(Environment.NewLine, - GetResourceString("EventSource_EventIdReused", "WriteInteger2", 1, "WriteInteger1"), + GetResourceString("EventSource_EventIdReused", "WriteInteger2", 1), GetResourceString("EventSource_TaskOpcodePairReused", "WriteInteger2", 1, "WriteInteger1", 1)), e); e = AssertExtensions.Throws(null, () => EventSource.GenerateManifest(typeof(Sdt.EventIdReusedEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => string.Join(Environment.NewLine, - GetResourceString("EventSource_EventIdReused", "WriteInteger2", 1, "WriteInteger1"), + GetResourceString("EventSource_EventIdReused", "WriteInteger2", 1), GetResourceString("EventSource_TaskOpcodePairReused", "WriteInteger2", 1, "WriteInteger1", 1)), e); diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/RectangleConverter.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/RectangleConverter.cs index 445d7c72c6dd49..098830cbf4a613 100644 --- a/src/libraries/System.Drawing.Common/src/System/Drawing/RectangleConverter.cs +++ b/src/libraries/System.Drawing.Common/src/System/Drawing/RectangleConverter.cs @@ -83,7 +83,6 @@ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo c } else { throw new ArgumentException(SR.Format(SR.TextParseFailedFormat, - "text", text, "x, y, width, height")); } diff --git a/src/libraries/System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/IsolatedStorage.cs b/src/libraries/System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/IsolatedStorage.cs index 6171cce6d9a344..78dab308838122 100644 --- a/src/libraries/System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/IsolatedStorage.cs +++ b/src/libraries/System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/IsolatedStorage.cs @@ -55,7 +55,7 @@ public virtual ulong CurrentSize { get { - throw new InvalidOperationException(SR.Format(SR.IsolatedStorage_CurrentSizeUndefined, nameof(CurrentSize))); + throw new InvalidOperationException(SR.IsolatedStorage_CurrentSizeUndefined); } } diff --git a/src/libraries/System.IO.Packaging/src/Resources/Strings.resx b/src/libraries/System.IO.Packaging/src/Resources/Strings.resx index 668094559fa96f..a2ffa3af1ed3d7 100644 --- a/src/libraries/System.IO.Packaging/src/Resources/Strings.resx +++ b/src/libraries/System.IO.Packaging/src/Resources/Strings.resx @@ -106,7 +106,7 @@ Invalid file format. - Invalid file format. + File '{0}' has an invalid file format. PackagePart subclass must implement GetContentTypeCore method if passing a null value for the content type when PackagePart object is constructed. @@ -375,4 +375,4 @@ File contains corrupted data. - \ No newline at end of file + diff --git a/src/libraries/System.Net.NameResolution/src/System/Net/Dns.cs b/src/libraries/System.Net.NameResolution/src/System/Net/Dns.cs index 5da904a7c6f9d4..a0127f539bc6c7 100644 --- a/src/libraries/System.Net.NameResolution/src/System/Net/Dns.cs +++ b/src/libraries/System.Net.NameResolution/src/System/Net/Dns.cs @@ -47,7 +47,7 @@ public static IPHostEntry GetHostEntry(IPAddress address) if (address.Equals(IPAddress.Any) || address.Equals(IPAddress.IPv6Any)) { if (NetEventSource.Log.IsEnabled()) NetEventSource.Error(address, $"Invalid address '{address}'"); - throw new ArgumentException(SR.Format(SR.net_invalid_ip_addr, nameof(address))); + throw new ArgumentException(SR.net_invalid_ip_addr, nameof(address)); } IPHostEntry ipHostEntry = GetHostEntryCore(address, AddressFamily.Unspecified); @@ -81,7 +81,7 @@ public static IPHostEntry GetHostEntry(string hostNameOrAddress, AddressFamily f if (address.Equals(IPAddress.Any) || address.Equals(IPAddress.IPv6Any)) { if (NetEventSource.Log.IsEnabled()) NetEventSource.Error(address, $"Invalid address '{address}'"); - throw new ArgumentException(SR.Format(SR.net_invalid_ip_addr, nameof(hostNameOrAddress))); + throw new ArgumentException(SR.net_invalid_ip_addr, nameof(hostNameOrAddress)); } ipHostEntry = GetHostEntryCore(address, family); @@ -207,7 +207,7 @@ public static IPAddress[] GetHostAddresses(string hostNameOrAddress, AddressFami if (address.Equals(IPAddress.Any) || address.Equals(IPAddress.IPv6Any)) { if (NetEventSource.Log.IsEnabled()) NetEventSource.Error(address, $"Invalid address '{address}'"); - throw new ArgumentException(SR.Format(SR.net_invalid_ip_addr, nameof(hostNameOrAddress))); + throw new ArgumentException(SR.net_invalid_ip_addr, nameof(hostNameOrAddress)); } addresses = (family == AddressFamily.Unspecified || address.AddressFamily == family) ? new IPAddress[] { address } : Array.Empty(); diff --git a/src/libraries/System.Net.Sockets/src/System/Net/Sockets/SocketAsyncEventArgs.cs b/src/libraries/System.Net.Sockets/src/System/Net/Sockets/SocketAsyncEventArgs.cs index 6c79043631eb72..faf0d9f204c7cf 100644 --- a/src/libraries/System.Net.Sockets/src/System/Net/Sockets/SocketAsyncEventArgs.cs +++ b/src/libraries/System.Net.Sockets/src/System/Net/Sockets/SocketAsyncEventArgs.cs @@ -153,7 +153,7 @@ public IList>? BufferList if (!_buffer.Equals(default)) { // Can't have both set - throw new ArgumentException(SR.Format(SR.net_ambiguousbuffers, nameof(Buffer))); + throw new ArgumentException(SR.net_ambiguousbuffers); } // Copy the user-provided list into our internal buffer list, @@ -358,7 +358,7 @@ public void SetBuffer(byte[]? buffer, int offset, int count) // Can't have both Buffer and BufferList. if (_bufferList != null) { - throw new ArgumentException(SR.Format(SR.net_ambiguousbuffers, nameof(BufferList))); + throw new ArgumentException(SR.net_ambiguousbuffers); } // Offset and count can't be negative and the @@ -391,7 +391,7 @@ public void SetBuffer(Memory buffer) { if (buffer.Length != 0 && _bufferList != null) { - throw new ArgumentException(SR.Format(SR.net_ambiguousbuffers, nameof(BufferList))); + throw new ArgumentException(SR.net_ambiguousbuffers); } _buffer = buffer; @@ -559,7 +559,7 @@ internal void StartOperationAccept() // Caller specified a buffer - see if it is large enough if (_count < _acceptAddressBufferCount) { - throw new ArgumentException(SR.Format(SR.net_buffercounttoosmall, nameof(Count))); + throw new ArgumentException(SR.net_buffercounttoosmall, nameof(Count)); } } else diff --git a/src/libraries/System.Private.CoreLib/src/System/Collections/Hashtable.cs b/src/libraries/System.Private.CoreLib/src/System/Collections/Hashtable.cs index 01b9cdb3c737ad..d311cd0c94bbde 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Collections/Hashtable.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Collections/Hashtable.cs @@ -260,7 +260,7 @@ public Hashtable(int capacity, float loadFactor) if (capacity < 0) throw new ArgumentOutOfRangeException(nameof(capacity), SR.ArgumentOutOfRange_NeedNonNegNum); if (!(loadFactor >= 0.1f && loadFactor <= 1.0f)) - throw new ArgumentOutOfRangeException(nameof(loadFactor), SR.Format(SR.ArgumentOutOfRange_HashtableLoadFactor, .1, 1.0)); + throw new ArgumentOutOfRangeException(nameof(loadFactor), SR.ArgumentOutOfRange_HashtableLoadFactor); // Based on perf work, .72 is the optimal load factor for this table. _loadFactor = 0.72f * loadFactor; diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs index f8d6e9c6ff114d..b54a5a50ba62ed 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs @@ -3280,7 +3280,7 @@ private static bool AttributeTypeNamesMatch(Type attributeType, Type reflectedAt } else if (eventAttribute.EventId <= 0) { - manifest.ManifestError(SR.Format(SR.EventSource_NeedPositiveId, method.Name), true); + manifest.ManifestError(SR.EventSource_NeedPositiveId, true); continue; // don't validate anything else for this event } if (method.Name.LastIndexOf('.') >= 0) @@ -3501,7 +3501,7 @@ private static void AddProviderEnumKind(ManifestBuilder manifest, FieldInfo stat #endif return; Error: - manifest.ManifestError(SR.Format(SR.EventSource_EnumKindMismatch, staticField.Name, staticField.FieldType.Name, providerEnumKind)); + manifest.ManifestError(SR.Format(SR.EventSource_EnumKindMismatch, staticField.FieldType.Name, providerEnumKind)); } // Helper used by code:CreateManifestAndDescriptors to add a code:EventData descriptor for a method @@ -3630,7 +3630,7 @@ private static void DebugCheckEvent(ref Dictionary? eventsByName if (evtId < eventData.Length && eventData[evtId].Descriptor.EventId != 0) { - manifest.ManifestError(SR.Format(SR.EventSource_EventIdReused, evtName, evtId, eventData[evtId].Name), true); + manifest.ManifestError(SR.Format(SR.EventSource_EventIdReused, evtName, evtId), true); } // We give a task to things if they don't have one. diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/UnmanagedMemoryAccessor.cs b/src/libraries/System.Private.CoreLib/src/System/IO/UnmanagedMemoryAccessor.cs index 0e53df433e78cc..78d0dab488a565 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/UnmanagedMemoryAccessor.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/UnmanagedMemoryAccessor.cs @@ -319,7 +319,7 @@ public void Read(long position, out T structure) where T : struct } else { - throw new ArgumentException(SR.Format(SR.Argument_NotEnoughBytesToRead, typeof(T)), nameof(position)); + throw new ArgumentException(SR.Argument_NotEnoughBytesToRead, nameof(position)); } } @@ -561,7 +561,7 @@ public void Write(long position, ref T structure) where T : struct } else { - throw new ArgumentException(SR.Format(SR.Argument_NotEnoughBytesToWrite, typeof(T)), nameof(position)); + throw new ArgumentException(SR.Argument_NotEnoughBytesToWrite, nameof(position)); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Random.cs b/src/libraries/System.Private.CoreLib/src/System/Random.cs index 05766c724d2677..91070448823331 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Random.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Random.cs @@ -192,7 +192,7 @@ protected virtual double Sample() } private static void ThrowMaxValueMustBeNonNegative() => - throw new ArgumentOutOfRangeException("maxValue", SR.Format(SR.ArgumentOutOfRange_NeedNonNegNum, "maxValue")); + throw new ArgumentOutOfRangeException("maxValue", SR.ArgumentOutOfRange_NeedNonNegNum); private static void ThrowMinMaxValueSwapped() => throw new ArgumentOutOfRangeException("minValue", SR.Format(SR.Argument_MinMaxValue, "minValue", "maxValue")); diff --git a/src/libraries/System.Private.CoreLib/src/System/Text/DecoderReplacementFallback.cs b/src/libraries/System.Private.CoreLib/src/System/Text/DecoderReplacementFallback.cs index 8f769f1c45bca6..34270ba3c30ade 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Text/DecoderReplacementFallback.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Text/DecoderReplacementFallback.cs @@ -57,7 +57,7 @@ public DecoderReplacementFallback(string replacement) break; } if (bFoundHigh) - throw new ArgumentException(SR.Format(SR.Argument_InvalidCharSequenceNoIndex, nameof(replacement))); + throw new ArgumentException(SR.Argument_InvalidCharSequenceNoIndex, nameof(replacement)); _strDefault = replacement; } diff --git a/src/libraries/System.Private.CoreLib/src/System/Text/EncoderReplacementFallback.cs b/src/libraries/System.Private.CoreLib/src/System/Text/EncoderReplacementFallback.cs index 5c93f4cc2cdb71..709695ce36dd11 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Text/EncoderReplacementFallback.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Text/EncoderReplacementFallback.cs @@ -58,7 +58,7 @@ public EncoderReplacementFallback(string replacement) break; } if (bFoundHigh) - throw new ArgumentException(SR.Format(SR.Argument_InvalidCharSequenceNoIndex, nameof(replacement))); + throw new ArgumentException(SR.Argument_InvalidCharSequenceNoIndex, nameof(replacement)); _strDefault = replacement; } diff --git a/src/libraries/System.Private.Xml/tests/Xslt/XslTransformApi/CXslTransform.cs b/src/libraries/System.Private.Xml/tests/Xslt/XslTransformApi/CXslTransform.cs index 9f561b2554e00c..6c320a7295bcda 100644 --- a/src/libraries/System.Private.Xml/tests/Xslt/XslTransformApi/CXslTransform.cs +++ b/src/libraries/System.Private.Xml/tests/Xslt/XslTransformApi/CXslTransform.cs @@ -1234,7 +1234,7 @@ public void LoadGeneric12(InputType inputType, ReaderType readerType, TransformT } catch (System.InvalidOperationException e2) { - CheckExpectedError(e2, "system.xml", "Xslt_NoStylesheetLoaded", new string[] { "IDontExist.xsl" }); + CheckExpectedError(e2, "system.xml", "Xslt_NoStylesheetLoaded", new string[] { "" }); return; } } diff --git a/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/BlobHeap.cs b/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/BlobHeap.cs index 302a6167c55630..abd9cf514babf3 100644 --- a/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/BlobHeap.cs +++ b/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/BlobHeap.cs @@ -190,7 +190,7 @@ public string GetDocumentName(DocumentNameBlobHandle handle) int separator = blobReader.ReadByte(); if (separator > 0x7f) { - throw new BadImageFormatException(SR.Format(SR.InvalidDocumentName, separator)); + throw new BadImageFormatException(SR.InvalidDocumentName); } var pooledBuilder = PooledStringBuilder.GetInstance(); diff --git a/src/libraries/System.Runtime.Numerics/src/System/Numerics/BigNumber.cs b/src/libraries/System.Runtime.Numerics/src/System/Numerics/BigNumber.cs index 2d7395e2e83dda..79d11ebe76203e 100644 --- a/src/libraries/System.Runtime.Numerics/src/System/Numerics/BigNumber.cs +++ b/src/libraries/System.Runtime.Numerics/src/System/Numerics/BigNumber.cs @@ -310,7 +310,7 @@ internal static bool TryValidateParseStyleInteger(NumberStyles style, [NotNullWh // Check for undefined flags if ((style & InvalidNumberStyles) != 0) { - e = new ArgumentException(SR.Format(SR.Argument_InvalidNumberStyles, nameof(style))); + e = new ArgumentException(SR.Argument_InvalidNumberStyles, nameof(style)); return false; } if ((style & NumberStyles.AllowHexSpecifier) != 0) diff --git a/src/libraries/System.Security.Cryptography.Cng/src/Resources/Strings.resx b/src/libraries/System.Security.Cryptography.Cng/src/Resources/Strings.resx index 4c99946a673e87..4577d05e6187cb 100644 --- a/src/libraries/System.Security.Cryptography.Cng/src/Resources/Strings.resx +++ b/src/libraries/System.Security.Cryptography.Cng/src/Resources/Strings.resx @@ -178,7 +178,7 @@ The specified curve '{0}' or its parameters are not valid for this platform. - The specified Oid is not valid. The Oid.FriendlyName or Oid.Value property must be set. + The specified Oid ({0}) is not valid. The Oid.FriendlyName or Oid.Value property must be set. Specified initialization vector (IV) does not match the block size for this algorithm. diff --git a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/CspKeyContainerInfo.Windows.cs b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/CspKeyContainerInfo.Windows.cs index ce73894fb36e0c..cda387503b0f2f 100644 --- a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/CspKeyContainerInfo.Windows.cs +++ b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/CspKeyContainerInfo.Windows.cs @@ -210,7 +210,7 @@ public string UniqueKeyContainerName { if (throwOnNotFound) { - throw new CryptographicException(SR.Format(SR.Cryptography_CSP_NotFound, "Error")); + throw new CryptographicException(SR.Cryptography_CSP_NotFound); } return null; @@ -243,7 +243,7 @@ private object ReadDeviceParameterVerifyContext(int keyParam) { if (hr != CapiHelper.S_OK) { - throw new CryptographicException(SR.Format(SR.Cryptography_CSP_NotFound, "Error")); + throw new CryptographicException(SR.Cryptography_CSP_NotFound); } object retVal = CapiHelper.GetProviderParameter(safeProvHandle, parameters.KeyNumber, keyParam); diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Chain.cs b/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Chain.cs index dbefadab573347..7260b772f46ced 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Chain.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Chain.cs @@ -117,13 +117,13 @@ internal bool Build(X509Certificate2 certificate, bool throwOnException) if (_chainPolicy != null && _chainPolicy.CustomTrustStore != null) { if (_chainPolicy.TrustMode == X509ChainTrustMode.System && _chainPolicy.CustomTrustStore.Count > 0) - throw new CryptographicException(SR.Cryptography_CustomTrustCertsInSystemMode, nameof(_chainPolicy.TrustMode)); + throw new CryptographicException(SR.Cryptography_CustomTrustCertsInSystemMode); foreach (X509Certificate2 customCertificate in _chainPolicy.CustomTrustStore) { if (customCertificate == null || customCertificate.Handle == IntPtr.Zero) { - throw new CryptographicException(SR.Cryptography_InvalidTrustCertificate, nameof(_chainPolicy.CustomTrustStore)); + throw new CryptographicException(SR.Cryptography_InvalidTrustCertificate); } } } diff --git a/src/libraries/System.Security.Cryptography/src/Resources/Strings.resx b/src/libraries/System.Security.Cryptography/src/Resources/Strings.resx index 84a24a8fc9ef46..dc30b357b0b388 100644 --- a/src/libraries/System.Security.Cryptography/src/Resources/Strings.resx +++ b/src/libraries/System.Security.Cryptography/src/Resources/Strings.resx @@ -205,7 +205,7 @@ The specified key parameters are not valid. Q.X and Q.Y, or D, must be specified. Q.X, Q.Y must be the same length. If D is specified it must be the same length as Q.X and Q.Y if also specified for named curves or the same length as Order for explicit curves. - The specified Oid is not valid. The Oid.FriendlyName or Oid.Value property must be set. + The specified Oid ({0}) is not valid. The Oid.FriendlyName or Oid.Value property must be set. The specified DSA parameters are not valid; P, G and Y must be the same length (the key size). diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECCurve.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECCurve.cs index a14e816f799df6..5876e483bcb6de 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECCurve.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECCurve.cs @@ -79,7 +79,7 @@ private set throw new ArgumentNullException(nameof(Oid)); if (string.IsNullOrEmpty(value.Value) && string.IsNullOrEmpty(value.FriendlyName)) - throw new ArgumentException(SR.Cryptography_InvalidCurveOid); + throw new ArgumentException(SR.Format(SR.Cryptography_InvalidCurveOid, value.Value)); _oid = value; } @@ -197,7 +197,7 @@ public void Validate() if (Oid == null || (string.IsNullOrEmpty(Oid.FriendlyName) && string.IsNullOrEmpty(Oid.Value))) { - throw new CryptographicException(SR.Cryptography_InvalidCurveOid); + throw new CryptographicException(SR.Format(SR.Cryptography_InvalidCurveOid, Oid?.Value)); } } else if (IsExplicit) diff --git a/src/libraries/System.Text.Encoding/tests/Fallback/DecoderReplacementFallbackTests.cs b/src/libraries/System.Text.Encoding/tests/Fallback/DecoderReplacementFallbackTests.cs index 51d3f2d074e722..7bb51d8a22dd8c 100644 --- a/src/libraries/System.Text.Encoding/tests/Fallback/DecoderReplacementFallbackTests.cs +++ b/src/libraries/System.Text.Encoding/tests/Fallback/DecoderReplacementFallbackTests.cs @@ -36,12 +36,12 @@ public void Ctor_Invalid() AssertExtensions.Throws("replacement", () => new DecoderReplacementFallback(null)); // Invalid surrogate pair - AssertExtensions.Throws(null, () => new DecoderReplacementFallback("\uD800")); - AssertExtensions.Throws(null, () => new DecoderReplacementFallback("\uD800a")); - AssertExtensions.Throws(null, () => new DecoderReplacementFallback("\uDC00")); - AssertExtensions.Throws(null, () => new DecoderReplacementFallback("a\uDC00")); - AssertExtensions.Throws(null, () => new DecoderReplacementFallback("\uDC00\uDC00")); - AssertExtensions.Throws(null, () => new DecoderReplacementFallback("\uD800\uD800")); + AssertExtensions.Throws("replacement", () => new DecoderReplacementFallback("\uD800")); + AssertExtensions.Throws("replacement", () => new DecoderReplacementFallback("\uD800a")); + AssertExtensions.Throws("replacement", () => new DecoderReplacementFallback("\uDC00")); + AssertExtensions.Throws("replacement", () => new DecoderReplacementFallback("a\uDC00")); + AssertExtensions.Throws("replacement", () => new DecoderReplacementFallback("\uDC00\uDC00")); + AssertExtensions.Throws("replacement", () => new DecoderReplacementFallback("\uD800\uD800")); } public static IEnumerable Equals_TestData() diff --git a/src/libraries/System.Text.Encoding/tests/Fallback/EncoderReplacementFallbackTests.cs b/src/libraries/System.Text.Encoding/tests/Fallback/EncoderReplacementFallbackTests.cs index 45709bb693e22b..1fe7b2499ab161 100644 --- a/src/libraries/System.Text.Encoding/tests/Fallback/EncoderReplacementFallbackTests.cs +++ b/src/libraries/System.Text.Encoding/tests/Fallback/EncoderReplacementFallbackTests.cs @@ -36,12 +36,12 @@ public void Ctor_Invalid() AssertExtensions.Throws("replacement", () => new EncoderReplacementFallback(null)); // Invalid surrogate pair - AssertExtensions.Throws(null, () => new EncoderReplacementFallback("\uD800")); - AssertExtensions.Throws(null, () => new EncoderReplacementFallback("\uD800a")); - AssertExtensions.Throws(null, () => new EncoderReplacementFallback("\uDC00")); - AssertExtensions.Throws(null, () => new EncoderReplacementFallback("a\uDC00")); - AssertExtensions.Throws(null, () => new EncoderReplacementFallback("\uDC00\uDC00")); - AssertExtensions.Throws(null, () => new EncoderReplacementFallback("\uD800\uD800")); + AssertExtensions.Throws("replacement", () => new EncoderReplacementFallback("\uD800")); + AssertExtensions.Throws("replacement", () => new EncoderReplacementFallback("\uD800a")); + AssertExtensions.Throws("replacement", () => new EncoderReplacementFallback("\uDC00")); + AssertExtensions.Throws("replacement", () => new EncoderReplacementFallback("a\uDC00")); + AssertExtensions.Throws("replacement", () => new EncoderReplacementFallback("\uDC00\uDC00")); + AssertExtensions.Throws("replacement", () => new EncoderReplacementFallback("\uD800\uD800")); } public static IEnumerable Equals_TestData() From 0bf7e14c80da09fa92e3cdf65b46dbc4d14bd0b5 Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Tue, 25 Jan 2022 18:23:52 -0500 Subject: [PATCH 072/161] Add Regex.Count string overloads (#64289) --- .../ref/System.Text.RegularExpressions.cs | 4 + .../src/System.Text.RegularExpressions.csproj | 1 + .../Text/RegularExpressions/Regex.Count.cs | 64 ++++++++++ .../tests/Regex.Count.Tests.cs | 120 ++++++++++++++++++ ...ystem.Text.RegularExpressions.Tests.csproj | 1 + 5 files changed, 190 insertions(+) create mode 100644 src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.Count.cs create mode 100644 src/libraries/System.Text.RegularExpressions/tests/Regex.Count.Tests.cs diff --git a/src/libraries/System.Text.RegularExpressions/ref/System.Text.RegularExpressions.cs b/src/libraries/System.Text.RegularExpressions/ref/System.Text.RegularExpressions.cs index 75ed12a69731f5..251d595081072d 100644 --- a/src/libraries/System.Text.RegularExpressions/ref/System.Text.RegularExpressions.cs +++ b/src/libraries/System.Text.RegularExpressions/ref/System.Text.RegularExpressions.cs @@ -161,6 +161,10 @@ public static void CompileToAssembly(System.Text.RegularExpressions.RegexCompila public static void CompileToAssembly(System.Text.RegularExpressions.RegexCompilationInfo[] regexinfos, System.Reflection.AssemblyName assemblyname, System.Reflection.Emit.CustomAttributeBuilder[]? attributes) { } [System.ObsoleteAttribute("Regex.CompileToAssembly is obsolete and not supported. Use the RegexGeneratorAttribute with the regular expression source generator instead.", DiagnosticId = "SYSLIB0036", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] public static void CompileToAssembly(System.Text.RegularExpressions.RegexCompilationInfo[] regexinfos, System.Reflection.AssemblyName assemblyname, System.Reflection.Emit.CustomAttributeBuilder[]? attributes, string? resourceFile) { } + public int Count(string input) { throw null; } + public static int Count(string input, [System.Diagnostics.CodeAnalysis.StringSyntax(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.Regex)] string pattern) { throw null; } + public static int Count(string input, [System.Diagnostics.CodeAnalysis.StringSyntax(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.Regex, "options")] string pattern, System.Text.RegularExpressions.RegexOptions options) { throw null; } + public static int Count(string input, [System.Diagnostics.CodeAnalysis.StringSyntax(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.Regex, "options")] string pattern, System.Text.RegularExpressions.RegexOptions options, System.TimeSpan matchTimeout) { throw null; } public static string Escape(string str) { throw null; } public string[] GetGroupNames() { throw null; } public int[] GetGroupNumbers() { throw null; } diff --git a/src/libraries/System.Text.RegularExpressions/src/System.Text.RegularExpressions.csproj b/src/libraries/System.Text.RegularExpressions/src/System.Text.RegularExpressions.csproj index acda3098b795ce..cfe2c82d38d1a5 100644 --- a/src/libraries/System.Text.RegularExpressions/src/System.Text.RegularExpressions.csproj +++ b/src/libraries/System.Text.RegularExpressions/src/System.Text.RegularExpressions.csproj @@ -18,6 +18,7 @@ + diff --git a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.Count.cs b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.Count.cs new file mode 100644 index 00000000000000..18c08ee3242e2d --- /dev/null +++ b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.Count.cs @@ -0,0 +1,64 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Diagnostics.CodeAnalysis; + +namespace System.Text.RegularExpressions +{ + public partial class Regex + { + /// Searches an input string for all occurrences of a regular expression and returns the number of matches. + /// The string to search for a match. + /// The number of matches. + /// is null. + public int Count(string input) + { + if (input is null) + { + ThrowHelper.ThrowArgumentNullException(ExceptionArgument.input); + } + + int count = 0; + + Run(input, 0, ref count, static (ref int count, Match match) => + { + count++; + return true; + }, reuseMatchObject: true); + + return count; + } + + /// Searches an input string for all occurrences of a regular expression and returns the number of matches. + /// The string to search for a match. + /// The regular expression pattern to match. + /// The number of matches. + /// or is null. + /// A regular expression parsing error occurred. + public static int Count(string input, [StringSyntax(StringSyntaxAttribute.Regex)] string pattern) => + RegexCache.GetOrAdd(pattern).Count(input); + + /// Searches an input string for all occurrences of a regular expression and returns the number of matches. + /// The string to search for a match. + /// The regular expression pattern to match. + /// A bitwise combination of the enumeration values that specify options for matching. + /// The number of matches. + /// or is null. + /// is not a valid bitwise combination of RegexOptions values. + /// A regular expression parsing error occurred. + public static int Count(string input, [StringSyntax(StringSyntaxAttribute.Regex, "options")] string pattern, RegexOptions options) => + RegexCache.GetOrAdd(pattern, options, s_defaultMatchTimeout).Count(input); + + /// Searches an input string for all occurrences of a regular expression and returns the number of matches. + /// The string to search for a match. + /// The regular expression pattern to match. + /// A bitwise combination of the enumeration values that specify options for matching. + /// A time-out interval, or to indicate that the method should not time out. + /// The number of matches. + /// or is null. + /// is not a valid bitwise combination of RegexOptions values, or is negative, zero, or greater than approximately 24 days. + /// A regular expression parsing error occurred. + public static int Count(string input, [StringSyntax(StringSyntaxAttribute.Regex, "options")] string pattern, RegexOptions options, TimeSpan matchTimeout) => + RegexCache.GetOrAdd(pattern, options, matchTimeout).Count(input); + } +} diff --git a/src/libraries/System.Text.RegularExpressions/tests/Regex.Count.Tests.cs b/src/libraries/System.Text.RegularExpressions/tests/Regex.Count.Tests.cs new file mode 100644 index 00000000000000..272cbb143d69d4 --- /dev/null +++ b/src/libraries/System.Text.RegularExpressions/tests/Regex.Count.Tests.cs @@ -0,0 +1,120 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading.Tasks; +using Xunit; + +namespace System.Text.RegularExpressions.Tests +{ + public class RegexCountTests + { + [Theory] + [MemberData(nameof(Count_ReturnsExpectedCount_TestData))] + public async Task Count_ReturnsExpectedCount(RegexEngine engine, string pattern, string input, RegexOptions options, int expectedCount) + { + Regex r = await RegexHelpers.GetRegexAsync(engine, pattern, options); + Assert.Equal(expectedCount, r.Count(input)); + Assert.Equal(r.Count(input), r.Matches(input).Count); + + if (options == RegexOptions.None && engine == RegexEngine.Interpreter) + { + Assert.Equal(expectedCount, Regex.Count(input, pattern)); + } + + switch (engine) + { + case RegexEngine.Interpreter: + case RegexEngine.Compiled: + case RegexEngine.NonBacktracking: + RegexOptions engineOptions = RegexHelpers.OptionsFromEngine(engine); + Assert.Equal(expectedCount, Regex.Count(input, pattern, options | engineOptions)); + Assert.Equal(expectedCount, Regex.Count(input, pattern, options | engineOptions, Regex.InfiniteMatchTimeout)); + break; + } + } + + public static IEnumerable Count_ReturnsExpectedCount_TestData() + { + foreach (RegexEngine engine in RegexHelpers.AvailableEngines) + { + yield return new object[] { engine, @"", "", RegexOptions.None, 1 }; + yield return new object[] { engine, @"", "a", RegexOptions.None, 2 }; + yield return new object[] { engine, @"", "ab", RegexOptions.None, 3 }; + + yield return new object[] { engine, @"\w", "", RegexOptions.None, 0 }; + yield return new object[] { engine, @"\w", "a", RegexOptions.None, 1 }; + yield return new object[] { engine, @"\w", "ab", RegexOptions.None, 2 }; + + yield return new object[] { engine, @"\b\w+\b", "abc def ghi jkl", RegexOptions.None, 4 }; + + yield return new object[] { engine, @"A", "", RegexOptions.IgnoreCase, 0 }; + yield return new object[] { engine, @"A", "a", RegexOptions.IgnoreCase, 1 }; + yield return new object[] { engine, @"A", "aAaA", RegexOptions.IgnoreCase, 4 }; + + yield return new object[] { engine, @".", "\n\n\n", RegexOptions.None, 0 }; + yield return new object[] { engine, @".", "\n\n\n", RegexOptions.Singleline, 3 }; + } + } + + [Fact] + public void Count_InvalidArguments_Throws() + { + // input is null + AssertExtensions.Throws("input", () => new Regex("pattern").Count(null)); + AssertExtensions.Throws("input", () => Regex.Count(null, @"pattern")); + AssertExtensions.Throws("input", () => Regex.Count(null, @"pattern", RegexOptions.None)); + AssertExtensions.Throws("input", () => Regex.Count(null, @"pattern", RegexOptions.None, TimeSpan.FromMilliseconds(1))); + + // pattern is null + AssertExtensions.Throws("pattern", () => Regex.Count("input", null)); + AssertExtensions.Throws("pattern", () => Regex.Count("input", null, RegexOptions.None)); + AssertExtensions.Throws("pattern", () => Regex.Count("input", null, RegexOptions.None, TimeSpan.FromMilliseconds(1))); + + // pattern is invalid +#pragma warning disable RE0001 // invalid regex pattern + AssertExtensions.Throws(() => Regex.Count("input", @"[abc")); + AssertExtensions.Throws(() => Regex.Count("input", @"[abc", RegexOptions.None)); + AssertExtensions.Throws(() => Regex.Count("input", @"[abc", RegexOptions.None, TimeSpan.FromMilliseconds(1))); +#pragma warning restore RE0001 + + // options is invalid + AssertExtensions.Throws("options", () => Regex.Count("input", @"[abc]", (RegexOptions)(-1))); + AssertExtensions.Throws("options", () => Regex.Count("input", @"[abc]", (RegexOptions)(-1), TimeSpan.FromMilliseconds(1))); + + // matchTimeout is invalid + AssertExtensions.Throws("matchTimeout", () => Regex.Count("input", @"[abc]", RegexOptions.None, TimeSpan.FromMilliseconds(-2))); + } + + [Theory] + [MemberData(nameof(RegexHelpers.AvailableEngines_MemberData), MemberType = typeof(RegexHelpers))] + public async Task Count_Timeout_ThrowsAfterTooLongExecution(RegexEngine engine) + { + if (RegexHelpers.IsNonBacktracking(engine)) + { + // Test relies on backtracking taking a long time + return; + } + + const string Pattern = @"^(\w+\s?)*$"; + const string Input = "An input string that takes a very very very very very very very very very very very long time!"; + + Regex r = await RegexHelpers.GetRegexAsync(engine, Pattern, RegexOptions.None, TimeSpan.FromMilliseconds(1)); + + Stopwatch sw = Stopwatch.StartNew(); + Assert.Throws(() => r.Count(Input)); + Assert.InRange(sw.Elapsed.TotalSeconds, 0, 10); // arbitrary upper bound that should be well above what's needed with a 1ms timeout + + switch (engine) + { + case RegexEngine.Interpreter: + case RegexEngine.Compiled: + sw = Stopwatch.StartNew(); + Assert.Throws(() => Regex.Count(Input, Pattern, RegexHelpers.OptionsFromEngine(engine), TimeSpan.FromMilliseconds(1))); + Assert.InRange(sw.Elapsed.TotalSeconds, 0, 10); // arbitrary upper bound that should be well above what's needed with a 1ms timeout + break; + } + } + } +} diff --git a/src/libraries/System.Text.RegularExpressions/tests/System.Text.RegularExpressions.Tests.csproj b/src/libraries/System.Text.RegularExpressions/tests/System.Text.RegularExpressions.Tests.csproj index 9641f9665a175c..d95fa07ad73f16 100644 --- a/src/libraries/System.Text.RegularExpressions/tests/System.Text.RegularExpressions.Tests.csproj +++ b/src/libraries/System.Text.RegularExpressions/tests/System.Text.RegularExpressions.Tests.csproj @@ -41,6 +41,7 @@ + From b5714997652ed38b28a14365b144d12efb420839 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Tue, 25 Jan 2022 17:31:27 -0800 Subject: [PATCH 073/161] Clarify purpose of PDB Document hashing (#64306) Fixes #63505 --- docs/design/specs/PortablePdb-Metadata.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/design/specs/PortablePdb-Metadata.md b/docs/design/specs/PortablePdb-Metadata.md index 811af00510bea7..c1d8e3c4420660 100644 --- a/docs/design/specs/PortablePdb-Metadata.md +++ b/docs/design/specs/PortablePdb-Metadata.md @@ -64,6 +64,8 @@ There shall be no duplicate rows in the _Document_ table, based upon document na _Name_ shall not be nil. It can however encode an empty name string. +_Hash_ is the file content hashed using the specified _HashAlgorithm_. It is used to validate that a source file matches the one used by the compiler when compiling the source code. + The values for which field _Language_ has a defined meaning are listed in the following tables along with the corresponding interpretation: | _Language_ field value | language | From 518548b96b3369ceb3c54dd62e6cf55e2c5a4ce3 Mon Sep 17 00:00:00 2001 From: Robert Henry Date: Tue, 25 Jan 2022 17:38:52 -0800 Subject: [PATCH 074/161] Fix arm64/PInvoke so that NESTED_ENTRY/NESTED_END labels match. (#64296) This was exposed by building on arm64 with gcc-12, wherein the assembler complained about not being able to evaluate the constant expression for .size for the symbol on NESTED_END. Since the symbol on NESTED_END is not referenced anywhere else in the code base, I concluded that it was wrong, and NESTED_ENTRY was right. I have not tested this on anything but arm64 + gcc-12 --- src/coreclr/nativeaot/Runtime/arm64/PInvoke.S | 2 +- src/coreclr/nativeaot/Runtime/arm64/PInvoke.asm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coreclr/nativeaot/Runtime/arm64/PInvoke.S b/src/coreclr/nativeaot/Runtime/arm64/PInvoke.S index f66851461f278f..4d3fbbbce2216e 100644 --- a/src/coreclr/nativeaot/Runtime/arm64/PInvoke.S +++ b/src/coreclr/nativeaot/Runtime/arm64/PInvoke.S @@ -188,7 +188,7 @@ NoAbort: EPILOG_RESTORE_REG_PAIR_INDEXED fp, lr, 0xA0 EPILOG_RETURN - NESTED_END RhpReversePInvokeTrapThread + NESTED_END RhpReversePInvokeAttachOrTrapThread, _TEXT // // RhpPInvoke diff --git a/src/coreclr/nativeaot/Runtime/arm64/PInvoke.asm b/src/coreclr/nativeaot/Runtime/arm64/PInvoke.asm index 7692bfa8341beb..4bc165aef04505 100644 --- a/src/coreclr/nativeaot/Runtime/arm64/PInvoke.asm +++ b/src/coreclr/nativeaot/Runtime/arm64/PInvoke.asm @@ -180,7 +180,7 @@ NoAbort EPILOG_RESTORE_REG_PAIR fp, lr, #0xA0! EPILOG_RETURN - NESTED_END RhpReversePInvokeTrapThread + NESTED_END RhpReversePInvokeAttachOrTrapThread ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; From cfd725fcd1d446950efd8a7751a78b83f3b3e2c1 Mon Sep 17 00:00:00 2001 From: Andrew Au Date: Tue, 25 Jan 2022 19:02:08 -0800 Subject: [PATCH 075/161] When decommitting, leaving one instead of two pages in regions case. (#64243) --- src/coreclr/gc/gc.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/coreclr/gc/gc.cpp b/src/coreclr/gc/gc.cpp index bc4c11771f2b13..4842346ad26af4 100644 --- a/src/coreclr/gc/gc.cpp +++ b/src/coreclr/gc/gc.cpp @@ -11601,10 +11601,11 @@ void gc_heap::decommit_heap_segment (heap_segment* seg) dprintf (3, ("Decommitting heap segment %Ix(%Ix)", (size_t)seg, heap_segment_mem (seg))); -#ifdef BACKGROUND_GC +#if defined(BACKGROUND_GC) && !defined(USE_REGIONS) page_start += OS_PAGE_SIZE; -#endif //BACKGROUND_GC +#endif //BACKGROUND_GC && !USE_REGIONS + assert (heap_segment_committed (seg) >= page_start); size_t size = heap_segment_committed (seg) - page_start; bool decommit_succeeded_p = virtual_decommit (page_start, size, heap_segment_oh (seg), heap_number); From 9d3ff2659b820f5fa7bf8223f99f54d0ffb34cbc Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Tue, 25 Jan 2022 22:32:11 -0500 Subject: [PATCH 076/161] Ensure that canceled Task.Delays invoke continuations asynchronously from Cancel (#64217) --- .../src/System/Threading/Tasks/Task.cs | 14 ++++++++++++++ .../tests/Task/TaskRtTests.cs | 18 ++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs index 6e319542ce4880..f5a4becbd73b40 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs @@ -5627,6 +5627,20 @@ internal DelayPromiseWithCancellation(uint millisecondsDelay, CancellationToken _registration = token.UnsafeRegister(static (state, cancellationToken) => { var thisRef = (DelayPromiseWithCancellation)state!; + + // Normally RunContinuationsAsynchronously is set at construction time. We don't want to + // set it at construction because we want the timer firing (already on a thread pool thread with + // a stack in which it's fine to execute arbitrary code) to synchronously invoke any continuations + // from this task. However, a cancellation request will come synchronously from a call to + // CancellationTokenSource.Cancel, and we don't want to invoke arbitrary continuations from + // this delay task as part of that Cancel call. As such, we set RunContinuationsAsynchronously + // after the fact, only when the task is being completed due to cancellation. There is a race + // condition here, such that if the timer also fired concurrently, it might win, in which case + // it might also observe this RunContinuationsAsynchronously, but that's benign. An alternative + // is to make the whole cancellation registration queue, but that's visible in that the Task's + // IsCompleted wouldn't be set synchronously as part of IsCompleted. + thisRef.AtomicStateUpdate((int)TaskCreationOptions.RunContinuationsAsynchronously, 0); + if (thisRef.TrySetCanceled(cancellationToken)) { thisRef.Cleanup(); diff --git a/src/libraries/System.Threading.Tasks/tests/Task/TaskRtTests.cs b/src/libraries/System.Threading.Tasks/tests/Task/TaskRtTests.cs index e763ae63a43d4e..ffb2437aa4b3e1 100644 --- a/src/libraries/System.Threading.Tasks/tests/Task/TaskRtTests.cs +++ b/src/libraries/System.Threading.Tasks/tests/Task/TaskRtTests.cs @@ -691,6 +691,24 @@ public static void RunDelayTests_NegativeCases() } } + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] + public static void TaskDelay_Cancellation_ContinuationsInvokedAsynchronously() + { + var cts = new CancellationTokenSource(); + + var tl = new ThreadLocal(); + Task c = Task.Delay(-1, cts.Token).ContinueWith(_ => + { + Assert.Equal(0, tl.Value); + }, CancellationToken.None, TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default); + + tl.Value = 42; + cts.Cancel(); + tl.Value = 0; + + c.GetAwaiter().GetResult(); + } + // Test that exceptions are properly wrapped when thrown in various scenarios. // Make sure that "indirect" logic does not add superfluous exception wrapping. [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] From 82ff4f89e5997ade30ac1a9de8f343c321dd10a9 Mon Sep 17 00:00:00 2001 From: Maryam Ariyan Date: Tue, 25 Jan 2022 19:32:45 -0800 Subject: [PATCH 077/161] Add gen folder moving gen projects from src folder (#64231) --- ...rosoft.Extensions.Logging.Abstractions.sln | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.Abstractions.sln b/src/libraries/Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.Abstractions.sln index bf9829d652330d..6f3c58066d303b 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.Abstractions.sln +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.Abstractions.sln @@ -1,9 +1,12 @@ Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32111.311 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestUtilities", "..\Common\tests\TestUtilities\TestUtilities.csproj", "{79CE8C7E-A4AF-413C-A54D-86F17073559C}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Generators", "gen\Microsoft.Extensions.Logging.Generators.Roslyn3.11.csproj", "{1491B9C9-955D-4DB0-B1D5-70137A78EAAE}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Generators.Roslyn3.11", "gen\Microsoft.Extensions.Logging.Generators.Roslyn3.11.csproj", "{1491B9C9-955D-4DB0-B1D5-70137A78EAAE}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Generators", "gen\Microsoft.Extensions.Logging.Generators.Roslyn4.0.csproj", "{A5439E79-96D6-4F02-8DD0-23DFF979851D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Generators.Roslyn4.0", "gen\Microsoft.Extensions.Logging.Generators.Roslyn4.0.csproj", "{A5439E79-96D6-4F02-8DD0-23DFF979851D}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Abstractions", "ref\Microsoft.Extensions.Logging.Abstractions.csproj", "{7F536552-0E2A-4642-B7CF-863727C2F9CD}" EndProject @@ -23,6 +26,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{548DF5F7-790 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{7631380A-FB73-4241-9987-0891A21E9769}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "gen", "gen", "{03F31CEE-D63E-4E7F-949F-139B33DC3385}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -71,14 +76,14 @@ Global EndGlobalSection GlobalSection(NestedProjects) = preSolution {79CE8C7E-A4AF-413C-A54D-86F17073559C} = {4DE63935-DCA9-4D63-9C1F-AAE79C89CA8B} + {1491B9C9-955D-4DB0-B1D5-70137A78EAAE} = {03F31CEE-D63E-4E7F-949F-139B33DC3385} + {A5439E79-96D6-4F02-8DD0-23DFF979851D} = {03F31CEE-D63E-4E7F-949F-139B33DC3385} + {7F536552-0E2A-4642-B7CF-863727C2F9CD} = {7631380A-FB73-4241-9987-0891A21E9769} + {75C579F7-F20B-41F1-8CAF-641DE7ADA4EE} = {548DF5F7-790C-4A1C-89EB-BD904CA1BA86} {C333EC5A-F386-4A01-AE20-12D499551304} = {4DE63935-DCA9-4D63-9C1F-AAE79C89CA8B} {1CB869A7-2EEC-4A53-9C33-DF9E0C75825B} = {4DE63935-DCA9-4D63-9C1F-AAE79C89CA8B} - {1491B9C9-955D-4DB0-B1D5-70137A78EAAE} = {548DF5F7-790C-4A1C-89EB-BD904CA1BA86} - {A5439E79-96D6-4F02-8DD0-23DFF979851D} = {548DF5F7-790C-4A1C-89EB-BD904CA1BA86} - {75C579F7-F20B-41F1-8CAF-641DE7ADA4EE} = {548DF5F7-790C-4A1C-89EB-BD904CA1BA86} - {F8CF3192-B902-4631-972A-C405FDECC48D} = {548DF5F7-790C-4A1C-89EB-BD904CA1BA86} - {7F536552-0E2A-4642-B7CF-863727C2F9CD} = {7631380A-FB73-4241-9987-0891A21E9769} {DAA1349E-960E-49EB-81F3-FF4F99D8A325} = {7631380A-FB73-4241-9987-0891A21E9769} + {F8CF3192-B902-4631-972A-C405FDECC48D} = {548DF5F7-790C-4A1C-89EB-BD904CA1BA86} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {450DA749-CBDC-4BDC-950F-8A491CF59D49} From 8770287f77c6b218c0d30536544531ba8597faf4 Mon Sep 17 00:00:00 2001 From: Robert Henry Date: Tue, 25 Jan 2022 20:16:44 -0800 Subject: [PATCH 078/161] Fix minor typos in GC documentation. (#64298) --- src/coreclr/gc/gcconfig.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/coreclr/gc/gcconfig.h b/src/coreclr/gc/gcconfig.h index 886ea17743880d..d727a4685c527e 100644 --- a/src/coreclr/gc/gcconfig.h +++ b/src/coreclr/gc/gcconfig.h @@ -87,8 +87,8 @@ class GCConfigStringHolder INT_CONFIG (SegmentSize, "GCSegmentSize", NULL, 0, "Specifies the managed heap segment size") \ INT_CONFIG (LatencyMode, "GCLatencyMode", NULL, -1, "Specifies the GC latency mode - batch, interactive or low latency (note that the same " \ "thing can be specified via API which is the supported way") \ - INT_CONFIG (LatencyLevel, "GCLatencyLevel", NULL, 1, "Specifies the GC latency level that you want to optimize for. Must be a number from 0" \ - "3. See documentation for more details on each level.") \ + INT_CONFIG (LatencyLevel, "GCLatencyLevel", NULL, 1, "Specifies the GC latency level that you want to optimize for. Must be a number from 0 " \ + "to 3. See documentation for more details on each level.") \ INT_CONFIG (LogFileSize, "GCLogFileSize", NULL, 0, "Specifies the GC log file size") \ INT_CONFIG (CompactRatio, "GCCompactRatio", NULL, 0, "Specifies the ratio compacting GCs vs sweeping") \ INT_CONFIG (GCHeapAffinitizeMask, "GCHeapAffinitizeMask", "System.GC.HeapAffinitizeMask", 0, "Specifies processor mask for Server GC threads") \ @@ -117,7 +117,7 @@ class GCConfigStringHolder INT_CONFIG (BGCFLkd, "BGCFLkd", NULL, 11, "Specifies kd for above goal tuning") \ INT_CONFIG (BGCFLff, "BGCFLff", NULL, 100, "Specifies ff ratio") \ INT_CONFIG (BGCFLSmoothFactor, "BGCFLSmoothFactor", NULL, 150, "Smoothing over these") \ - INT_CONFIG (BGCFLGradualD, "BGCFLGradualD", NULL, 0, "Enable gradual D instead of cutting of at the value") \ + INT_CONFIG (BGCFLGradualD, "BGCFLGradualD", NULL, 0, "Enable gradual D instead of cutting off at the value") \ INT_CONFIG (BGCMLkp, "BGCMLkp", NULL, 1000, "Specifies kp for ML tuning") \ INT_CONFIG (BGCMLki, "BGCMLki", NULL, 16, "Specifies ki for ML tuning") \ INT_CONFIG (BGCFLEnableKi, "BGCFLEnableKi", NULL, 1, "Enables ki for above goal tuning") \ From 43ceed5514ca93242ff41f9f1ee53fc108c5dc1b Mon Sep 17 00:00:00 2001 From: Egor Chesakov Date: Tue, 25 Jan 2022 20:49:13 -0800 Subject: [PATCH 079/161] Explicitly specify four subdirectories to use as part of the paths for -pmi_path arguments and expand the paths on a remote machine in src/coreclr/scripts/superpmi-collect.proj (#64308) --- src/coreclr/scripts/superpmi-collect.proj | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/coreclr/scripts/superpmi-collect.proj b/src/coreclr/scripts/superpmi-collect.proj index 4a6edd8b5923b8..8d59a8218ae884 100644 --- a/src/coreclr/scripts/superpmi-collect.proj +++ b/src/coreclr/scripts/superpmi-collect.proj @@ -44,7 +44,10 @@ --> - + + + + @@ -59,7 +62,7 @@ %HELIX_WORKITEM_UPLOAD_ROOT% $(BUILD_SOURCESDIRECTORY)\artifacts\helixresults - $(SuperPMIDirectory)\superpmi.py collect -log_level DEBUG --$(CollectionType) -pmi_location $(SuperPMIDirectory)\pmi.dll -pmi_path @(PmiPathDirectories->'%(FullPath)', ' ') + $(SuperPMIDirectory)\superpmi.py collect -log_level DEBUG --$(CollectionType) -pmi_location $(SuperPMIDirectory)\pmi.dll -pmi_path @(PmiPathDirectories->'$(SuperPMIDirectory)\%(Identity)', ' ') $HELIX_PYTHONPATH @@ -73,7 +76,7 @@ $HELIX_WORKITEM_UPLOAD_ROOT $(BUILD_SOURCESDIRECTORY)/artifacts/helixresults - $(SuperPMIDirectory)/superpmi.py collect -log_level DEBUG --$(CollectionType) -pmi_location $(SuperPMIDirectory)/pmi.dll -pmi_path @(PmiPathDirectories->'%(FullPath)', ' ') + $(SuperPMIDirectory)/superpmi.py collect -log_level DEBUG --$(CollectionType) -pmi_location $(SuperPMIDirectory)/pmi.dll -pmi_path @(PmiPathDirectories->'$(SuperPMIDirectory)/%(Identity)', ' ') From 4bc40395f9f5d154f7ed2cb5e79bb1aaaa2fc917 Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Wed, 26 Jan 2022 04:16:26 -0500 Subject: [PATCH 080/161] Disable RegexReductionTests on browser (#64312) --- .../tests/RegexReductionTests.cs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/libraries/System.Text.RegularExpressions/tests/RegexReductionTests.cs b/src/libraries/System.Text.RegularExpressions/tests/RegexReductionTests.cs index f4fcbf92dadf1c..02c6e3a8f24456 100644 --- a/src/libraries/System.Text.RegularExpressions/tests/RegexReductionTests.cs +++ b/src/libraries/System.Text.RegularExpressions/tests/RegexReductionTests.cs @@ -6,7 +6,8 @@ namespace System.Text.RegularExpressions.Tests { - [ActiveIssue("https://github.com/dotnet/runtime/issues/64300", TestPlatforms.Browser)] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Many of these optimizations don't exist in .NET Framework.")] + [SkipOnPlatform(TestPlatforms.Browser, "Internal members accessed via reflection may have been trimmed away")] public class RegexReductionTests { // These tests depend on using reflection to access internals of Regex in order to validate @@ -25,9 +26,9 @@ public class RegexReductionTests static RegexReductionTests() { - if (PlatformDetection.IsNetFramework) + if (PlatformDetection.IsNetFramework || PlatformDetection.IsBrowser) { - // These members may not exist, and the tests won't run. + // These members may not exist or may have been trimmed away, and the tests won't run. return; } @@ -95,7 +96,6 @@ private static int GetMinRequiredLength(Regex r) } [Theory] - [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Many of these optimizations don't exist in .NET Framework.")] // Two greedy one loops [InlineData("a*a*", "a*")] [InlineData("(a*a*)", "(a*)")] @@ -475,7 +475,6 @@ public void PatternsReduceIdentically(string pattern1, string pattern2) } [Theory] - [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Many of these optimizations don't exist in .NET Framework.")] // Not coalescing loops [InlineData("aa", "a{2}")] [InlineData("a[^a]", "a{2}")] @@ -557,7 +556,6 @@ public void PatternsReduceDifferently(string pattern1, string pattern2) } [Theory] - [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Not computed in netfx")] [InlineData(@"a", RegexOptions.None, 1, 1)] [InlineData(@"[^a]", RegexOptions.None, 1, 1)] [InlineData(@"[abcdefg]", RegexOptions.None, 1, 1)] @@ -637,7 +635,6 @@ public void MinMaxLengthIsCorrect(string pattern, RegexOptions options, int expe } [Fact] - [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Not computed in netfx")] public void MinMaxLengthIsCorrect_HugeDepth() { const int Depth = 10_000; From d34c0ff7c104b3c6e39eb17cc0d21b7ca2dc5c6d Mon Sep 17 00:00:00 2001 From: Bar Arnon Date: Wed, 26 Jan 2022 11:58:21 +0200 Subject: [PATCH 081/161] Add UnreachableException (#63922) --- .../src/System/RuntimeType.CoreCLR.cs | 2 +- .../BindingFlagSupport/ConstructorPolicies.cs | 2 +- .../Data/RestrictedTypeHandlingTests.cs | 3 +- .../Formats/Asn1/AsnWriter.GeneralizedTime.cs | 7 +--- .../src/System/Dynamic/Utils/ContractUtils.cs | 2 +- .../src/Resources/Strings.resx | 3 ++ .../System.Private.CoreLib.Shared.projitems | 1 + .../Diagnostics/UnreachableException.cs | 41 +++++++++++++++++++ .../src/Resources/Strings.resx | 3 -- .../Internal/Utilities/ExceptionUtilities.cs | 3 -- .../tests/SerializationGuardTests.cs | 2 +- .../System.Runtime/ref/System.Runtime.cs | 6 +++ .../Diagnostics/UnreachableExceptionTests.cs | 40 ++++++++++++++++++ src/mono/mono/tests/bug-gh-9507.cs | 3 +- .../Interop/COM/ComWrappers/API/Program.cs | 5 ++- .../ObjectiveCMarshalAPI/Program.cs | 3 +- 16 files changed, 105 insertions(+), 21 deletions(-) create mode 100644 src/libraries/System.Private.CoreLib/src/System/Diagnostics/UnreachableException.cs create mode 100644 src/libraries/System.Runtime/tests/System/Diagnostics/UnreachableExceptionTests.cs diff --git a/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs b/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs index a0d7026b544078..bf83df6c0f9751 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs @@ -1941,7 +1941,7 @@ private static PropertyInfo GetPropertyInfo(RuntimeType reflectedType, int tkPro } Debug.Fail("Unreachable code"); - throw new SystemException(); + throw new UnreachableException(); } internal static void ValidateGenericArguments(MemberInfo definition, RuntimeType[] genericArguments, Exception? e) diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/BindingFlagSupport/ConstructorPolicies.cs b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/BindingFlagSupport/ConstructorPolicies.cs index 6b7b539996aec7..368105aa0de8a9 100644 --- a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/BindingFlagSupport/ConstructorPolicies.cs +++ b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/BindingFlagSupport/ConstructorPolicies.cs @@ -54,7 +54,7 @@ public sealed override bool OkToIgnoreAmbiguity(ConstructorInfo m1, ConstructorI { // Constructors are only resolvable using an array of parameter types so this should never be called. Debug.Fail("This code path should be unreachable."); - throw new NotSupportedException(); + throw new UnreachableException(); } } } diff --git a/src/libraries/System.Data.Common/tests/System/Data/RestrictedTypeHandlingTests.cs b/src/libraries/System.Data.Common/tests/System/Data/RestrictedTypeHandlingTests.cs index 54644b678a5bc2..d42609fed6b5cf 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/RestrictedTypeHandlingTests.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/RestrictedTypeHandlingTests.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Data.SqlTypes; +using System.Diagnostics; using System.Drawing; using System.IO; using System.Numerics; @@ -433,7 +434,7 @@ public void ReadXml(XmlReader reader) string tempPath = Path.GetTempFileName(); File.WriteAllText(tempPath, "This better not be written..."); File.Delete(tempPath); - throw new XunitException("Unreachable code (SerializationGuard should have kicked in)"); + throw new UnreachableException("Unreachable code (SerializationGuard should have kicked in)"); } public void WriteXml(XmlWriter writer) diff --git a/src/libraries/System.Formats.Asn1/src/System/Formats/Asn1/AsnWriter.GeneralizedTime.cs b/src/libraries/System.Formats.Asn1/src/System/Formats/Asn1/AsnWriter.GeneralizedTime.cs index 6b20ca15a3101d..7d8df542caf682 100644 --- a/src/libraries/System.Formats.Asn1/src/System/Formats/Asn1/AsnWriter.GeneralizedTime.cs +++ b/src/libraries/System.Formats.Asn1/src/System/Formats/Asn1/AsnWriter.GeneralizedTime.cs @@ -62,12 +62,7 @@ private void WriteGeneralizedTimeCore( // where "f?" is anything from "f" to "fffffff" (tenth of a second down to 100ns/1-tick) // with no trailing zeros. DateTimeOffset normalized = value.ToUniversalTime(); - - if (normalized.Year > 9999) - { - // This is unreachable since DateTimeOffset guards against this internally. - throw new ArgumentOutOfRangeException(nameof(value)); - } + Debug.Assert(normalized.Year <= 9999, "DateTimeOffset guards against this internally"); // We're only loading in sub-second ticks. // Ticks are defined as 1e-7 seconds, so their printed form diff --git a/src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/ContractUtils.cs b/src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/ContractUtils.cs index 8125fc9ac1159a..e481185ffa57a9 100644 --- a/src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/ContractUtils.cs +++ b/src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/ContractUtils.cs @@ -20,7 +20,7 @@ public static Exception Unreachable get { Debug.Fail("Unreachable"); - return new InvalidOperationException("Code supposed to be unreachable"); + return new UnreachableException(); } } diff --git a/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx b/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx index 8564b3894fa410..383660c6f9a920 100644 --- a/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx +++ b/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx @@ -786,6 +786,9 @@ Unknown TypeCode value. + + The program executed an instruction that was thought to be unreachable. + Missing parameter does not have a default value. diff --git a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems index 8cf5cf0dda601b..b7079c0ea1ff52 100644 --- a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems +++ b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems @@ -285,6 +285,7 @@ + diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/UnreachableException.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/UnreachableException.cs new file mode 100644 index 00000000000000..be8ff08940eebe --- /dev/null +++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/UnreachableException.cs @@ -0,0 +1,41 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Diagnostics +{ + /// + /// Exception thrown when the program executes an instruction that was thought to be unreachable. + /// + public sealed class UnreachableException : Exception + { + /// + /// Initializes a new instance of the class with the default error message. + /// + public UnreachableException() + : base(SR.Arg_UnreachableException) + { + } + + /// + /// Initializes a new instance of the + /// class with a specified error message. + /// + /// The error message that explains the reason for the exception. + public UnreachableException(string? message) + : base(message) + { + } + + /// + /// Initializes a new instance of the + /// class with a specified error message and a reference to the inner exception that is the cause of + /// this exception. + /// + /// The error message that explains the reason for the exception. + /// The exception that is the cause of the current exception. + public UnreachableException(string? message, Exception? innerException) + : base(message, innerException) + { + } + } +} diff --git a/src/libraries/System.Reflection.Metadata/src/Resources/Strings.resx b/src/libraries/System.Reflection.Metadata/src/Resources/Strings.resx index f4a6f030897903..e85eb5e2a3aa95 100644 --- a/src/libraries/System.Reflection.Metadata/src/Resources/Strings.resx +++ b/src/libraries/System.Reflection.Metadata/src/Resources/Strings.resx @@ -405,7 +405,4 @@ Unexpected value '{0}' of unknown type. - - This program location is thought to be unreachable. - diff --git a/src/libraries/System.Reflection.Metadata/src/System/Reflection/Internal/Utilities/ExceptionUtilities.cs b/src/libraries/System.Reflection.Metadata/src/System/Reflection/Internal/Utilities/ExceptionUtilities.cs index 3d6b4605cf492e..c0ebc31d376e83 100644 --- a/src/libraries/System.Reflection.Metadata/src/System/Reflection/Internal/Utilities/ExceptionUtilities.cs +++ b/src/libraries/System.Reflection.Metadata/src/System/Reflection/Internal/Utilities/ExceptionUtilities.cs @@ -14,8 +14,5 @@ internal static Exception UnexpectedValue(object value) return new InvalidOperationException(SR.Format(SR.UnexpectedValueUnknownType, value)); } - - internal static Exception Unreachable => - new InvalidOperationException(SR.UnreachableLocation); } } diff --git a/src/libraries/System.Runtime.Serialization.Formatters/tests/SerializationGuardTests.cs b/src/libraries/System.Runtime.Serialization.Formatters/tests/SerializationGuardTests.cs index 31329577fb6374..7c294ff0a6c1cd 100644 --- a/src/libraries/System.Runtime.Serialization.Formatters/tests/SerializationGuardTests.cs +++ b/src/libraries/System.Runtime.Serialization.Formatters/tests/SerializationGuardTests.cs @@ -91,7 +91,7 @@ private FileWriter(SerializationInfo info, StreamingContext context) { string tempPath = Path.GetTempFileName(); File.WriteAllText(tempPath, "This better not be written..."); - throw new InvalidOperationException("Unreachable code (SerializationGuard should have kicked in)"); + throw new UnreachableException("Unreachable code (SerializationGuard should have kicked in)"); } public void GetObjectData(SerializationInfo info, StreamingContext context) diff --git a/src/libraries/System.Runtime/ref/System.Runtime.cs b/src/libraries/System.Runtime/ref/System.Runtime.cs index 82211a2cca7c8d..35930e8deffa9f 100644 --- a/src/libraries/System.Runtime/ref/System.Runtime.cs +++ b/src/libraries/System.Runtime/ref/System.Runtime.cs @@ -9037,6 +9037,12 @@ public void Start() { } public static System.Diagnostics.Stopwatch StartNew() { throw null; } public void Stop() { } } + public sealed partial class UnreachableException : System.Exception + { + public UnreachableException() { } + public UnreachableException(string? message) { } + public UnreachableException(string? message, System.Exception? innerException) { } + } } namespace System.Diagnostics.CodeAnalysis { diff --git a/src/libraries/System.Runtime/tests/System/Diagnostics/UnreachableExceptionTests.cs b/src/libraries/System.Runtime/tests/System/Diagnostics/UnreachableExceptionTests.cs new file mode 100644 index 00000000000000..24fdc343966553 --- /dev/null +++ b/src/libraries/System.Runtime/tests/System/Diagnostics/UnreachableExceptionTests.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Diagnostics; +using Xunit; + +namespace System.Tests +{ + public static class UnreachableExceptionTests + { + [Fact] + public static void DefaultConstructor() + { + UnreachableException unreachableException = new UnreachableException(); + + Assert.NotNull(unreachableException.Message); + } + + [Fact] + public static void MessageConstructor() + { + string message = "MessageConstructor"; + UnreachableException unreachableException = new UnreachableException(message); + + Assert.Equal(message, unreachableException.Message); + } + + [Fact] + public static void MessageInnerExceptionConstructor() + { + string message = "MessageConstructor"; + Exception innerException = new Exception(); + UnreachableException unreachableException = new UnreachableException(); + + Assert.Equal(message, unreachableException.Message); + Assert.Same(innerException, unreachableException.InnerException); + } + } +} diff --git a/src/mono/mono/tests/bug-gh-9507.cs b/src/mono/mono/tests/bug-gh-9507.cs index 9a6b60e85693fe..6291e1ca2e9af7 100644 --- a/src/mono/mono/tests/bug-gh-9507.cs +++ b/src/mono/mono/tests/bug-gh-9507.cs @@ -1,3 +1,4 @@ +using System.Diagnostics; using type_with_special_array_cast = System.UInt64; // MonoClass::cast_class = long using other_type = System.Double; @@ -9,7 +10,7 @@ public TestIsInst() { array = new T[16]; if (array is other_type[]) // should not crash or throw NullReferenceException - throw new System.Exception("Unreachable"); + throw new System.UnreachableException(); } } diff --git a/src/tests/Interop/COM/ComWrappers/API/Program.cs b/src/tests/Interop/COM/ComWrappers/API/Program.cs index 99a2094c80b912..b5f6b4d09cfdce 100644 --- a/src/tests/Interop/COM/ComWrappers/API/Program.cs +++ b/src/tests/Interop/COM/ComWrappers/API/Program.cs @@ -6,6 +6,7 @@ namespace ComWrappersTests using System; using System.Collections; using System.Collections.Generic; + using System.Diagnostics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -376,7 +377,7 @@ public enum FailureMode throw new Exception() { HResult = ExceptionErrorCode }; default: Assert.True(false, "Invalid failure mode"); - throw new Exception("UNREACHABLE"); + throw new UnreachableException(); } } @@ -390,7 +391,7 @@ protected override object CreateObject(IntPtr externalComObject, CreateObjectFla throw new Exception() { HResult = ExceptionErrorCode }; default: Assert.True(false, "Invalid failure mode"); - throw new Exception("UNREACHABLE"); + throw new UnreachableException(); } } diff --git a/src/tests/Interop/ObjectiveC/ObjectiveCMarshalAPI/Program.cs b/src/tests/Interop/ObjectiveC/ObjectiveCMarshalAPI/Program.cs index b9d06dd5421624..f899919ef9dab6 100644 --- a/src/tests/Interop/ObjectiveC/ObjectiveCMarshalAPI/Program.cs +++ b/src/tests/Interop/ObjectiveC/ObjectiveCMarshalAPI/Program.cs @@ -5,6 +5,7 @@ namespace ObjectiveCMarshalAPI { using System; using System.Collections.Generic; + using System.Diagnostics; using System.Reflection; using System.Runtime.InteropServices; using System.Runtime.InteropServices.ObjectiveC; @@ -269,7 +270,7 @@ public ExceptionException() {} } Assert.True(false, "Unknown exception type"); - throw new Exception("Unreachable"); + throw new UnreachableException(); } class Scenario From 2b1cf1e48c24c534d0e871e06c66e24fe0e8f568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Wed, 26 Jan 2022 12:38:53 +0100 Subject: [PATCH 082/161] [mono] Recognize new names for Xamarin.iOS etc assemblies (#64278) They are being renamed in https://github.com/xamarin/xamarin-macios/pull/13847 --- src/mono/mono/mini/intrinsics.c | 6 +++++- src/mono/mono/mini/mini-native-types.c | 8 ++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/mono/mono/mini/intrinsics.c b/src/mono/mono/mini/intrinsics.c index 7dc808d2def83d..87ec858a46993e 100644 --- a/src/mono/mono/mini/intrinsics.c +++ b/src/mono/mono/mini/intrinsics.c @@ -1924,7 +1924,11 @@ mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign } else if (((!strcmp (cmethod_klass_image->assembly->aname.name, "Xamarin.iOS") || !strcmp (cmethod_klass_image->assembly->aname.name, "Xamarin.TVOS") || !strcmp (cmethod_klass_image->assembly->aname.name, "Xamarin.MacCatalyst") || - !strcmp (cmethod_klass_image->assembly->aname.name, "Xamarin.Mac")) && + !strcmp (cmethod_klass_image->assembly->aname.name, "Xamarin.Mac") || + !strcmp (cmethod_klass_image->assembly->aname.name, "Microsoft.iOS") || + !strcmp (cmethod_klass_image->assembly->aname.name, "Microsoft.tvOS") || + !strcmp (cmethod_klass_image->assembly->aname.name, "Microsoft.MacCatalyst") || + !strcmp (cmethod_klass_image->assembly->aname.name, "Microsoft.macOS")) && !strcmp (cmethod_klass_name_space, "ObjCRuntime") && !strcmp (cmethod_klass_name, "Selector")) ) { diff --git a/src/mono/mono/mini/mini-native-types.c b/src/mono/mono/mini/mini-native-types.c index 9faebab38b2e99..a9a3a0f8e484bf 100644 --- a/src/mono/mono/mini/mini-native-types.c +++ b/src/mono/mono/mini/mini-native-types.c @@ -374,6 +374,14 @@ mono_class_is_magic_assembly (MonoClass *klass) return TRUE; if (!strcmp ("Xamarin.MacCatalyst", aname)) return TRUE; + if (!strcmp ("Microsoft.iOS", aname)) + return TRUE; + if (!strcmp ("Microsoft.macOS", aname)) + return TRUE; + if (!strcmp ("Microsoft.watchOS", aname)) + return TRUE; + if (!strcmp ("Microsoft.MacCatalyst", aname)) + return TRUE; /* regression test suite */ if (!strcmp ("builtin-types", aname)) return TRUE; From 994d390c7cdc1f91b2b37235cf68605ead5d7c44 Mon Sep 17 00:00:00 2001 From: Adeel Mujahid <3840695+am11@users.noreply.github.com> Date: Wed, 26 Jan 2022 14:56:21 +0200 Subject: [PATCH 083/161] Remove usage of codecvt from corerun (#64157) * Remove usage of codecvt from corerun * Update src/coreclr/hosts/corerun/corerun.cpp Co-authored-by: Aaron Robinson Co-authored-by: Aaron Robinson --- src/coreclr/hosts/corerun/corerun.cpp | 8 ++--- src/coreclr/hosts/corerun/corerun.hpp | 48 +++++++++++++++------------ src/coreclr/hosts/corerun/dotenv.cpp | 23 +++---------- 3 files changed, 35 insertions(+), 44 deletions(-) diff --git a/src/coreclr/hosts/corerun/corerun.cpp b/src/coreclr/hosts/corerun/corerun.cpp index 345a18ef6bc624..67a43e28b20d15 100644 --- a/src/coreclr/hosts/corerun/corerun.cpp +++ b/src/coreclr/hosts/corerun/corerun.cpp @@ -291,9 +291,9 @@ static int run(const configuration& config) } // Construct CoreCLR properties. - pal::string_utf8_t tpa_list_utf8 = pal::convert_to_utf8(std::move(tpa_list)); - pal::string_utf8_t app_path_utf8 = pal::convert_to_utf8(std::move(app_path)); - pal::string_utf8_t native_search_dirs_utf8 = pal::convert_to_utf8(native_search_dirs.str()); + pal::string_utf8_t tpa_list_utf8 = pal::convert_to_utf8(tpa_list.c_str()); + pal::string_utf8_t app_path_utf8 = pal::convert_to_utf8(app_path.c_str()); + pal::string_utf8_t native_search_dirs_utf8 = pal::convert_to_utf8(native_search_dirs.str().c_str()); std::vector user_defined_keys_utf8; std::vector user_defined_values_utf8; @@ -334,7 +334,7 @@ static int run(const configuration& config) int propertyCount = (int)propertyKeys.size(); // Construct arguments - pal::string_utf8_t exe_path_utf8 = pal::convert_to_utf8(std::move(exe_path)); + pal::string_utf8_t exe_path_utf8 = pal::convert_to_utf8(exe_path.c_str()); std::vector argv_lifetime; pal::malloc_ptr argv_utf8{ pal::convert_argv_to_utf8(config.entry_assembly_argc, config.entry_assembly_argv, argv_lifetime) }; pal::string_utf8_t entry_assembly_utf8 = pal::convert_to_utf8(config.entry_assembly_fullpath.c_str()); diff --git a/src/coreclr/hosts/corerun/corerun.hpp b/src/coreclr/hosts/corerun/corerun.hpp index 9781299c8049ef..14cb9ec6580e16 100644 --- a/src/coreclr/hosts/corerun/corerun.hpp +++ b/src/coreclr/hosts/corerun/corerun.hpp @@ -88,11 +88,28 @@ namespace pal assert(wrote < needed); return { buffer.get() }; } + inline string_utf8_t getenvA(const char* var) + { + DWORD needed = ::GetEnvironmentVariableA(var, nullptr, 0); + if (needed == 0) + return {}; + + malloc_ptr buffer{ (char*)::malloc(needed * sizeof(char)) }; + assert(buffer != nullptr); + DWORD wrote = ::GetEnvironmentVariableA(var, buffer.get(), needed); + assert(wrote < needed); + return { buffer.get() }; + } inline void setenv(const char_t* var, string_t value) { BOOL success = ::SetEnvironmentVariableW(var, value.c_str()); assert(success); } + inline void setenvA(const char* var, string_utf8_t value) + { + BOOL success = ::SetEnvironmentVariableA(var, value.c_str()); + assert(success); + } inline string_t get_exe_path() { char_t file_name[1024]; @@ -177,31 +194,17 @@ namespace pal inline string_utf8_t convert_to_utf8(const char_t* str) { - // Compute the needed buffer - int bytes_req = ::WideCharToMultiByte( - CP_UTF8, 0, // Conversion args - str, -1, // Input string - nullptr, 0, // Null to request side - nullptr, nullptr); + int bytes_req = ::WideCharToMultiByte(CP_UTF8, 0, str, -1, nullptr, 0, nullptr, nullptr); malloc_ptr buffer{ (char*)::malloc(bytes_req) }; assert(buffer != nullptr); - int written = ::WideCharToMultiByte( - CP_UTF8, 0, // Conversion args - str, -1, // Input string - buffer.get(), bytes_req, // Output buffer - nullptr, nullptr); + int written = ::WideCharToMultiByte(CP_UTF8, 0, str, -1, buffer.get(), bytes_req, nullptr, nullptr); assert(bytes_req == written); return { buffer.get() }; } - inline string_utf8_t convert_to_utf8(string_t&& str) - { - return convert_to_utf8(str.c_str()); - } - inline bool try_load_hostpolicy(pal::string_t mock_hostpolicy_value) { const char_t* hostpolicyName = W("hostpolicy.dll"); @@ -360,11 +363,19 @@ namespace pal return {}; return { val }; } + inline string_utf8_t getenvA(const char* var) + { + return getenv(var); + } inline void setenv(const char_t* var, string_t value) { int error = ::setenv(var, value.c_str(), /* overwrite */ 1); assert(error == 0); } + inline void setenvA(const char* var, string_utf8_t value) + { + setenv(var, value.c_str()); + } inline string_t get_exe_path() { return minipal_getexepath(); } @@ -567,11 +578,6 @@ namespace pal return { str }; } - inline string_utf8_t convert_to_utf8(string_t&& str) - { - return std::move(str); - } - inline bool try_load_hostpolicy(pal::string_t mock_hostpolicy_value) { if (!string_ends_with(mock_hostpolicy_value, pal::nativelib_ext)) diff --git a/src/coreclr/hosts/corerun/dotenv.cpp b/src/coreclr/hosts/corerun/dotenv.cpp index 0e0e37c7919b0a..8792d63151f56a 100644 --- a/src/coreclr/hosts/corerun/dotenv.cpp +++ b/src/coreclr/hosts/corerun/dotenv.cpp @@ -7,22 +7,8 @@ #include #include -#ifdef TARGET_WINDOWS -#include -#endif - namespace { - pal::string_t convert_to_string_t(std::string str) - { -#ifdef TARGET_WINDOWS - std::wstring_convert> converter; - return converter.from_bytes(str); -#else - return str; -#endif - } - bool read_var_name(std::istream& file, std::string& var_name_out) { std::string var_name; @@ -326,8 +312,7 @@ dotenv::dotenv(pal::string_t dotEnvFilePath, std::istream& contents) { return dot_env_entry->second; } - pal::string_t env_var_name = convert_to_string_t(name); - return pal::convert_to_utf8(pal::getenv(env_var_name.c_str())); + return pal::getenvA(name.c_str()); }, temp_value)) { _environmentVariables = {}; @@ -341,9 +326,9 @@ void dotenv::load_into_current_process() const { for (std::pair env_vars : _environmentVariables) { - pal::string_t name_string = convert_to_string_t(env_vars.first); - pal::string_t value_string = convert_to_string_t(env_vars.second); - pal::setenv(name_string.c_str(), std::move(value_string)); + pal::string_utf8_t name_string = env_vars.first; + pal::string_utf8_t value_string = env_vars.second; + pal::setenvA(name_string.c_str(), std::move(value_string)); } } From 12da7826e7235d9ffde336b9c41123182069b7ac Mon Sep 17 00:00:00 2001 From: Tom Deseyn Date: Wed, 26 Jan 2022 14:29:28 +0100 Subject: [PATCH 084/161] Refactor FileStatus.Unix. (#62721) * Refactor FileStatus.Unix. - Moves InitiallyDirectory out of FileStatus into FileSystemInfo. In FileSystemInfo it can be a readonly field making its usage clearer. And FileStatus can then directly be used to implement some FileSystem methods without allocating an intermediate FileInfo/DirectoryInfo. - Treat not exists/exist as initialized states to avoid wrongly assuming initialized means the file cache is valid, which isn't so when the file does not exist. - Use 0 for tracking uninitialized to make default(FileStatus) uninitialized. --- .../tests/Directory/SymbolicLinks.cs | 6 +- .../tests/DirectoryInfo/SymbolicLinks.cs | 6 +- .../IO/Enumeration/FileSystemEntry.Unix.cs | 14 +- .../src/System/IO/FileStatus.SetTimes.OSX.cs | 10 +- .../IO/FileStatus.SetTimes.OtherUnix.cs | 8 +- .../src/System/IO/FileStatus.Unix.cs | 218 ++++++++---------- .../src/System/IO/FileSystem.Unix.cs | 40 +--- .../src/System/IO/FileSystemInfo.Unix.cs | 20 +- .../src/System/IO/FileSystemInfo.cs | 1 - 9 files changed, 134 insertions(+), 189 deletions(-) diff --git a/src/libraries/System.IO.FileSystem/tests/Directory/SymbolicLinks.cs b/src/libraries/System.IO.FileSystem/tests/Directory/SymbolicLinks.cs index 43106e3c2a6b79..1052ddfc22b9b9 100644 --- a/src/libraries/System.IO.FileSystem/tests/Directory/SymbolicLinks.cs +++ b/src/libraries/System.IO.FileSystem/tests/Directory/SymbolicLinks.cs @@ -47,11 +47,7 @@ protected override void AssertLinkExists(FileSystemInfo link) } else { - // Unix implementation detail: - // When the directory target does not exist FileStatus.GetExists returns false because: - // - We check _exists (which whould be true because the link itself exists). - // - We check InitiallyDirectory, which is the initial expected object type (which would be true). - // - We check _directory (false because the target directory does not exist) + // Unix requires the target to be a directory that exists. Assert.False(link.Exists); } } diff --git a/src/libraries/System.IO.FileSystem/tests/DirectoryInfo/SymbolicLinks.cs b/src/libraries/System.IO.FileSystem/tests/DirectoryInfo/SymbolicLinks.cs index 84658b6f275b96..254c00df401335 100644 --- a/src/libraries/System.IO.FileSystem/tests/DirectoryInfo/SymbolicLinks.cs +++ b/src/libraries/System.IO.FileSystem/tests/DirectoryInfo/SymbolicLinks.cs @@ -44,11 +44,7 @@ protected override void AssertLinkExists(FileSystemInfo link) } else { - // Unix implementation detail: - // When the directory target does not exist FileStatus.GetExists returns false because: - // - We check _exists (which whould be true because the link itself exists). - // - We check InitiallyDirectory, which is the initial expected object type (which would be true). - // - We check _directory (false because the target directory does not exist) + // Unix requires the target to be a directory that exists. Assert.False(link.Exists); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemEntry.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemEntry.Unix.cs index 89c38584eea320..3c7fb6504473ed 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemEntry.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemEntry.Unix.cs @@ -11,6 +11,7 @@ namespace System.IO.Enumeration public unsafe ref partial struct FileSystemEntry { private Interop.Sys.DirectoryEntry _directoryEntry; + private bool _isDirectory; private FileStatus _status; private Span _pathBuffer; private ReadOnlySpan _fullPath; @@ -32,8 +33,8 @@ internal static FileAttributes Initialize( entry._pathBuffer = pathBuffer; entry._fullPath = ReadOnlySpan.Empty; entry._fileName = ReadOnlySpan.Empty; + entry._isDirectory = false; entry._status.InvalidateCaches(); - entry._status.InitiallyDirectory = false; bool isDirectory = directoryEntry.InodeType == Interop.Sys.NodeType.DT_DIR; bool isSymlink = directoryEntry.InodeType == Interop.Sys.NodeType.DT_LNK; @@ -41,15 +42,15 @@ internal static FileAttributes Initialize( if (isDirectory) { - entry._status.InitiallyDirectory = true; + entry._isDirectory = true; } else if (isSymlink) { - entry._status.InitiallyDirectory = entry._status.IsDirectory(entry.FullPath, continueOnError: true); + entry._isDirectory = entry._status.IsDirectory(entry.FullPath, continueOnError: true); } else if (isUnknown) { - entry._status.InitiallyDirectory = entry._status.IsDirectory(entry.FullPath, continueOnError: true); + entry._isDirectory = entry._status.IsDirectory(entry.FullPath, continueOnError: true); if (entry._status.IsSymbolicLink(entry.FullPath, continueOnError: true)) { entry._directoryEntry.InodeType = Interop.Sys.NodeType.DT_LNK; @@ -145,16 +146,17 @@ public FileAttributes Attributes public DateTimeOffset CreationTimeUtc => _status.GetCreationTime(FullPath, continueOnError: true); public DateTimeOffset LastAccessTimeUtc => _status.GetLastAccessTime(FullPath, continueOnError: true); public DateTimeOffset LastWriteTimeUtc => _status.GetLastWriteTime(FullPath, continueOnError: true); + public bool IsHidden => _status.IsFileSystemEntryHidden(FullPath, FileName); internal bool IsReadOnly => _status.IsReadOnly(FullPath, continueOnError: true); - public bool IsDirectory => _status.InitiallyDirectory; + public bool IsDirectory => _isDirectory; internal bool IsSymbolicLink => _directoryEntry.InodeType == Interop.Sys.NodeType.DT_LNK; public FileSystemInfo ToFileSystemInfo() { string fullPath = ToFullPath(); - return FileSystemInfo.Create(fullPath, new string(FileName), ref _status); + return FileSystemInfo.Create(fullPath, new string(FileName), _isDirectory, ref _status); } /// diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/FileStatus.SetTimes.OSX.cs b/src/libraries/System.Private.CoreLib/src/System/IO/FileStatus.SetTimes.OSX.cs index 23c46bae4a0125..40a887e7210be8 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/FileStatus.SetTimes.OSX.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/FileStatus.SetTimes.OSX.cs @@ -7,7 +7,7 @@ namespace System.IO { internal partial struct FileStatus { - internal void SetCreationTime(string path, DateTimeOffset time) + internal void SetCreationTime(string path, DateTimeOffset time, bool asDirectory) { // Try to set the attribute on the file system entry using setattrlist, // if we get ENOTSUP then it means that "The volume does not support @@ -27,11 +27,11 @@ internal void SetCreationTime(string path, DateTimeOffset time) } else if (error == Interop.Error.ENOTSUP) { - SetAccessOrWriteTimeCore(path, time, isAccessTime: false, checkCreationTime: false); + SetAccessOrWriteTimeCore(path, time, isAccessTime: false, checkCreationTime: false, asDirectory); } else { - Interop.CheckIo(error, path, InitiallyDirectory); + Interop.CheckIo(error, path, asDirectory); } } @@ -54,7 +54,7 @@ private unsafe Interop.Error SetCreationTimeCore(string path, long seconds, long return error; } - private void SetAccessOrWriteTime(string path, DateTimeOffset time, bool isAccessTime) => - SetAccessOrWriteTimeCore(path, time, isAccessTime, checkCreationTime: true); + private void SetAccessOrWriteTime(string path, DateTimeOffset time, bool isAccessTime, bool asDirectory) => + SetAccessOrWriteTimeCore(path, time, isAccessTime, checkCreationTime: true, asDirectory); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/FileStatus.SetTimes.OtherUnix.cs b/src/libraries/System.Private.CoreLib/src/System/IO/FileStatus.SetTimes.OtherUnix.cs index d9d9b1eeb7c920..85b01fde17d7c1 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/FileStatus.SetTimes.OtherUnix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/FileStatus.SetTimes.OtherUnix.cs @@ -7,11 +7,11 @@ namespace System.IO { internal partial struct FileStatus { - internal void SetCreationTime(string path, DateTimeOffset time) => - SetLastWriteTime(path, time); + internal void SetCreationTime(string path, DateTimeOffset time, bool asDirectory) => + SetLastWriteTime(path, time, asDirectory); - private void SetAccessOrWriteTime(string path, DateTimeOffset time, bool isAccessTime) => - SetAccessOrWriteTimeCore(path, time, isAccessTime, checkCreationTime: false); + private void SetAccessOrWriteTime(string path, DateTimeOffset time, bool isAccessTime, bool asDirectory) => + SetAccessOrWriteTimeCore(path, time, isAccessTime, checkCreationTime: false, asDirectory); // This is not used on these platforms, but is needed for source compat private Interop.Error SetCreationTimeCore(string path, long seconds, long nanoseconds) => diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/FileStatus.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/IO/FileStatus.Unix.cs index 20961a8fbbc2e4..91e67d1b9f74c6 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/FileStatus.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/FileStatus.Unix.cs @@ -10,44 +10,44 @@ internal partial struct FileStatus { private const int NanosecondsPerTick = 100; - // The last cached lstat information about the file + private const int InitializedExistsDir = -3; // target is directory. + private const int InitializedExistsFile = -2; // target is file. + private const int InitializedNotExists = -1; // entry does not exist. + private const int Uninitialized = 0; // uninitialized, '0' to make default(FileStatus) uninitialized. + + // Tracks the initialization state. + // < 0 : initialized succesfully. Value is InitializedNotExists, InitializedExistsFile or InitializedExistsDir. + // 0 : uninitialized. + // > 0 : initialized with error. Value is raw errno. + private int _state; + + // The last cached lstat information about the file. + // Must only be used after calling EnsureCachesInitialized and checking EntryExists is true. private Interop.Sys.FileStatus _fileCache; - // -1: if the file cache isn't initialized - Refresh should always change this value - // 0: if the file cache was initialized with no errors - // Positive number: the error code returned by the lstat call - private int _initializedFileCache; - - // We track intent of creation to know whether or not we want to (1) create a - // DirectoryInfo around this status struct or (2) actually are part of a DirectoryInfo. - // Set to true during initialization when the DirectoryEntry's INodeType describes a directory - internal bool InitiallyDirectory { get; set; } - - // Is a directory as of the last refresh - // Its value can come from either the main path or the symbolic link path - private bool _isDirectory; - - // Exists as of the last refresh - private bool _exists; - - private bool IsFileCacheInitialized => _initializedFileCache == 0; - - // Check if the main path (without following symlinks) has the hidden attribute set - // Ideally, use this if Refresh has been successfully called at least once. - // But since it is also used for soft retrieval during FileSystemEntry initialization, - // we return false early if the cache has not been initialized - internal bool HasHiddenFlag => IsFileCacheInitialized && - (_fileCache.UserFlags & (uint)Interop.Sys.UserFlags.UF_HIDDEN) == (uint)Interop.Sys.UserFlags.UF_HIDDEN; - - // Checks if the main path (without following symlinks) has the read-only attribute set - // Ideally, use this if Refresh has been successfully called at least once. - // But since it is also used for soft retrieval during FileSystemEntry initialization, - // we return false early if the cache has not been initialized - internal bool HasReadOnlyFlag + private bool EntryExists => _state <= InitializedExistsFile; + + private bool IsDir => _state == InitializedExistsDir; + + // Check if the main path (without following symlinks) has the hidden attribute set. + private bool HasHiddenFlag { get { - if (!IsFileCacheInitialized) + Debug.Assert(_state != Uninitialized); // Use this after EnsureCachesInitialized has been called. + + return EntryExists && (_fileCache.UserFlags & (uint)Interop.Sys.UserFlags.UF_HIDDEN) == (uint)Interop.Sys.UserFlags.UF_HIDDEN; + } + } + + // Checks if the main path (without following symlinks) has the read-only attribute set. + private bool HasReadOnlyFlag + { + get + { + Debug.Assert(_state != Uninitialized); // Use this after EnsureCachesInitialized has been called. + + if (!EntryExists) { return false; } @@ -78,6 +78,7 @@ internal bool HasReadOnlyFlag #if !TARGET_BROWSER // HasReadOnlyFlag cache. + // Must only be used after calling EnsureCachesInitialized. private int _isReadOnlyCache; private bool IsModeReadOnlyCore() @@ -123,20 +124,20 @@ private bool IsModeReadOnlyCore() #endif // Checks if the main path is a symbolic link - // Only call if Refresh has been successfully called at least once private bool HasSymbolicLinkFlag { get { - Debug.Assert(IsFileCacheInitialized); - return (_fileCache.Mode & Interop.Sys.FileTypes.S_IFMT) == Interop.Sys.FileTypes.S_IFLNK; + Debug.Assert(_state != Uninitialized); // Use this after EnsureCachesInitialized has been called. + + return EntryExists && (_fileCache.Mode & Interop.Sys.FileTypes.S_IFMT) == Interop.Sys.FileTypes.S_IFLNK; } } - // Sets the cache initialization flags to -1, which means the caches are now uninitialized + // Sets the cache initialization flags to 0, which means the caches are now uninitialized internal void InvalidateCaches() { - _initializedFileCache = -1; + _state = Uninitialized; } internal bool IsReadOnly(ReadOnlySpan path, bool continueOnError = false) @@ -169,7 +170,7 @@ internal bool IsFileSystemEntryHidden(ReadOnlySpan path, ReadOnlySpan path, bool continueOnError = false) { EnsureCachesInitialized(path, continueOnError); - return _isDirectory; + return IsDir; } internal bool IsSymbolicLink(ReadOnlySpan path, bool continueOnError = false) @@ -182,7 +183,7 @@ internal FileAttributes GetAttributes(ReadOnlySpan path, ReadOnlySpan path, ReadOnlySpan path, ReadOnlySpan