diff --git a/eng/testing/tests.singlefile.targets b/eng/testing/tests.singlefile.targets
index 2252731eae8a0e08da67f9136a3d28731cd1d6d5..6bbbcc7834fd552409444e893792f1d6e1f59a91 100644
--- a/eng/testing/tests.singlefile.targets
+++ b/eng/testing/tests.singlefile.targets
@@ -29,7 +29,7 @@
$(CoreCLRAotSdkDir)
$(NetCoreAppCurrentTestHostSharedFrameworkPath)
$(NetCoreAppCurrentTestHostSharedFrameworkPath)
- $(NoWarn);IL1005;IL3002;IL3003
+ $(NoWarn);IL1005;IL3000;IL3001;IL3002;IL3003
partial
true
true
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 6e559385d27f88e1164b6c85c9e865066eeaf4c2..db0fdc4a645b4761e5e3c31e90d22b8460190282 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReflectionMethodBodyScanner.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReflectionMethodBodyScanner.cs
@@ -533,6 +533,27 @@ public override bool HandleCall(MethodIL callingMethodBody, MethodDesc calledMet
}
break;
+ //
+ // string System.Reflection.Assembly.Location getter
+ // string System.Reflection.AssemblyName.CodeBase getter
+ // string System.Reflection.AssemblyName.EscapedCodeBase getter
+ //
+ case IntrinsicId.Assembly_get_Location:
+ case IntrinsicId.AssemblyName_get_CodeBase:
+ case IntrinsicId.AssemblyName_get_EscapedCodeBase:
+ diagnosticContext.AddDiagnostic(DiagnosticId.AvoidAssemblyLocationInSingleFile, calledMethod.GetDisplayName());
+ break;
+
+ //
+ // string System.Reflection.Assembly.GetFile(string)
+ // string System.Reflection.Assembly.GetFiles()
+ // string System.Reflection.Assembly.GetFiles(bool)
+ //
+ case IntrinsicId.Assembly_GetFile:
+ case IntrinsicId.Assembly_GetFiles:
+ diagnosticContext.AddDiagnostic(DiagnosticId.AvoidAssemblyGetFilesInSingleFile, calledMethod.GetDisplayName());
+ break;
+
default:
throw new NotImplementedException("Unhandled intrinsic");
}
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCases/TestDatabase.cs b/src/coreclr/tools/aot/Mono.Linker.Tests/TestCases/TestDatabase.cs
index ec395f21795a357900daad44fa3e2f0d0e84e3f6..fc9b8f26650bc53c471e89489055f34c9df1466e 100644
--- a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCases/TestDatabase.cs
+++ b/src/coreclr/tools/aot/Mono.Linker.Tests/TestCases/TestDatabase.cs
@@ -44,6 +44,11 @@ public static IEnumerable