Make nullable warnings a per file opt-in (#1842)

* Make nullable warnings a per file opt-in

* Remove unneeded compiler directives

* Remove compiler directive for User Data
This commit is contained in:
Karl Burtram
2023-02-03 18:10:07 -08:00
committed by GitHub
parent 735517a503
commit f288bee294
1020 changed files with 2299 additions and 273 deletions

View File

@@ -3,6 +3,8 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
#nullable disable
using System.Threading.Tasks;
using Microsoft.SqlTools.ServiceLayer.Connection;
using Microsoft.SqlTools.ServiceLayer.QueryExecution;

View File

@@ -3,6 +3,8 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
#nullable disable
using System;
using System.Threading.Tasks;
using Microsoft.SqlTools.ServiceLayer.QueryExecution;

View File

@@ -3,6 +3,8 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
#nullable disable
using System;
using System.IO;
using System.Linq;

View File

@@ -3,6 +3,8 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
#nullable disable
using System;
using System.Collections.Generic;
using System.IO;

View File

@@ -3,6 +3,8 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
#nullable disable
using System;
using System.Collections.Generic;
using System.IO;

View File

@@ -3,6 +3,8 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
#nullable disable
using System;
using System.IO;
using System.Text;

View File

@@ -3,6 +3,8 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
#nullable disable
using System;
using System.Collections.Generic;
using System.Data.SqlTypes;
@@ -157,10 +159,10 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.DataStorage
public void Int16([Values(
0,
10,
-10,
short.MaxValue, // Two byte number
0,
10,
-10,
short.MaxValue, // Two byte number
short.MinValue // Negative two byte number
)] short value)
{
@@ -169,10 +171,10 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.DataStorage
[Test]
public void Int32([Values(
0,
10,
-10,
short.MaxValue, // Two byte number
0,
10,
-10,
short.MaxValue, // Two byte number
short.MinValue, // Negative two byte number
int.MaxValue, // Four byte number
int.MinValue // Negative four byte number
@@ -183,10 +185,10 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.DataStorage
[Test]
public void Int64([Values(
0,
10,
-10,
short.MaxValue, // Two byte number
0,
10,
-10,
short.MaxValue, // Two byte number
short.MinValue, // Negative two byte number
int.MaxValue, // Four byte number
int.MinValue, // Negative four byte number
@@ -236,12 +238,12 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.DataStorage
[Test]
public void Single([Values(
0,
10.1F,
-10.1F,
float.MinValue,
float.MaxValue,
float.PositiveInfinity,
0,
10.1F,
-10.1F,
float.MinValue,
float.MaxValue,
float.PositiveInfinity,
float.NegativeInfinity
)] float value)
{
@@ -250,16 +252,16 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.DataStorage
[Test]
public void Double([Values(
0,
10.1,
-10.1,
float.MinValue,
float.MaxValue,
float.PositiveInfinity,
0,
10.1,
-10.1,
float.MinValue,
float.MaxValue,
float.PositiveInfinity,
float.NegativeInfinity,
double.PositiveInfinity,
double.NegativeInfinity,
double.MinValue,
double.PositiveInfinity,
double.NegativeInfinity,
double.MinValue,
double.MaxValue
)]double value)
{
@@ -577,11 +579,11 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.DataStorage
[Test]
public void GuidTest()
{
foreach (var testValue in GuidTestParameters)
{
VerifyReadWrite(testValue.ToByteArray().Length + 1, testValue,
(writer, val) => writer.WriteGuid(testValue),
(reader, rowId) => reader.ReadGuid(0, rowId));
foreach (var testValue in GuidTestParameters)
{
VerifyReadWrite(testValue.ToByteArray().Length + 1, testValue,
(writer, val) => writer.WriteGuid(testValue),
(reader, rowId) => reader.ReadGuid(0, rowId));
}
}

View File

@@ -3,6 +3,8 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
#nullable disable
using System;
using Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts;
using NUnit.Framework;

View File

@@ -3,6 +3,8 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
#nullable disable
using System.Threading.Tasks;
using Microsoft.SqlTools.ServiceLayer.QueryExecution;
using Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts;

View File

@@ -3,6 +3,8 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
#nullable disable
using System;
using System.Collections.Generic;
using System.Data;

View File

@@ -3,6 +3,8 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
#nullable disable
using System.Data.Common;
using Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts;
using NUnit.Framework;

View File

@@ -3,6 +3,8 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
#nullable disable
using System;
using System.Collections.Generic;
using System.Linq;

View File

@@ -3,6 +3,8 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
#nullable disable
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;

View File

@@ -3,6 +3,8 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
#nullable disable
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;

View File

@@ -3,6 +3,8 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
#nullable disable
using System;
using System.Linq;
using System.Threading.Tasks;

View File

@@ -3,6 +3,8 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
#nullable disable
using System;
using System.Collections.Generic;
using System.Data.Common;

View File

@@ -3,6 +3,8 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
#nullable disable
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;

View File

@@ -3,6 +3,8 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
#nullable disable
using Microsoft.SqlTools.Hosting.Protocol;
using Microsoft.SqlTools.ServiceLayer.QueryExecution;
using Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts;

View File

@@ -3,6 +3,8 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
#nullable disable
using Microsoft.SqlTools.ServiceLayer.QueryExecution;
using NUnit.Framework;

View File

@@ -3,6 +3,8 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
#nullable disable
using System;
using System.Linq;
using System.Threading.Tasks;
@@ -19,11 +21,11 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution
{
#region ResultSet Class Tests
static private readonly object[] validSet =
{
static private readonly object[] validSet =
{
new object[] {0, 2 },
new object[] {0, 20 },
new object[] {1, 2 },
new object[] {1, 2 },
};
[Test, TestCaseSource(nameof(validSet))]
@@ -46,14 +48,14 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution
Assert.AreEqual(Math.Min(rowCount, Common.StandardRows), subset.Rows.Length);
}
static private readonly object[] invalidSet =
static private readonly object[] invalidSet =
{
new object[] {-1, 2}, // Invalid start index, too low
new object[] {10, 2}, // Invalid start index, too high
new object[] {0, -1}, // Invalid row count, too low
new object[] {0, 0 }, // Invalid row count, zero
new object[] {0, 0 }, // Invalid row count, zero
};
[Test, TestCaseSource(nameof(invalidSet))]
[Test, TestCaseSource(nameof(invalidSet))]
public void ResultSetInvalidParmsTest(int rowStartIndex, int rowCount)
{
// If:
@@ -163,7 +165,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution
var workspaceService = Common.GetPrimedWorkspaceService(Constants.StandardQuery);
var queryService = Common.GetPrimedExecutionService(null, true, false, false, workspaceService);
var subsetParams = new SubsetParams { OwnerUri = Constants.OwnerUri, RowsCount = 1, ResultSetIndex = 0, RowsStartIndex = 0 };
var contextMock = RequestContextMocks.Create<SubsetResult>(null);
var contextMock = RequestContextMocks.Create<SubsetResult>(null);
Assert.ThrowsAsync<ArgumentOutOfRangeException>(() => queryService.HandleResultSubsetRequest(subsetParams, contextMock.Object));
}
@@ -202,7 +204,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution
// ... And I then ask for a set of results from it
var subsetParams = new SubsetParams { OwnerUri = Constants.OwnerUri, RowsCount = 1, ResultSetIndex = 0, RowsStartIndex = 0 };
var contextMock = RequestContextMocks.Create<SubsetResult>(null);
var contextMock = RequestContextMocks.Create<SubsetResult>(null);
Assert.ThrowsAsync<ArgumentOutOfRangeException>(() => queryService.HandleResultSubsetRequest(subsetParams, contextMock.Object));
}