Skip to content

Commit 0af7be9

Browse files
Mitigate diagnostics DX0004, DX0010, DX0011 (#629)
1 parent a843f58 commit 0af7be9

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

net/DevExtreme.AspNet.Data.Tests/ResponseModelTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public void EmptyGroupSerialization() {
3333
#if NET4
3434
[Fact]
3535
public void JavaScriptSerializer() {
36+
#pragma warning disable DX0011 // this is assembly with tests, known serializer type
3637
var serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
3738

3839
var loadResultJson = serializer.Serialize(new LoadResult());
@@ -42,6 +43,7 @@ public void JavaScriptSerializer() {
4243
Assert.Contains("\"summary\":", loadResultJson);
4344

4445
var groupJson = serializer.Serialize(new Group());
46+
#pragma warning restore DX0011 // this is assembly with tests, known serializer type
4547
Assert.Contains("\"key\":", groupJson);
4648
Assert.Contains("\"items\":", groupJson);
4749
Assert.Contains("\"count\":", groupJson);

net/DevExtreme.AspNet.Data/Async/ReflectionAsyncAdapter.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ static class EF6Methods {
6464
public static readonly MethodInfo CountAsyncMethod;
6565
public static readonly MethodInfo ToListAsyncMethod;
6666
static EF6Methods() {
67+
#pragma warning disable DX0004 // known assembly and types
6768
var extensionsType = Type.GetType("System.Data.Entity.QueryableExtensions, EntityFramework");
69+
#pragma warning restore DX0004 // known assembly and types
6870
CountAsyncMethod = FindCountAsyncMethod(extensionsType);
6971
ToListAsyncMethod = FindToListAsyncMethod(extensionsType);
7072
}
@@ -74,7 +76,9 @@ static class EFCoreMethods {
7476
public static readonly MethodInfo CountAsyncMethod;
7577
public static readonly MethodInfo ToListAsyncMethod;
7678
static EFCoreMethods() {
79+
#pragma warning disable DX0004 // known assembly and types
7780
var extensionsType = Type.GetType("Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions, Microsoft.EntityFrameworkCore");
81+
#pragma warning restore DX0004 // known assembly and types
7882
CountAsyncMethod = FindCountAsyncMethod(extensionsType);
7983
ToListAsyncMethod = FindToListAsyncMethod(extensionsType);
8084
}
@@ -84,7 +88,9 @@ static class NHMethods {
8488
public static readonly MethodInfo CountAsyncMethod;
8589
public static readonly MethodInfo ToListAsyncMethod;
8690
static NHMethods() {
91+
#pragma warning disable DX0004 // known assembly and types
8792
var extensionsType = Type.GetType("NHibernate.Linq.LinqExtensionMethods, NHibernate");
93+
#pragma warning restore DX0004 // known assembly and types
8894
CountAsyncMethod = FindCountAsyncMethod(extensionsType);
8995
ToListAsyncMethod = FindToListAsyncMethod(extensionsType);
9096
}
@@ -95,7 +101,9 @@ static class XpoMethods {
95101
public static readonly MethodInfo ToArrayAsyncMethod;
96102
static XpoMethods() {
97103
var asm = Array.Find(AppDomain.CurrentDomain.GetAssemblies(), a => a.FullName.StartsWith("DevExpress.Xpo.v"));
104+
#pragma warning disable DX0004 // known assembly and types
98105
var extensionsType = asm.GetType("DevExpress.Xpo.XPQueryExtensions");
106+
#pragma warning restore DX0004 // known assembly and types
99107
CountAsyncMethod = FindCountAsyncMethod(extensionsType);
100108
ToArrayAsyncMethod = FindToArrayAsyncMethod(extensionsType);
101109
}

net/DevExtreme.AspNet.Data/QueryProviderInfo.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,16 @@ public QueryProviderInfo(IQueryProvider provider) {
3838
switch(providerAssembly.GetName().Name) {
3939
case "LinqKit.Microsoft.EntityFrameworkCore":
4040
IsEFCore = true;
41+
#pragma warning disable DX0010 // known assembly
4142
providerAssembly = Assembly.Load("Microsoft.EntityFrameworkCore");
43+
#pragma warning restore DX0010 // known assembly
4244
break;
4345

4446
case "LinqKit.EntityFramework":
4547
IsEFClassic = true;
48+
#pragma warning disable DX0010 // known assembly
4649
providerAssembly = Assembly.Load("EntityFramework");
50+
#pragma warning restore DX0010 // known assembly
4751
break;
4852
}
4953
}

net/DevExtreme.AspNet.Data/Types/DynamicClassBridge.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ static readonly MethodInfo
1616

1717
static DynamicClassBridge() {
1818
try {
19+
#pragma warning disable DX0010,DX0004 // known assembly and types
1920
var assembly = Assembly.Load("System.Linq.Dynamic.Core");
2021
FACTORY_TYPE = assembly.GetType("System.Linq.Dynamic.Core.DynamicClassFactory");
2122
CLASS_TYPE = assembly.GetType("System.Linq.Dynamic.Core.DynamicClass");
2223
PROP_TYPE = assembly.GetType("System.Linq.Dynamic.Core.DynamicProperty");
24+
#pragma warning restore DX0010,DX0004 // known assembly and types
2325
CREATE_TYPE_METHOD = FACTORY_TYPE.GetMethod("CreateType");
2426
INDEXER_METHOD = CLASS_TYPE.GetMethod("get_Item");
2527
} catch(FileNotFoundException x) {

0 commit comments

Comments
 (0)