diff --git a/Directory.Build.props b/Directory.Build.props
index 27589f30050..993806e6af3 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -55,6 +55,10 @@
$(NoWarn.Replace(';1591', ''))
+
+ moderate
+
+
diff --git a/benchmark/Directory.Build.props b/benchmark/Directory.Build.props
index acb8c8be1b6..2b1c507f4c6 100644
--- a/benchmark/Directory.Build.props
+++ b/benchmark/Directory.Build.props
@@ -3,6 +3,7 @@
$(MSBuildThisFileDirectory)..\rulesets\EFCore.test.ruleset
+ false
diff --git a/benchmark/EFCore.Sqlite.Benchmarks/EFCore.Sqlite.Benchmarks.csproj b/benchmark/EFCore.Sqlite.Benchmarks/EFCore.Sqlite.Benchmarks.csproj
index 2eb2534dfb2..5829a05d56f 100644
--- a/benchmark/EFCore.Sqlite.Benchmarks/EFCore.Sqlite.Benchmarks.csproj
+++ b/benchmark/EFCore.Sqlite.Benchmarks/EFCore.Sqlite.Benchmarks.csproj
@@ -16,10 +16,6 @@
-
-
-
-
Always
diff --git a/src/EFCore.Proxies/Proxies/Internal/LazyLoadingInterceptor.cs b/src/EFCore.Proxies/Proxies/Internal/LazyLoadingInterceptor.cs
index c955c62219b..e1137bfab67 100644
--- a/src/EFCore.Proxies/Proxies/Internal/LazyLoadingInterceptor.cs
+++ b/src/EFCore.Proxies/Proxies/Internal/LazyLoadingInterceptor.cs
@@ -57,7 +57,7 @@ public virtual void Intercept(IInvocation invocation)
}
else if (LazyLoaderSetter.Equals(invocation.Method))
{
- _loader = (ILazyLoader)invocation.Arguments[0];
+ _loader = (ILazyLoader)invocation.Arguments[0]!;
}
else
{
diff --git a/src/EFCore.Proxies/Proxies/Internal/PropertyChangeInterceptorBase.cs b/src/EFCore.Proxies/Proxies/Internal/PropertyChangeInterceptorBase.cs
index 393439441f3..076697bf2de 100644
--- a/src/EFCore.Proxies/Proxies/Internal/PropertyChangeInterceptorBase.cs
+++ b/src/EFCore.Proxies/Proxies/Internal/PropertyChangeInterceptorBase.cs
@@ -58,7 +58,7 @@ protected virtual string FindPropertyName(IInvocation invocation)
if (indexerPropertyInfo != null
&& indexerPropertyInfo.GetSetMethod(nonPublic: true) == invocation.Method)
{
- return (string)invocation.Arguments[0];
+ return (string)invocation.Arguments[0]!;
}
}
diff --git a/src/EFCore.Proxies/Proxies/Internal/PropertyChangedInterceptor.cs b/src/EFCore.Proxies/Proxies/Internal/PropertyChangedInterceptor.cs
index 45308ec2753..2429693109c 100644
--- a/src/EFCore.Proxies/Proxies/Internal/PropertyChangedInterceptor.cs
+++ b/src/EFCore.Proxies/Proxies/Internal/PropertyChangedInterceptor.cs
@@ -48,12 +48,12 @@ public virtual void Intercept(IInvocation invocation)
if (methodName == $"add_{nameof(INotifyPropertyChanged.PropertyChanged)}")
{
_handler = (PropertyChangedEventHandler)Delegate.Combine(
- _handler, (Delegate)invocation.Arguments[0]);
+ _handler, (Delegate)invocation.Arguments[0]!);
}
else if (methodName == $"remove_{nameof(INotifyPropertyChanged.PropertyChanged)}")
{
_handler = (PropertyChangedEventHandler?)Delegate.Remove(
- _handler, (Delegate)invocation.Arguments[0]);
+ _handler, (Delegate)invocation.Arguments[0]!);
}
}
else if (methodName.StartsWith("set_", StringComparison.Ordinal))
diff --git a/src/EFCore.Proxies/Proxies/Internal/PropertyChangingInterceptor.cs b/src/EFCore.Proxies/Proxies/Internal/PropertyChangingInterceptor.cs
index 26ba9d4b04c..8b5a8ed0a2c 100644
--- a/src/EFCore.Proxies/Proxies/Internal/PropertyChangingInterceptor.cs
+++ b/src/EFCore.Proxies/Proxies/Internal/PropertyChangingInterceptor.cs
@@ -48,12 +48,12 @@ public virtual void Intercept(IInvocation invocation)
if (methodName == $"add_{nameof(INotifyPropertyChanging.PropertyChanging)}")
{
_handler = (PropertyChangingEventHandler)Delegate.Combine(
- _handler, (Delegate)invocation.Arguments[0]);
+ _handler, (Delegate)invocation.Arguments[0]!);
}
else if (methodName == $"remove_{nameof(INotifyPropertyChanging.PropertyChanging)}")
{
_handler = (PropertyChangingEventHandler?)Delegate.Remove(
- _handler, (Delegate)invocation.Arguments[0]);
+ _handler, (Delegate)invocation.Arguments[0]!);
}
}
else if (methodName.StartsWith("set_", StringComparison.Ordinal))
diff --git a/src/ef/ef.csproj b/src/ef/ef.csproj
index 36f668682e5..54d4a068b22 100644
--- a/src/ef/ef.csproj
+++ b/src/ef/ef.csproj
@@ -30,6 +30,11 @@
+
+
+ $(NoWarn);NU1903
+
+
diff --git a/test/Directory.Build.props b/test/Directory.Build.props
index 68b58c1da11..e66d1c6474d 100644
--- a/test/Directory.Build.props
+++ b/test/Directory.Build.props
@@ -6,6 +6,7 @@
$(MSBuildThisFileDirectory)..\rulesets\EFCore.test.ruleset
preview
net9.0
+ false
diff --git a/test/EFCore.Cosmos.FunctionalTests/Query/PrimitiveCollectionsQueryCosmosTest.cs b/test/EFCore.Cosmos.FunctionalTests/Query/PrimitiveCollectionsQueryCosmosTest.cs
index ea203a234b2..010f466b93d 100644
--- a/test/EFCore.Cosmos.FunctionalTests/Query/PrimitiveCollectionsQueryCosmosTest.cs
+++ b/test/EFCore.Cosmos.FunctionalTests/Query/PrimitiveCollectionsQueryCosmosTest.cs
@@ -1553,11 +1553,11 @@ public override Task Parameter_collection_Concat_column_collection(bool async)
AssertSql(
"""
-@__ints_0='[11,111]'
+@__p_0='[11,111]'
SELECT VALUE c
FROM root c
-WHERE (ARRAY_LENGTH(ARRAY_CONCAT(@__ints_0, c["Ints"])) = 2)
+WHERE (ARRAY_LENGTH(ARRAY_CONCAT(@__p_0, c["Ints"])) = 2)
""");
});
diff --git a/test/EFCore.Specification.Tests/Query/NorthwindMiscellaneousQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/NorthwindMiscellaneousQueryTestBase.cs
index f0b8346fcb4..73ccb60482f 100644
--- a/test/EFCore.Specification.Tests/Query/NorthwindMiscellaneousQueryTestBase.cs
+++ b/test/EFCore.Specification.Tests/Query/NorthwindMiscellaneousQueryTestBase.cs
@@ -5802,7 +5802,7 @@ public virtual Task Contains_over_concatenated_parameter_and_constant(bool async
return AssertQuery(
async,
- ss => ss.Set().Where(c => data.Contains(someVariable + "SomeConstant")));
+ ss => ss.Set().Where(c => ((IEnumerable)data).Contains(someVariable + "SomeConstant")));
}
[ConditionalTheory]
diff --git a/test/EFCore.Specification.Tests/Query/PrimitiveCollectionsQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/PrimitiveCollectionsQueryTestBase.cs
index 60e7cd24697..1c07a0f4e71 100644
--- a/test/EFCore.Specification.Tests/Query/PrimitiveCollectionsQueryTestBase.cs
+++ b/test/EFCore.Specification.Tests/Query/PrimitiveCollectionsQueryTestBase.cs
@@ -945,7 +945,7 @@ public virtual Task Parameter_collection_Concat_column_collection(bool async)
return AssertQuery(
async,
- ss => ss.Set().Where(c => ints.Concat(c.Ints).Count() == 2));
+ ss => ss.Set().Where(c => ((IEnumerable)ints).Concat(c.Ints).Count() == 2));
}
[ConditionalTheory] // #33582
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServer160Test.cs b/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServer160Test.cs
index 9aea6357ba3..27b34379a4f 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServer160Test.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServer160Test.cs
@@ -1519,7 +1519,7 @@ public override async Task Parameter_collection_Concat_column_collection(bool as
AssertSql(
"""
-@__ints_0='[11,111]' (Size = 4000)
+@__p_0='[11,111]' (Size = 4000)
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings]
FROM [PrimitiveCollectionsEntity] AS [p]
@@ -1527,10 +1527,10 @@ FROM [PrimitiveCollectionsEntity] AS [p]
SELECT COUNT(*)
FROM (
SELECT 1 AS empty
- FROM OPENJSON(@__ints_0) AS [i]
+ FROM OPENJSON(@__p_0) AS [p0]
UNION ALL
SELECT 1 AS empty
- FROM OPENJSON([p].[Ints]) AS [i0]
+ FROM OPENJSON([p].[Ints]) AS [i]
) AS [u]) = 2
""");
}
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServerTest.cs
index 0708539aaa5..ae39035053e 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServerTest.cs
@@ -1542,7 +1542,7 @@ public override async Task Parameter_collection_Concat_column_collection(bool as
AssertSql(
"""
-@__ints_0='[11,111]' (Size = 4000)
+@__p_0='[11,111]' (Size = 4000)
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings]
FROM [PrimitiveCollectionsEntity] AS [p]
@@ -1550,10 +1550,10 @@ FROM [PrimitiveCollectionsEntity] AS [p]
SELECT COUNT(*)
FROM (
SELECT 1 AS empty
- FROM OPENJSON(@__ints_0) AS [i]
+ FROM OPENJSON(@__p_0) AS [p0]
UNION ALL
SELECT 1 AS empty
- FROM OPENJSON([p].[Ints]) AS [i0]
+ FROM OPENJSON([p].[Ints]) AS [i]
) AS [u]) = 2
""");
}
diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/PrimitiveCollectionsQuerySqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/PrimitiveCollectionsQuerySqliteTest.cs
index 58b6bb73a75..f9fa2065bdb 100644
--- a/test/EFCore.Sqlite.FunctionalTests/Query/PrimitiveCollectionsQuerySqliteTest.cs
+++ b/test/EFCore.Sqlite.FunctionalTests/Query/PrimitiveCollectionsQuerySqliteTest.cs
@@ -1501,7 +1501,7 @@ await Assert.ThrowsAsync(
AssertSql(
"""
-@__ints_0='[11,111]' (Size = 8)
+@__p_0='[11,111]' (Size = 8)
SELECT "p"."Id", "p"."Bool", "p"."Bools", "p"."DateTime", "p"."DateTimes", "p"."Enum", "p"."Enums", "p"."Int", "p"."Ints", "p"."NullableInt", "p"."NullableInts", "p"."NullableString", "p"."NullableStrings", "p"."String", "p"."Strings"
FROM "PrimitiveCollectionsEntity" AS "p"
@@ -1509,10 +1509,10 @@ await Assert.ThrowsAsync(
SELECT COUNT(*)
FROM (
SELECT 1
- FROM json_each(@__ints_0) AS "i"
+ FROM json_each(@__p_0) AS "p0"
UNION ALL
SELECT 1
- FROM json_each("p"."Ints") AS "i0"
+ FROM json_each("p"."Ints") AS "i"
) AS "u") = 2
""");
}