[2020-02] Avoid following invalid pointers in mono_w32process_get_modules on Darwin...
[mono-project.git] / mono / tests / bug-36848.cs
blobf91447a553b4a62bbf7c8ccb057695ee55038cbb
1 // Load an interface from an invalid DLL and ensure the failure is clean.
2 // Notice this is very similar to bug-81673, except the interface is loaded
3 // through a transparent proxy instead of directly.
5 using System;
6 using System.Runtime.Remoting;
7 using System.Runtime.Remoting.Proxies;
8 using System.Runtime.Remoting.Messaging;
10 namespace Application
12 public class App
14 public static void Test ()
16 RemoteProxy remote2 = new RemoteProxy (typeof(App).Assembly.GetType("Application.Remote"));
17 remote2.GetTransparentProxy ();
20 public static int Main ()
22 int numCaught = 0;
24 for (int i = 0; i < 10; ++i) {
25 try {
26 Test ();
27 } catch (Exception) {
28 ++numCaught;
31 if (numCaught == 10)
32 return 0;
33 return 1;
37 class Remote : MarshalByRefObject, IMyInterface {
38 public void Run ()
43 class RemoteProxy : RealProxy {
44 public RemoteProxy (Type t) : base (t) {
48 public override IMessage Invoke (IMessage request) {
49 return null;