Index: src/Util/SystemInfo.cs =================================================================== --- src/Util/SystemInfo.cs (revision 1513305) +++ src/Util/SystemInfo.cs (working copy) @@ -453,6 +453,10 @@ { return "Global Assembly Cache"; } + if (myAssembly.IsDynamic) + { + return "Dynamic Assembly"; + } else { try Index: tests/src/Util/SystemInfoTest.cs =================================================================== --- tests/src/Util/SystemInfoTest.cs (revision 1513305) +++ tests/src/Util/SystemInfoTest.cs (working copy) @@ -31,7 +31,37 @@ [TestFixture] public class SystemInfoTest { + /// + /// It's "does not throw not supported exception" NOT + /// "returns 'Dynamic Assembly' string for dynamic assemblies" by purpose. + /// can be JITted and inlined in different release configurations, + /// thus we cannot determine what the exact result of this test will be. + /// In 'Debug' GetCallingAssembly should return dynamic assembly named: 'Anonymously Hosted DynamicMethods Assembly' + /// whereas in 'Release' this will be inlined and the result will be something like 'X:\Y\Z\log4net.Tests.dll'. + /// Therefore simple check against dynamic assembly + /// in to avoid 'Debug' release. + /// [Test] + public void TestAssemblyLocationInfoDoesNotThrowNotSupportedExceptionForDynamicAssembly() + { + var systemInfoAssemblyLocationMethod = GetAssemblyLocationInfoMethodCall(); + + Assert.DoesNotThrow(() => systemInfoAssemblyLocationMethod()); + } + + private static Func GetAssemblyLocationInfoMethodCall() + { + var method = typeof(SystemInfoTest).GetMethod("TestAssemblyLocationInfoMethod", new Type[0]); + var methodCall = Expression.Call(null, method, new Expression[0]); + return Expression.Lambda>(methodCall, new ParameterExpression[0]).Compile(); + } + + public static string TestAssemblyLocationInfoMethod() + { + return SystemInfo.AssemblyLocationInfo(Assembly.GetCallingAssembly()); + } + + [Test] public void TestGetTypeFromStringFullyQualified() { Type t; @@ -46,7 +76,7 @@ Assert.AreSame(typeof(SystemInfoTest), t, "Test explicit case in-sensitive type load lower"); } - [Test][Platform(Include="Win")] + [Test][Platform(Include="Win")] public void TestGetTypeFromStringCaseInsensitiveOnAssemblyName() { Type t;