Last active
December 16, 2017 12:04
-
-
Save flq/f982de834bc990b5b11b320f221b478e to your computer and use it in GitHub Desktop.
Ye olde NRE from a ctor call
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.Remoting.Proxies; | |
internal class Program | |
{ | |
private static void Main(string[] args) | |
{ | |
var c = new CrazyObject(); | |
Console.WriteLine(c.Hello()); | |
Console.ReadLine(); | |
} | |
} | |
[Silly] | |
public class CrazyObject : ContextBoundObject | |
{ | |
public string Hello() => "Hello Back"; | |
} | |
public class SillyAttribute : ProxyAttribute | |
{ | |
public override MarshalByRefObject CreateInstance(Type serverType) => null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With many thanks to