@@ -29,15 +29,18 @@ public static void TestNativeCode()
29
29
[ Test ]
30
30
public static void TestMemoryMapping ( )
31
31
{
32
+ System . Console . WriteLine ( "TestMemoryMapping" ) ;
32
33
Assert . That ( ( ) => { var _ = TypeManager . CreateMemoryMapper ( ) ; } , Throws . Nothing ) ;
33
34
var mapper = TypeManager . CreateMemoryMapper ( ) ;
34
35
36
+ System . Console . WriteLine ( "TestMemoryMapping 1" ) ;
35
37
// Allocate a read-write page.
36
38
int len = 12 ;
37
39
var page = mapper . MapWriteable ( len ) ;
38
40
Assert . That ( ( ) => { Marshal . WriteInt64 ( page , 17 ) ; } , Throws . Nothing ) ;
39
41
Assert . That ( Marshal . ReadInt64 ( page ) , Is . EqualTo ( 17 ) ) ;
40
42
43
+ System . Console . WriteLine ( "TestMemoryMapping 2" ) ;
41
44
// Mark it read-execute. We can still read, haven't changed any values.
42
45
mapper . SetReadExec ( page , len ) ;
43
46
Assert . That ( Marshal . ReadInt64 ( page ) , Is . EqualTo ( 17 ) ) ;
@@ -54,10 +57,13 @@ public static void TestMemoryMapping()
54
57
// We can't use compiler flags because we compile with MONO_LINUX
55
58
// while running on the Microsoft .NET Core during continuous
56
59
// integration tests.
60
+ System . Console . WriteLine ( "TestMemoryMapping 3" ) ;
57
61
if ( System . Type . GetType ( "Mono.Runtime" ) != null )
58
62
{
59
63
// Mono throws NRE instead of AccessViolationException for some reason.
60
64
Assert . That ( ( ) => { Marshal . WriteInt64 ( page , 73 ) ; } , Throws . TypeOf < System . NullReferenceException > ( ) ) ;
65
+
66
+ System . Console . WriteLine ( "TestMemoryMapping 4" ) ;
61
67
Assert . That ( Marshal . ReadInt64 ( page ) , Is . EqualTo ( 17 ) ) ;
62
68
}
63
69
}
0 commit comments