Skip to content

Instantly share code, notes, and snippets.

@vladima
Created December 7, 2014 20:02
Show Gist options
  • Save vladima/13656a650d330da74951 to your computer and use it in GitHub Desktop.
Save vladima/13656a650d330da74951 to your computer and use it in GitHub Desktop.
using System;
using System.Windows.Forms;
namespace ConsoleApplication
{
class Program
{
[STAThread]
static void Main(string[] args)
{
var browser = new WebBrowser { ScriptErrorsSuppressed = true };
browser.Navigate("");
dynamic window = browser.Document.Window.DomWindow;
window.execScript("function foo() { }; foo.prototype.run = function() { return 10; };function bar() { return new foo(); }");
var z = ((dynamic)window.bar()).run(); // will crash here
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment