From 71cda5bbdcbe380f6285899ce3b5fcbb25e5c72c Mon Sep 17 00:00:00 2001 From: Karl Burtram Date: Mon, 14 Nov 2022 20:24:25 -0800 Subject: [PATCH] Update to latest .Net SDK 7.0 (#1760) * Bump to SDK 7.0 and related updates * More net 7 updates * Install SDK 2.0 for ESRP * Fix typo * Address comment and update integration test script * Disable new warnings from SDK update --- .vscode/launch.json | 4 +-- Directory.Build.props | 6 +++- RefreshDllsForTestRun.cmd | 4 +-- azure-pipelines/build.yml | 35 +++++++++++-------- azure-pipelines/createBuildDirectories.sh | 8 ++--- build.json | 12 +++---- global.json | 2 +- ...crosoft.SqlTools.ManagedBatchParser.nuspec | 28 +++++++-------- .../DataTransformation.cs | 3 ++ .../RulesEngine.cs | 8 +++-- .../Localization/sr.cs | 2 +- .../Microsoft.Kusto.ServiceLayer.csproj | 3 ++ .../DataStorage/StorageDataReader.cs | 2 +- .../Credentials/Linux/Interop.Errors.cs | 4 +-- .../Credentials/Linux/Interop.Sys.cs | 2 +- .../Credentials/OSX/Interop.CoreFoundation.cs | 8 ++--- .../Credentials/OSX/Interop.Security.cs | 24 ++++++------- .../Credentials/Win32/NativeMethods.cs | 14 ++++---- .../Localization/sr.cs | 2 +- .../Microsoft.SqlTools.Credentials.csproj | 1 + .../Extensibility/ExtensionServiceProvider.cs | 2 +- .../Localization/sr.cs | 2 +- .../Utility/ConcurrentCache.cs | 5 +-- .../Utility/GeneralRequestDetails.cs | 2 ++ .../ExecutionEngineCode/BatchParserSqlCmd.cs | 5 +-- .../BatchParser/PositionStruct.cs | 2 +- .../Localization/sr.cs | 2 +- ...crosoft.SqlTools.ManagedBatchParser.csproj | 7 ++-- .../Firewall/FirewallErrorParser.cs | 2 ++ .../Localization/sr.cs | 2 +- .../Localization/sr.cs | 2 +- ...lTools.ResourceProvider.DefaultImpl.csproj | 1 + .../Localization/sr.cs | 2 +- ...Microsoft.SqlTools.ResourceProvider.csproj | 1 + .../DacFx/GetObjectsFromTSqlModelOperation.cs | 2 +- .../ExecutionPlan/ExecutionPlanGraphUtils.cs | 4 +-- .../LanguageServices/AutoCompleteHelper.cs | 2 +- .../Localization/sr.cs | 2 +- .../Microsoft.SqlTools.ServiceLayer.csproj | 4 +++ .../ObjectExplorer/ObjectExplorerService.cs | 2 +- .../SmoModel/SmoChildFactoryBase.cs | 2 +- .../TaskServices/SqlTask.cs | 2 +- ...Tools.ServiceLayer.IntegrationTests.csproj | 6 ++++ .../ComparisonFailureException.cs | 2 +- .../EventFlowValidator.cs | 4 +-- .../Driver/ServiceTestDriver.cs | 2 +- .../Program.cs | 2 +- ...oft.SqlTools.ServiceLayer.UnitTests.csproj | 6 ++++ 48 files changed, 144 insertions(+), 107 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 3d5fc0f5..310e6db0 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -10,7 +10,7 @@ "request": "launch", "preLaunchTask": "build", // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceFolder}/src/Microsoft.SqlTools.ServiceLayer/bin/Debug/net6.0/MicrosoftSqlToolsServiceLayer.dll", + "program": "${workspaceFolder}/src/Microsoft.SqlTools.ServiceLayer/bin/Debug/net7.0/MicrosoftSqlToolsServiceLayer.dll", "args": [], "cwd": "${workspaceFolder}/src/Microsoft.SqlTools.ServiceLayer", // For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window @@ -24,7 +24,7 @@ "request": "launch", "preLaunchTask": "build", // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceFolder}/src/Microsoft.Kusto.ServiceLayer/bin/Debug/net6.0/MicrosoftKustoServiceLayer.dll", + "program": "${workspaceFolder}/src/Microsoft.Kusto.ServiceLayer/bin/Debug/net7.0/MicrosoftKustoServiceLayer.dll", "args": [], "cwd": "${workspaceFolder}/src/Microsoft.Kusto.ServiceLayer", // For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window diff --git a/Directory.Build.props b/Directory.Build.props index 7a5a3434..5f34946c 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -2,7 +2,7 @@ true true - net6.0 + net7.0 $(MSBuildThisFileDirectory) @@ -29,5 +29,9 @@ true enable + + $(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8605;CS8618;CS8620;CS8622;CS8625;CS8629;CS8632;CS8769;CS8765 + $(NoWarn);CS1998;CS8597;CS8612;CS8767;CS0168;CS0169;SYSLIB0012;SYSLIB0013;NETSDK1187 + diff --git a/RefreshDllsForTestRun.cmd b/RefreshDllsForTestRun.cmd index 3360ca20..f79896a0 100644 --- a/RefreshDllsForTestRun.cmd +++ b/RefreshDllsForTestRun.cmd @@ -5,8 +5,8 @@ IF [%_BuildConfiguration%] NEQ [] GOTO Start SET _BuildConfiguration=Debug :Start -SET _PerfTestSourceLocation="%WORKINGDIR%\test\Microsoft.SqlTools.ServiceLayer.PerfTests\bin\%_BuildConfiguration%\net6.0\win-x64\publish" -SET _ServiceSourceLocation="%WORKINGDIR%\src\Microsoft.SqlTools.ServiceLayer\bin\%_BuildConfiguration%\net6.0\win-x64\publish" +SET _PerfTestSourceLocation="%WORKINGDIR%\test\Microsoft.SqlTools.ServiceLayer.PerfTests\bin\%_BuildConfiguration%\net7.0\win-x64\publish" +SET _ServiceSourceLocation="%WORKINGDIR%\src\Microsoft.SqlTools.ServiceLayer\bin\%_BuildConfiguration%\net7.0\win-x64\publish" diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 98dc5f71..f1684c5d 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -1,4 +1,11 @@ steps: + +- task: UseDotNet@2 + displayName: 'Use .NET Core 2 sdk' + inputs: + useGlobalJson: false + version: 2.x + - task: UseDotNet@2 displayName: 'Use defined .NET Core sdk' inputs: @@ -202,54 +209,54 @@ steps: - task: ArchiveFiles@1 displayName: 'Archive osx build' inputs: - rootFolder: '$(Build.SourcesDirectory)/artifacts/publish/Microsoft.SqlTools.ServiceLayer/osx.10.11-x64/net6.0' + rootFolder: '$(Build.SourcesDirectory)/artifacts/publish/Microsoft.SqlTools.ServiceLayer/osx.10.11-x64/net7.0' includeRootFolder: false archiveType: tar - archiveFile: '$(Build.SourcesDirectory)/artifacts/package/Microsoft.SqlTools.ServiceLayer-osx-x64-net6.0.tar.gz' + archiveFile: '$(Build.SourcesDirectory)/artifacts/package/Microsoft.SqlTools.ServiceLayer-osx-x64-net7.0.tar.gz' - task: ArchiveFiles@1 displayName: 'Archive osx arm build' inputs: - rootFolder: '$(Build.SourcesDirectory)/artifacts/publish/Microsoft.SqlTools.ServiceLayer/osx-arm64/net6.0' + rootFolder: '$(Build.SourcesDirectory)/artifacts/publish/Microsoft.SqlTools.ServiceLayer/osx-arm64/net7.0' includeRootFolder: false archiveType: tar - archiveFile: '$(Build.SourcesDirectory)/artifacts/package/Microsoft.SqlTools.ServiceLayer-osx-arm64-net6.0.tar.gz' + archiveFile: '$(Build.SourcesDirectory)/artifacts/package/Microsoft.SqlTools.ServiceLayer-osx-arm64-net7.0.tar.gz' - task: ArchiveFiles@1 displayName: 'Archive rhel build' inputs: - rootFolder: '$(Build.SourcesDirectory)/artifacts/publish/Microsoft.SqlTools.ServiceLayer/rhel.7.2-x64/net6.0' + rootFolder: '$(Build.SourcesDirectory)/artifacts/publish/Microsoft.SqlTools.ServiceLayer/rhel.7.2-x64/net7.0' includeRootFolder: false archiveType: tar - archiveFile: '$(Build.SourcesDirectory)/artifacts/package/Microsoft.SqlTools.ServiceLayer-rhel-x64-net6.0.tar.gz' + archiveFile: '$(Build.SourcesDirectory)/artifacts/package/Microsoft.SqlTools.ServiceLayer-rhel-x64-net7.0.tar.gz' - task: ArchiveFiles@1 displayName: 'Archive windows 64 bit build' inputs: - rootFolder: '$(Build.SourcesDirectory)/artifacts/publish/Microsoft.SqlTools.ServiceLayer/win-x64/net6.0' + rootFolder: '$(Build.SourcesDirectory)/artifacts/publish/Microsoft.SqlTools.ServiceLayer/win-x64/net7.0' includeRootFolder: false - archiveFile: '$(Build.SourcesDirectory)/artifacts/package/Microsoft.SqlTools.ServiceLayer-win-x64-net6.0.zip' + archiveFile: '$(Build.SourcesDirectory)/artifacts/package/Microsoft.SqlTools.ServiceLayer-win-x64-net7.0.zip' - task: ArchiveFiles@1 displayName: 'Archive windows 32 bit build' inputs: - rootFolder: '$(Build.SourcesDirectory)/artifacts/publish/Microsoft.SqlTools.ServiceLayer/win-x86/net6.0' + rootFolder: '$(Build.SourcesDirectory)/artifacts/publish/Microsoft.SqlTools.ServiceLayer/win-x86/net7.0' includeRootFolder: false - archiveFile: '$(Build.SourcesDirectory)/artifacts/package/Microsoft.SqlTools.ServiceLayer-win-x86-net6.0.zip' + archiveFile: '$(Build.SourcesDirectory)/artifacts/package/Microsoft.SqlTools.ServiceLayer-win-x86-net7.0.zip' # - task: ArchiveFiles@1 # displayName: 'Archive windows10 arm 32 bit build' # inputs: -# rootFolder: '$(Build.SourcesDirectory)/artifacts/publish/Microsoft.SqlTools.ServiceLayer/win10-arm/net6.0' +# rootFolder: '$(Build.SourcesDirectory)/artifacts/publish/Microsoft.SqlTools.ServiceLayer/win10-arm/net7.0' # includeRootFolder: false -# archiveFile: '$(Build.SourcesDirectory)/artifacts/package/Microsoft.SqlTools.ServiceLayer-win10-arm-net6.0.zip' +# archiveFile: '$(Build.SourcesDirectory)/artifacts/package/Microsoft.SqlTools.ServiceLayer-win10-arm-net7.0.zip' # - task: ArchiveFiles@1 # displayName: 'Archive windows10 arm 64 bit build' # inputs: -# rootFolder: '$(Build.SourcesDirectory)/artifacts/publish/Microsoft.SqlTools.ServiceLayer/win10-arm64/net6.0' +# rootFolder: '$(Build.SourcesDirectory)/artifacts/publish/Microsoft.SqlTools.ServiceLayer/win10-arm64/net7.0' # includeRootFolder: false -# archiveFile: '$(Build.SourcesDirectory)/artifacts/package/Microsoft.SqlTools.ServiceLayer-win10-arm64-net6.0.zip' +# archiveFile: '$(Build.SourcesDirectory)/artifacts/package/Microsoft.SqlTools.ServiceLayer-win10-arm64-net7.0.zip' - task: PublishBuildArtifacts@1 displayName: 'Publish Artifact: build archives' diff --git a/azure-pipelines/createBuildDirectories.sh b/azure-pipelines/createBuildDirectories.sh index 2a243100..11fcecd2 100755 --- a/azure-pipelines/createBuildDirectories.sh +++ b/azure-pipelines/createBuildDirectories.sh @@ -13,7 +13,7 @@ # The script need to run from the repo root -net6projectArray=( +net7projectArray=( "./src/Microsoft.InsightsGenerator" "./src/Microsoft.Kusto.ServiceLayer" "./src/Microsoft.SqlTools.Credentials" @@ -40,7 +40,7 @@ netStandard2ProjectArray=( ) # Please update the framework vars when updating target framework for the projects -framework6="/bin/Debug/net6.0/" +framework7="/bin/Debug/net7.0/" framework2="/bin/Debug/netstandard2.1/" requiredLocDirectories=( @@ -75,13 +75,13 @@ requiredLocDirectories=( "zh-hant" ) -for i in "${net6projectArray[@]}" +for i in "${net7projectArray[@]}" do : for k in "${requiredLocDirectories[@]}" do : - output=`mkdir -v -p $i$framework6$k` + output=`mkdir -v -p $i$framework7$k` echo $output done done diff --git a/build.json b/build.json index ebe1eb05..37a45309 100644 --- a/build.json +++ b/build.json @@ -9,24 +9,24 @@ "PackageName": "Microsoft.SqlTools.ServiceLayer", "TestProjects": { "Microsoft.SqlTools.ServiceLayer.UnitTests": [ - "net6.0" + "net7.0" ], "Microsoft.Kusto.ServiceLayer.UnitTests": [ - "net6.0" + "net7.0" ], "Microsoft.SqlTools.ServiceLayer.TestEnvConfig": [ - "net6.0" + "net7.0" ], "Microsoft.SqlTools.ServiceLayer.IntegrationTests": [ - "net6.0" + "net7.0" ] }, "Frameworks": [ - "net6.0" + "net7.0" ], "FxFrameworks":[ "net472", - "net6.0" + "net7.0" ], "MainProjects": [ "Microsoft.SqlTools.Credentials", diff --git a/global.json b/global.json index 3e9daa9c..60de2327 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "6.0.403", + "version": "7.0.100", "rollForward": "latestFeature" }, "msbuild-sdks": { diff --git a/packages/Microsoft.SqlTools.ManagedBatchParser/Microsoft.SqlTools.ManagedBatchParser.nuspec b/packages/Microsoft.SqlTools.ManagedBatchParser/Microsoft.SqlTools.ManagedBatchParser.nuspec index 32bb2d46..4d8711eb 100644 --- a/packages/Microsoft.SqlTools.ManagedBatchParser/Microsoft.SqlTools.ManagedBatchParser.nuspec +++ b/packages/Microsoft.SqlTools.ManagedBatchParser/Microsoft.SqlTools.ManagedBatchParser.nuspec @@ -18,7 +18,7 @@ - + @@ -42,19 +42,19 @@ - - - - - - - - - - + + + + + + + + + + - - - + + + \ No newline at end of file diff --git a/src/Microsoft.InsightsGenerator/DataTransformation.cs b/src/Microsoft.InsightsGenerator/DataTransformation.cs index 1a68271e..b2da3902 100644 --- a/src/Microsoft.InsightsGenerator/DataTransformation.cs +++ b/src/Microsoft.InsightsGenerator/DataTransformation.cs @@ -34,6 +34,8 @@ namespace Microsoft.InsightsGenerator private string[] GetColumnLabels(DataArray array, out DataArray.DataType[] columnDataType) { + // turn off warning for using ContainsKey/Add vs. TryAdd with Dictionaries + #pragma warning disable CA1854 columnDataType = new DataArray.DataType[array.ColumnNames.Length]; int columnCount = array.Cells[0].Length; Dictionary> columnInfo = new Dictionary>(); @@ -116,6 +118,7 @@ namespace Microsoft.InsightsGenerator labels[numberColumns[i].ColumnIndex] = "output_" + i; } } + #pragma warning restore CA1854 return labels; } diff --git a/src/Microsoft.InsightsGenerator/RulesEngine.cs b/src/Microsoft.InsightsGenerator/RulesEngine.cs index 5a264e2a..94d011dc 100644 --- a/src/Microsoft.InsightsGenerator/RulesEngine.cs +++ b/src/Microsoft.InsightsGenerator/RulesEngine.cs @@ -26,8 +26,10 @@ namespace Microsoft.InsightsGenerator public static ColumnHeaders TemplateParser(string templateContent) { - ColumnHeaders ch = new ColumnHeaders(); + ColumnHeaders ch = new ColumnHeaders(); + #pragma warning disable SYSLIB1045 var processedText = Regex.Replace(templateContent, @",|\\n", ""); + #pragma warning restore SYSLIB1045 ch.Template = templateContent; List keyvalue = processedText.Split(' ').Select(s => s.Trim()).ToList(); @@ -74,7 +76,7 @@ namespace Microsoft.InsightsGenerator // all the values from template needs to be found in the input from SigGen foreach (var hashFromTemplate in singleHashFromTemplate) { - if (!headersWithSingleHash.Contains(hashFromTemplate.ToLower())) + if (!headersWithSingleHash.Contains(hashFromTemplate.ToLowerInvariant())) { isMatched = false; break; @@ -143,7 +145,7 @@ namespace Microsoft.InsightsGenerator var topHeaderList = new List(); foreach (var list in singleHashHeaders) { - topHeaderList.Add("#" + list.First().ToLower()); + topHeaderList.Add("#" + list.First().ToLowerInvariant()); } return topHeaderList; } diff --git a/src/Microsoft.Kusto.ServiceLayer/Localization/sr.cs b/src/Microsoft.Kusto.ServiceLayer/Localization/sr.cs index 4d947f7e..dbf4393f 100644 --- a/src/Microsoft.Kusto.ServiceLayer/Localization/sr.cs +++ b/src/Microsoft.Kusto.ServiceLayer/Localization/sr.cs @@ -1,5 +1,5 @@ // WARNING: -// This file was generated by the Microsoft DataWarehouse String Resource Tool 6.0.0.0 +// This file was generated by the Microsoft DataWarehouse String Resource Tool 7.0.0.0 // from information in sr.strings // DO NOT MODIFY THIS FILE'S CONTENTS, THEY WILL BE OVERWRITTEN // diff --git a/src/Microsoft.Kusto.ServiceLayer/Microsoft.Kusto.ServiceLayer.csproj b/src/Microsoft.Kusto.ServiceLayer/Microsoft.Kusto.ServiceLayer.csproj index d9b0daf0..adc33335 100644 --- a/src/Microsoft.Kusto.ServiceLayer/Microsoft.Kusto.ServiceLayer.csproj +++ b/src/Microsoft.Kusto.ServiceLayer/Microsoft.Kusto.ServiceLayer.csproj @@ -14,6 +14,9 @@ true portable $(ToolsServiceTargetRuntimes) + $(NoWarn);SYSLIB1045 + $(NoWarn);CA1311 + $(NoWarn);CA1854 diff --git a/src/Microsoft.Kusto.ServiceLayer/QueryExecution/DataStorage/StorageDataReader.cs b/src/Microsoft.Kusto.ServiceLayer/QueryExecution/DataStorage/StorageDataReader.cs index 26a14755..f6c7ac3e 100644 --- a/src/Microsoft.Kusto.ServiceLayer/QueryExecution/DataStorage/StorageDataReader.cs +++ b/src/Microsoft.Kusto.ServiceLayer/QueryExecution/DataStorage/StorageDataReader.cs @@ -73,7 +73,7 @@ namespace Microsoft.Kusto.ServiceLayer.QueryExecution.DataStorage /// public Task ReadAsync(CancellationToken cancellationToken) { - return Task.Run(() => DataReader.Read()); + return Task.Run(DataReader.Read); } /// diff --git a/src/Microsoft.SqlTools.Credentials/Credentials/Linux/Interop.Errors.cs b/src/Microsoft.SqlTools.Credentials/Credentials/Linux/Interop.Errors.cs index 9e2029d4..5b38c11d 100644 --- a/src/Microsoft.SqlTools.Credentials/Credentials/Linux/Interop.Errors.cs +++ b/src/Microsoft.SqlTools.Credentials/Credentials/Linux/Interop.Errors.cs @@ -22,7 +22,7 @@ namespace Microsoft.SqlTools.Credentials // which obtains the raw errno that varies between unixes. The strong typing as an enum is meant to // prevent confusing the two. Casting to or from int is suspect. Use GetLastErrorInfo() if you need to // correlate these to the underlying platform values or obtain the corresponding error message. - // + // SUCCESS = 0, @@ -183,7 +183,7 @@ namespace Microsoft.SqlTools.Credentials // so here in the future if necessary. message = buffer; } - + string returnMsg = Marshal.PtrToStringAnsi(message); return returnMsg; } diff --git a/src/Microsoft.SqlTools.Credentials/Credentials/Linux/Interop.Sys.cs b/src/Microsoft.SqlTools.Credentials/Credentials/Linux/Interop.Sys.cs index 3f7a39b5..12872eba 100644 --- a/src/Microsoft.SqlTools.Credentials/Credentials/Linux/Interop.Sys.cs +++ b/src/Microsoft.SqlTools.Credentials/Credentials/Linux/Interop.Sys.cs @@ -17,7 +17,7 @@ namespace Microsoft.SqlTools.Credentials { [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_ChMod", SetLastError = true)] internal static extern int ChMod(string path, int mode); - + internal struct Passwd { internal IntPtr Name; // char* diff --git a/src/Microsoft.SqlTools.Credentials/Credentials/OSX/Interop.CoreFoundation.cs b/src/Microsoft.SqlTools.Credentials/Credentials/OSX/Interop.CoreFoundation.cs index 8c71ee46..5da3207f 100644 --- a/src/Microsoft.SqlTools.Credentials/Credentials/OSX/Interop.CoreFoundation.cs +++ b/src/Microsoft.SqlTools.Credentials/Credentials/OSX/Interop.CoreFoundation.cs @@ -43,10 +43,10 @@ namespace Microsoft.SqlTools.Credentials /// For *nix systems, the CLR maps ANSI to UTF-8, so be explicit about that [DllImport(Interop.Libraries.CoreFoundationLibrary, CharSet = CharSet.Ansi)] private static extern SafeCreateHandle CFStringCreateWithCString( - IntPtr allocator, - string str, + IntPtr allocator, + string str, CFStringBuiltInEncodings encoding); - + /// /// Creates a CFStringRef from a 8-bit String object. Follows the "Create Rule" where if you create it, you delete it. /// @@ -86,7 +86,7 @@ namespace Microsoft.SqlTools.Credentials /// /// You should retain a Core Foundation object when you receive it from elsewhere - /// (that is, you did not create or copy it) and you want it to persist. If you + /// (that is, you did not create or copy it) and you want it to persist. If you /// retain a Core Foundation object you are responsible for releasing it /// /// The CFType object to retain. This value must not be NULL diff --git a/src/Microsoft.SqlTools.Credentials/Credentials/OSX/Interop.Security.cs b/src/Microsoft.SqlTools.Credentials/Credentials/OSX/Interop.Security.cs index f7afc98b..4fc74eca 100644 --- a/src/Microsoft.SqlTools.Credentials/Credentials/OSX/Interop.Security.cs +++ b/src/Microsoft.SqlTools.Credentials/Credentials/OSX/Interop.Security.cs @@ -14,11 +14,11 @@ namespace Microsoft.SqlTools.Credentials { [DllImport(Libraries.SecurityLibrary, CharSet = CharSet.Unicode, SetLastError = true)] - internal static extern OSStatus SecKeychainAddGenericPassword(IntPtr keyChainRef, UInt32 serviceNameLength, string serviceName, + internal static extern OSStatus SecKeychainAddGenericPassword(IntPtr keyChainRef, UInt32 serviceNameLength, string serviceName, UInt32 accountNameLength, string accountName, UInt32 passwordLength, IntPtr password, [Out] IntPtr itemRef); - + /// - /// Find a generic password based on the attributes passed + /// Find a generic password based on the attributes passed /// /// /// A reference to an array of keychains to search, a single keychain, or NULL to search the user's default keychain search list. @@ -29,22 +29,22 @@ namespace Microsoft.SqlTools.Credentials /// A pointer to a string containing the account name. /// On return, the length of the buffer pointed to by passwordData. /// - /// On return, a pointer to a data buffer containing the password. - /// Your application must call SecKeychainItemFreeContent(NULL, passwordData) + /// On return, a pointer to a data buffer containing the password. + /// Your application must call SecKeychainItemFreeContent(NULL, passwordData) /// to release this data buffer when it is no longer needed.Pass NULL if you are not interested in retrieving the password data at /// this time, but simply want to find the item reference. /// /// On return, a reference to the keychain item which was found. /// A result code that should be in /// - /// The SecKeychainFindGenericPassword function finds the first generic password item which matches the attributes you provide. - /// Most attributes are optional; you should pass only as many as you need to narrow the search sufficiently for your application's intended use. + /// The SecKeychainFindGenericPassword function finds the first generic password item which matches the attributes you provide. + /// Most attributes are optional; you should pass only as many as you need to narrow the search sufficiently for your application's intended use. /// SecKeychainFindGenericPassword optionally returns a reference to the found item. /// [DllImport(Libraries.SecurityLibrary, CharSet = CharSet.Unicode, SetLastError = true)] - internal static extern OSStatus SecKeychainFindGenericPassword(IntPtr keyChainRef, UInt32 serviceNameLength, string serviceName, + internal static extern OSStatus SecKeychainFindGenericPassword(IntPtr keyChainRef, UInt32 serviceNameLength, string serviceName, UInt32 accountNameLength, string accountName, out UInt32 passwordLength, out IntPtr password, out IntPtr itemRef); - + /// /// Releases the memory used by the keychain attribute list and the keychain data retrieved in a previous call to SecKeychainItemCopyContent. /// @@ -53,15 +53,15 @@ namespace Microsoft.SqlTools.Credentials /// A result code that should be in [DllImport(Libraries.SecurityLibrary, SetLastError = true)] internal static extern OSStatus SecKeychainItemFreeContent([In] IntPtr attrList, [In] IntPtr data); - + /// /// Deletes a keychain item from the default keychain's permanent data store. /// /// A keychain item reference of the item to delete. /// A result code that should be in /// - /// If itemRef has not previously been added to the keychain, SecKeychainItemDelete does nothing and returns ErrSecSuccess. - /// IMPORTANT: SecKeychainItemDelete does not dispose the memory occupied by the item reference itself; + /// If itemRef has not previously been added to the keychain, SecKeychainItemDelete does nothing and returns ErrSecSuccess. + /// IMPORTANT: SecKeychainItemDelete does not dispose the memory occupied by the item reference itself; /// use the CFRelease function when you are completely * * finished with an item. /// [DllImport(Libraries.SecurityLibrary, SetLastError = true)] diff --git a/src/Microsoft.SqlTools.Credentials/Credentials/Win32/NativeMethods.cs b/src/Microsoft.SqlTools.Credentials/Credentials/Win32/NativeMethods.cs index 20b0ed2f..07a8e6db 100644 --- a/src/Microsoft.SqlTools.Credentials/Credentials/Win32/NativeMethods.cs +++ b/src/Microsoft.SqlTools.Credentials/Credentials/Win32/NativeMethods.cs @@ -1,6 +1,6 @@ // -// Code originally from http://credentialmanagement.codeplex.com/, -// Licensed under the Apache License 2.0 +// Code originally from http://credentialmanagement.codeplex.com/, +// Licensed under the Apache License 2.0 // using System; @@ -11,7 +11,7 @@ namespace Microsoft.SqlTools.Credentials.Win32 { internal class NativeMethods { - + [StructLayout(LayoutKind.Sequential)] internal struct CREDENTIAL { @@ -32,7 +32,7 @@ namespace Microsoft.SqlTools.Credentials.Win32 [MarshalAs(UnmanagedType.LPWStr)] public string UserName; } - + [DllImport("Advapi32.dll", EntryPoint = "CredReadW", CharSet = CharSet.Unicode, SetLastError = true)] internal static extern bool CredRead(string target, CredentialType type, int reservedFlag, out IntPtr CredentialPtr); @@ -47,7 +47,7 @@ namespace Microsoft.SqlTools.Credentials.Win32 [DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)] internal static extern bool CredEnumerateW(string filter, int flag, out uint count, out IntPtr pCredentials); - + [DllImport("ole32.dll")] internal static extern void CoTaskMemFree(IntPtr ptr); @@ -86,7 +86,7 @@ namespace Microsoft.SqlTools.Credentials.Win32 } // Perform any specific actions to release the handle in the ReleaseHandle method. - // Often, you need to use Pinvoke to make a call into the Win32 API to release the + // Often, you need to use Pinvoke to make a call into the Win32 API to release the // handle. In this case, however, we can use the Marshal class to release the unmanaged memory. protected override bool ReleaseHandle() @@ -101,7 +101,7 @@ namespace Microsoft.SqlTools.Credentials.Win32 SetHandleAsInvalid(); return true; } - // Return false. + // Return false. return false; } } diff --git a/src/Microsoft.SqlTools.Credentials/Localization/sr.cs b/src/Microsoft.SqlTools.Credentials/Localization/sr.cs index bcd5a04a..fbe37677 100755 --- a/src/Microsoft.SqlTools.Credentials/Localization/sr.cs +++ b/src/Microsoft.SqlTools.Credentials/Localization/sr.cs @@ -1,5 +1,5 @@ // WARNING: -// This file was generated by the Microsoft DataWarehouse String Resource Tool 6.0.0.0 +// This file was generated by the Microsoft DataWarehouse String Resource Tool 7.0.0.0 // from information in sr.strings // DO NOT MODIFY THIS FILE'S CONTENTS, THEY WILL BE OVERWRITTEN // diff --git a/src/Microsoft.SqlTools.Credentials/Microsoft.SqlTools.Credentials.csproj b/src/Microsoft.SqlTools.Credentials/Microsoft.SqlTools.Credentials.csproj index 397d744f..3a68936a 100644 --- a/src/Microsoft.SqlTools.Credentials/Microsoft.SqlTools.Credentials.csproj +++ b/src/Microsoft.SqlTools.Credentials/Microsoft.SqlTools.Credentials.csproj @@ -13,6 +13,7 @@ true true $(ToolsServiceTargetRuntimes) + $(NoWarn);SYSLIB1054 diff --git a/src/Microsoft.SqlTools.Hosting/Extensibility/ExtensionServiceProvider.cs b/src/Microsoft.SqlTools.Hosting/Extensibility/ExtensionServiceProvider.cs index d9c07ac5..fc4c2bd8 100644 --- a/src/Microsoft.SqlTools.Hosting/Extensibility/ExtensionServiceProvider.cs +++ b/src/Microsoft.SqlTools.Hosting/Extensibility/ExtensionServiceProvider.cs @@ -112,7 +112,7 @@ namespace Microsoft.SqlTools.Extensibility if (!services.ContainsKey(typeof(T))) { ExtensionStore store = new ExtensionStore(typeof(T), config); - base.Register(() => store.GetExports()); + base.Register(store.GetExports); } } diff --git a/src/Microsoft.SqlTools.Hosting/Localization/sr.cs b/src/Microsoft.SqlTools.Hosting/Localization/sr.cs index 5e48d9fb..ef9923d8 100755 --- a/src/Microsoft.SqlTools.Hosting/Localization/sr.cs +++ b/src/Microsoft.SqlTools.Hosting/Localization/sr.cs @@ -1,5 +1,5 @@ // WARNING: -// This file was generated by the Microsoft DataWarehouse String Resource Tool 6.0.0.0 +// This file was generated by the Microsoft DataWarehouse String Resource Tool 7.0.0.0 // from information in sr.strings // DO NOT MODIFY THIS FILE'S CONTENTS, THEY WILL BE OVERWRITTEN // diff --git a/src/Microsoft.SqlTools.Hosting/Utility/ConcurrentCache.cs b/src/Microsoft.SqlTools.Hosting/Utility/ConcurrentCache.cs index 006b260c..90993acc 100644 --- a/src/Microsoft.SqlTools.Hosting/Utility/ConcurrentCache.cs +++ b/src/Microsoft.SqlTools.Hosting/Utility/ConcurrentCache.cs @@ -23,10 +23,7 @@ namespace Microsoft.SqlTools.Utility { foreach (var key in keys) { - if (_cache.ContainsKey(key)) - { - _cache.Remove(key); - } + _cache.Remove(key); } } }, out exception); diff --git a/src/Microsoft.SqlTools.Hosting/Utility/GeneralRequestDetails.cs b/src/Microsoft.SqlTools.Hosting/Utility/GeneralRequestDetails.cs index 4f39e6fe..eb14e77a 100644 --- a/src/Microsoft.SqlTools.Hosting/Utility/GeneralRequestDetails.cs +++ b/src/Microsoft.SqlTools.Hosting/Utility/GeneralRequestDetails.cs @@ -19,6 +19,7 @@ namespace Microsoft.SqlTools.Utility public T GetOptionValue(string name, T defaultValue = default(T)) { + #pragma warning disable CA1854 T result = defaultValue; if (Options != null && Options.ContainsKey(name)) { @@ -34,6 +35,7 @@ namespace Microsoft.SqlTools.Utility "Cannot convert option value {0}:{1} to {2}", name, value ?? "", typeof(T))); } } + #pragma warning restore CA1854 return result; } diff --git a/src/Microsoft.SqlTools.ManagedBatchParser/BatchParser/ExecutionEngineCode/BatchParserSqlCmd.cs b/src/Microsoft.SqlTools.ManagedBatchParser/BatchParser/ExecutionEngineCode/BatchParserSqlCmd.cs index a07633bd..19edaf79 100644 --- a/src/Microsoft.SqlTools.ManagedBatchParser/BatchParser/ExecutionEngineCode/BatchParserSqlCmd.cs +++ b/src/Microsoft.SqlTools.ManagedBatchParser/BatchParser/ExecutionEngineCode/BatchParserSqlCmd.cs @@ -89,10 +89,7 @@ namespace Microsoft.SqlTools.ServiceLayer.BatchParser.ExecutionEngineCode if (value == null) { - if (internalVariables.ContainsKey(name)) - { - internalVariables.Remove(name); - } + internalVariables.Remove(name); } else { diff --git a/src/Microsoft.SqlTools.ManagedBatchParser/BatchParser/PositionStruct.cs b/src/Microsoft.SqlTools.ManagedBatchParser/BatchParser/PositionStruct.cs index 25654eea..fda9e3bb 100644 --- a/src/Microsoft.SqlTools.ManagedBatchParser/BatchParser/PositionStruct.cs +++ b/src/Microsoft.SqlTools.ManagedBatchParser/BatchParser/PositionStruct.cs @@ -8,7 +8,7 @@ using System; namespace Microsoft.SqlTools.ServiceLayer.BatchParser { [Serializable] - public struct PositionStruct + public readonly struct PositionStruct { private readonly int line; private readonly int column; diff --git a/src/Microsoft.SqlTools.ManagedBatchParser/Localization/sr.cs b/src/Microsoft.SqlTools.ManagedBatchParser/Localization/sr.cs index 6d1940df..00c174cd 100644 --- a/src/Microsoft.SqlTools.ManagedBatchParser/Localization/sr.cs +++ b/src/Microsoft.SqlTools.ManagedBatchParser/Localization/sr.cs @@ -1,5 +1,5 @@ // WARNING: -// This file was generated by the Microsoft DataWarehouse String Resource Tool 6.0.0.0 +// This file was generated by the Microsoft DataWarehouse String Resource Tool 7.0.0.0 // from information in sr.strings // DO NOT MODIFY THIS FILE'S CONTENTS, THEY WILL BE OVERWRITTEN // diff --git a/src/Microsoft.SqlTools.ManagedBatchParser/Microsoft.SqlTools.ManagedBatchParser.csproj b/src/Microsoft.SqlTools.ManagedBatchParser/Microsoft.SqlTools.ManagedBatchParser.csproj index 3bcd270d..1e39b555 100644 --- a/src/Microsoft.SqlTools.ManagedBatchParser/Microsoft.SqlTools.ManagedBatchParser.csproj +++ b/src/Microsoft.SqlTools.ManagedBatchParser/Microsoft.SqlTools.ManagedBatchParser.csproj @@ -1,7 +1,7 @@  - - net6.0;net472 + + net7.0;net472 9.0 disable Microsoft.SqlTools.ManagedBatchParser @@ -13,6 +13,7 @@ false false Microsoft SqlTools Managed batch parser + $(NoWarn);CA1852 @@ -28,7 +29,7 @@ - + diff --git a/src/Microsoft.SqlTools.ResourceProvider.Core/Firewall/FirewallErrorParser.cs b/src/Microsoft.SqlTools.ResourceProvider.Core/Firewall/FirewallErrorParser.cs index c30e3279..46f47e4e 100644 --- a/src/Microsoft.SqlTools.ResourceProvider.Core/Firewall/FirewallErrorParser.cs +++ b/src/Microsoft.SqlTools.ResourceProvider.Core/Firewall/FirewallErrorParser.cs @@ -69,10 +69,12 @@ namespace Microsoft.SqlTools.ResourceProvider.Core.Firewall clientIp = null; try { + #pragma warning disable SYSLIB1045 Regex regex = new Regex( @"\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b", RegexOptions.IgnoreCase); + #pragma warning restore SYSLIB1045 Match match = regex.Match(message); if (match.Success) diff --git a/src/Microsoft.SqlTools.ResourceProvider.Core/Localization/sr.cs b/src/Microsoft.SqlTools.ResourceProvider.Core/Localization/sr.cs index 5b329b07..24fc4644 100644 --- a/src/Microsoft.SqlTools.ResourceProvider.Core/Localization/sr.cs +++ b/src/Microsoft.SqlTools.ResourceProvider.Core/Localization/sr.cs @@ -1,5 +1,5 @@ // WARNING: -// This file was generated by the Microsoft DataWarehouse String Resource Tool 6.0.0.0 +// This file was generated by the Microsoft DataWarehouse String Resource Tool 7.0.0.0 // from information in sr.strings // DO NOT MODIFY THIS FILE'S CONTENTS, THEY WILL BE OVERWRITTEN // diff --git a/src/Microsoft.SqlTools.ResourceProvider.DefaultImpl/Localization/sr.cs b/src/Microsoft.SqlTools.ResourceProvider.DefaultImpl/Localization/sr.cs index 0198ea45..791c7bc1 100644 --- a/src/Microsoft.SqlTools.ResourceProvider.DefaultImpl/Localization/sr.cs +++ b/src/Microsoft.SqlTools.ResourceProvider.DefaultImpl/Localization/sr.cs @@ -1,5 +1,5 @@ // WARNING: -// This file was generated by the Microsoft DataWarehouse String Resource Tool 6.0.0.0 +// This file was generated by the Microsoft DataWarehouse String Resource Tool 7.0.0.0 // from information in sr.strings // DO NOT MODIFY THIS FILE'S CONTENTS, THEY WILL BE OVERWRITTEN // diff --git a/src/Microsoft.SqlTools.ResourceProvider.DefaultImpl/Microsoft.SqlTools.ResourceProvider.DefaultImpl.csproj b/src/Microsoft.SqlTools.ResourceProvider.DefaultImpl/Microsoft.SqlTools.ResourceProvider.DefaultImpl.csproj index 82d13939..1a8139eb 100644 --- a/src/Microsoft.SqlTools.ResourceProvider.DefaultImpl/Microsoft.SqlTools.ResourceProvider.DefaultImpl.csproj +++ b/src/Microsoft.SqlTools.ResourceProvider.DefaultImpl/Microsoft.SqlTools.ResourceProvider.DefaultImpl.csproj @@ -10,6 +10,7 @@ Provides the default for SqlTools applications. � Microsoft Corporation. All rights reserved. + $(NoWarn);CA1852 diff --git a/src/Microsoft.SqlTools.ResourceProvider/Localization/sr.cs b/src/Microsoft.SqlTools.ResourceProvider/Localization/sr.cs index bdf40374..4f55d4ab 100755 --- a/src/Microsoft.SqlTools.ResourceProvider/Localization/sr.cs +++ b/src/Microsoft.SqlTools.ResourceProvider/Localization/sr.cs @@ -1,5 +1,5 @@ // WARNING: -// This file was generated by the Microsoft DataWarehouse String Resource Tool 6.0.0.0 +// This file was generated by the Microsoft DataWarehouse String Resource Tool 7.0.0.0 // from information in sr.strings // DO NOT MODIFY THIS FILE'S CONTENTS, THEY WILL BE OVERWRITTEN // diff --git a/src/Microsoft.SqlTools.ResourceProvider/Microsoft.SqlTools.ResourceProvider.csproj b/src/Microsoft.SqlTools.ResourceProvider/Microsoft.SqlTools.ResourceProvider.csproj index 66c1e656..279783ed 100644 --- a/src/Microsoft.SqlTools.ResourceProvider/Microsoft.SqlTools.ResourceProvider.csproj +++ b/src/Microsoft.SqlTools.ResourceProvider/Microsoft.SqlTools.ResourceProvider.csproj @@ -12,6 +12,7 @@ false false $(ToolsServiceTargetRuntimes) + $(NoWarn);CA1852 TRACE;DEBUG;NETCOREAPP1_0;NETCOREAPP2_0 diff --git a/src/Microsoft.SqlTools.ServiceLayer/DacFx/GetObjectsFromTSqlModelOperation.cs b/src/Microsoft.SqlTools.ServiceLayer/DacFx/GetObjectsFromTSqlModelOperation.cs index d1d1697c..02596e65 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/DacFx/GetObjectsFromTSqlModelOperation.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/DacFx/GetObjectsFromTSqlModelOperation.cs @@ -34,7 +34,7 @@ namespace Microsoft.SqlTools.ServiceLayer.DacFx { try { - var filters = Parameters.ObjectTypes.Select(t => MapType(t)).ToArray(); + var filters = Parameters.ObjectTypes.Select(MapType).ToArray(); var objects = Model.GetObjects(DacQueryScopes.UserDefined, filters).ToList(); return objects.Select(o => new TSqlObjectInfo diff --git a/src/Microsoft.SqlTools.ServiceLayer/ExecutionPlan/ExecutionPlanGraphUtils.cs b/src/Microsoft.SqlTools.ServiceLayer/ExecutionPlan/ExecutionPlanGraphUtils.cs index 4238c164..dfef03d3 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ExecutionPlan/ExecutionPlanGraphUtils.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ExecutionPlan/ExecutionPlanGraphUtils.cs @@ -79,8 +79,8 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan Subtext = currentNode.GetDisplayLinesOfText(true), RelativeCost = currentNode.RelativeCost, Properties = GetProperties(currentNode.Properties), - Children = currentNode.Children.Select(x => ConvertShowPlanTreeToExecutionPlanTree(x)).ToList(), - Edges = currentNode.Edges.Select(x => ConvertShowPlanEdgeToExecutionPlanEdge(x)).ToList(), + Children = currentNode.Children.Select(ConvertShowPlanTreeToExecutionPlanTree).ToList(), + Edges = currentNode.Edges.Select(ConvertShowPlanEdgeToExecutionPlanEdge).ToList(), Badges = GenerateNodeOverlay(currentNode), Name = currentNode.DisplayName, ElapsedTimeInMs = currentNode.ElapsedTimeInMs, diff --git a/src/Microsoft.SqlTools.ServiceLayer/LanguageServices/AutoCompleteHelper.cs b/src/Microsoft.SqlTools.ServiceLayer/LanguageServices/AutoCompleteHelper.cs index 1ef620d0..c6f14c49 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/LanguageServices/AutoCompleteHelper.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/LanguageServices/AutoCompleteHelper.cs @@ -597,7 +597,7 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices { if (currentList != null && token != null && !string.IsNullOrWhiteSpace(token.Text) && - token.Text.All(ch => char.IsLetter(ch)) && + token.Text.All(char.IsLetter) && currentList.All(x => string.Compare(x.Label, token.Text, true) != 0 )) { diff --git a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs index 14aff68d..88dde587 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs @@ -1,5 +1,5 @@ // WARNING: -// This file was generated by the Microsoft DataWarehouse String Resource Tool 6.0.0.0 +// This file was generated by the Microsoft DataWarehouse String Resource Tool 7.0.0.0 // from information in sr.strings // DO NOT MODIFY THIS FILE'S CONTENTS, THEY WILL BE OVERWRITTEN // diff --git a/src/Microsoft.SqlTools.ServiceLayer/Microsoft.SqlTools.ServiceLayer.csproj b/src/Microsoft.SqlTools.ServiceLayer/Microsoft.SqlTools.ServiceLayer.csproj index 3658ceed..9f9f154d 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Microsoft.SqlTools.ServiceLayer.csproj +++ b/src/Microsoft.SqlTools.ServiceLayer/Microsoft.SqlTools.ServiceLayer.csproj @@ -13,6 +13,10 @@ true true $(ToolsServiceTargetRuntimes) + $(NoWarn);SYSLIB1045 + $(NoWarn);CA1311 + $(NoWarn);CA1854 + $(NoWarn);CS8600;CS8603;CS8625 diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ObjectExplorerService.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ObjectExplorerService.cs index 81015fd1..835b4619 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ObjectExplorerService.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ObjectExplorerService.cs @@ -60,7 +60,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer public ObjectExplorerService() { sessionMap = new ConcurrentDictionary(); - applicableNodeChildFactories = new Lazy>>(() => PopulateFactories()); + applicableNodeChildFactories = new Lazy>>(PopulateFactories); NodePathGenerator.Initialize(); } diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoChildFactoryBase.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoChildFactoryBase.cs index 3e97a374..38f2d050 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoChildFactoryBase.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoChildFactoryBase.cs @@ -116,7 +116,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel return; } - IEnumerable queriers = context.ServiceProvider.GetServices(q => IsCompatibleQuerier(q)); + IEnumerable queriers = context.ServiceProvider.GetServices(IsCompatibleQuerier); var filters = this.Filters.ToList(); var smoProperties = this.SmoProperties.Where(p => ServerVersionHelper.IsValidFor(serverValidFor, p.ValidFor)).Select(x => x.Name); if (!string.IsNullOrEmpty(name)) diff --git a/src/Microsoft.SqlTools.ServiceLayer/TaskServices/SqlTask.cs b/src/Microsoft.SqlTools.ServiceLayer/TaskServices/SqlTask.cs index f1bf573d..5cefab0d 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/TaskServices/SqlTask.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/TaskServices/SqlTask.cs @@ -229,7 +229,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TaskServices //Run Task synchronously public void Run() { - Task.Run(() => RunAsync()); + Task.Run(RunAsync); } /// diff --git a/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/Microsoft.SqlTools.ServiceLayer.IntegrationTests.csproj b/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/Microsoft.SqlTools.ServiceLayer.IntegrationTests.csproj index e0333102..633eb693 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/Microsoft.SqlTools.ServiceLayer.IntegrationTests.csproj +++ b/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/Microsoft.SqlTools.ServiceLayer.IntegrationTests.csproj @@ -6,6 +6,12 @@ Microsoft.SqlTools.ServiceLayer.IntegrationTests true $(DefineConstants);TRACE + $(NoWarn);SYSLIB1045 + $(NoWarn);IDE0200 + $(NoWarn);IDE0230 + $(NoWarn);CA1311 + $(NoWarn);CA1852 + $(NoWarn);CA1854 diff --git a/test/Microsoft.SqlTools.ServiceLayer.Test.Common/ComparisonFailureException.cs b/test/Microsoft.SqlTools.ServiceLayer.Test.Common/ComparisonFailureException.cs index f9981550..aa569b1b 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.Test.Common/ComparisonFailureException.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.Test.Common/ComparisonFailureException.cs @@ -7,7 +7,7 @@ using System; namespace Microsoft.SqlTools.ServiceLayer.Test.Common { - internal class ComparisonFailureException : InvalidOperationException + internal sealed class ComparisonFailureException : InvalidOperationException { internal string FullMessageWithDiff { get; private set; } internal string EditAndCopyMessage { get; private set; } diff --git a/test/Microsoft.SqlTools.ServiceLayer.Test.Common/RequestContextMocking/EventFlowValidator.cs b/test/Microsoft.SqlTools.ServiceLayer.Test.Common/RequestContextMocking/EventFlowValidator.cs index 7de4732d..c7e18de0 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.Test.Common/RequestContextMocking/EventFlowValidator.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.Test.Common/RequestContextMocking/EventFlowValidator.cs @@ -178,14 +178,14 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.Common.RequestContextMocking Event } - private class ExpectedEvent + private sealed class ExpectedEvent { public EventTypes EventType { get; set; } public Type ParamType { get; set; } public Delegate Validator { get; set; } } - private class ReceivedEvent + private sealed class ReceivedEvent { public object EventObject { get; set; } public EventTypes EventType { get; set; } diff --git a/test/Microsoft.SqlTools.ServiceLayer.TestDriver/Driver/ServiceTestDriver.cs b/test/Microsoft.SqlTools.ServiceLayer.TestDriver/Driver/ServiceTestDriver.cs index 1b1c050c..95488416 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.TestDriver/Driver/ServiceTestDriver.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.TestDriver/Driver/ServiceTestDriver.cs @@ -43,7 +43,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TestDriver.Driver // Include a fallback value to for running tests within visual studio serviceHostExecutable = - @"..\..\..\..\..\src\Microsoft.SqlTools.ServiceLayer\bin\Debug\net6.0\win-x64\MicrosoftSqlToolsServiceLayer.exe"; + @"..\..\..\..\..\src\Microsoft.SqlTools.ServiceLayer\bin\Debug\net7.0\win-x64\MicrosoftSqlToolsServiceLayer.exe"; if (!File.Exists(serviceHostExecutable)) { serviceHostExecutable = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "MicrosoftSqlToolsServiceLayer.exe"); diff --git a/test/Microsoft.SqlTools.ServiceLayer.TestEnvConfig/Program.cs b/test/Microsoft.SqlTools.ServiceLayer.TestEnvConfig/Program.cs index 4c9d91f6..bf56dc50 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.TestEnvConfig/Program.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.TestEnvConfig/Program.cs @@ -11,7 +11,7 @@ using System.Collections.Generic; namespace Microsoft.SqlTools.ServiceLayer.TestEnvConfig { - class Program + sealed class Program { [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0210:Convert to top-level statements", Justification = "Structure retained for readability.")] static void Main(string[] args) diff --git a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/Microsoft.SqlTools.ServiceLayer.UnitTests.csproj b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/Microsoft.SqlTools.ServiceLayer.UnitTests.csproj index 99a5d237..d966df5b 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/Microsoft.SqlTools.ServiceLayer.UnitTests.csproj +++ b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/Microsoft.SqlTools.ServiceLayer.UnitTests.csproj @@ -6,6 +6,12 @@ false + $(NoWarn);SYSLIB1045 + $(NoWarn);IDE0200 + $(NoWarn);IDE0230 + $(NoWarn);CA1311 + $(NoWarn);CA1852 + $(NoWarn);CA1854