File tree Expand file tree Collapse file tree 6 files changed +60
-2
lines changed
TestNFClassLibrary/TestNFClassLibrary Expand file tree Collapse file tree 6 files changed +60
-2
lines changed Original file line number Diff line number Diff line change @@ -41,9 +41,9 @@ public void DumpAssemblyTest()
4141 Assert . IsTrue ( dumpFileContent . Contains ( "TypeRefProps [01000001]: Scope: 23000001 'System.Diagnostics.DebuggableAttribute'" ) ) ;
4242 Assert . IsTrue ( dumpFileContent . Contains ( ": Scope: 23000002 'TestNFClassLibrary.ClassOnAnotherAssembly'" ) ) ;
4343
44- Assert . IsTrue ( dumpFileContent . Contains ( ": Flags: 00001001 Extends: 0100000d Enclosed: 02000000 'TestNFApp.DummyCustomAttribute1'" ) ) ;
44+ Assert . IsTrue ( dumpFileContent . Contains ( ": Flags: 00001001 Extends: 0100000f Enclosed: 02000000 'TestNFApp.DummyCustomAttribute1'" ) ) ;
4545
46- Assert . IsTrue ( dumpFileContent . Contains ( ": Flags: 00001001 Extends: 0100000d Enclosed: 02000000 'TestNFApp.DummyCustomAttribute2'" ) ) ;
46+ Assert . IsTrue ( dumpFileContent . Contains ( ": Flags: 00001001 Extends: 0100000f Enclosed: 02000000 'TestNFApp.DummyCustomAttribute2'" ) ) ;
4747
4848 Assert . IsTrue ( dumpFileContent . Contains ( ": Flags: 00001061 Extends: 01000000 Enclosed: 02000000 'TestNFApp.IOneClassOverAll'" ) ) ;
4949 Assert . IsTrue ( dumpFileContent . Contains ( ": Flags: 000007c6 Impl: 00000000 RVA: 00000000 'get_DummyProperty' [I4( )]" ) ) ;
Original file line number Diff line number Diff line change 55
66using System ;
77using System . Diagnostics ;
8+ using System . IO ;
89using System . Reflection ;
910using TestNFClassLibrary ;
1011
@@ -36,6 +37,26 @@ public static void Main()
3637 // Reflection Tests
3738 ReflectionTests ( ) ;
3839
40+ ////////////////////////////////////////////////
41+ // Test enum in another assembly, same namespace
42+ var enumTest = new TestEnumInAnotherAssembly ( ) ;
43+ enumTest . CallTestEnumInAnotherAssembly ( ) ;
44+
45+ /////////////////////////////////////
46+ // reference enum in another assembly
47+ var x = ( IAmAClassWithAnEnum . EnumA ) 1 ;
48+
49+ var messageType = ( IAmAClassWithAnEnum . EnumA ) 0 ;
50+ switch ( messageType )
51+ {
52+ case IAmAClassWithAnEnum . EnumA . Test :
53+ Console . WriteLine ( "all good" ) ;
54+ break ;
55+
56+ default :
57+ break ;
58+ }
59+
3960 Debug . WriteLine ( "Exiting TestNFApp" ) ;
4061 }
4162
Original file line number Diff line number Diff line change 1+ //
2+ // Copyright (c) .NET Foundation and Contributors
3+ // See LICENSE file in the project root for full license information.
4+ //
5+
6+ namespace System . IO
7+ {
8+ public class TestEnumInAnotherAssembly
9+ {
10+ public void CallTestEnumInAnotherAssembly ( )
11+ {
12+ // This test checks if MDP can minimize the assembly using an enum that is defined in another assembly
13+ // and the class calling it is in a different assembly BUT in the same namespace.
14+ var ioException = new IOException (
15+ string . Empty ,
16+ ( int ) IOException . IOExceptionErrorCode . DirectoryNotFound ) ;
17+ }
18+ }
19+
20+ }
Original file line number Diff line number Diff line change 2626 <Compile Include =" IOneClassOverAll.cs" />
2727 <Compile Include =" ComplexAttribute.cs" />
2828 <Compile Include =" MaxAttribute.cs" />
29+ <Compile Include =" TestEnumInAnotherAssembly.cs" />
2930 <Compile Include =" MyAttribute.cs" />
3031 <Compile Include =" MyClass1.cs" />
3132 <Compile Include =" OneClassOverAll.cs" />
Original file line number Diff line number Diff line change 1+ //
2+ // Copyright (c) .NET Foundation and Contributors
3+ // See LICENSE file in the project root for full license information.
4+ //
5+
6+ namespace TestNFClassLibrary
7+ {
8+ public class IAmAClassWithAnEnum
9+ {
10+ public enum EnumA
11+ {
12+ Test = 1
13+ }
14+ }
15+ }
Original file line number Diff line number Diff line change 1818 </PropertyGroup >
1919 <Import Project =" $(NanoFrameworkProjectSystemPath)NFProjectSystem.props" Condition =" Exists('$(NanoFrameworkProjectSystemPath)NFProjectSystem.props')" />
2020 <ItemGroup >
21+ <Compile Include =" IAmAClassWithAnEnum.cs" />
2122 <Compile Include =" ClassOnAnotherAssembly.cs" />
2223 <Compile Include =" Properties\AssemblyInfo.cs" />
2324 </ItemGroup >
You can’t perform that action at this time.
0 commit comments