I used NuGet to install the NHtmlUnit Pacakge (v2.15.0.0) into a MVC5 project using Visual Studio 2015.
var client = new WebClient(BrowserVersion.CHROME);
I've also tried without specifying a browser and with IE11.
Here are the exceptions details:
System.MissingMethodException occurred
HResult=-2146233069
Message=Method not found: 'Void java.util.HashMap.__<clinit>()'.
Source=HtmlUnit
StackTrace:
at com.gargoylesoftware.htmlunit.Cache..ctor()
at com.gargoylesoftware.htmlunit.WebClient..ctor(BrowserVersion browserVersion)
InnerException:
Here is what the debugger says about the NHtmlUnit and IKVM.OpenJDK.Util.dll .dlls:
Name=NHtmlUnit.dll
Path=C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\ef1fc9af\43f83bfb\assembly\dl3\362bd10d\0ab5a1ee_d0e5d001\NHtmlUnit.dll
Optimized=Yes
User Code=N/A
Symbol File=Cannot find or open the PDB file.
Order=109
Version=2.15.0.0
Timestamp=7/11/2014 1:23 AM
Address=0F6E0000-0F754000
Process=[13336] iisexpress.exe
AppDomain=[2] /LM/W3SVC/2/ROOT-1-130857754150438760
Name=IKVM.OpenJDK.Util.dll
Path=C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\ef1fc9af\43f83bfb\assembly\dl3\7fc27125\b1c29ef9_d0e5d001\IKVM.OpenJDK.Util.dll
Optimized=Yes
User Code=N/A
Symbol Status:
Binary was not built with debug information.
Order 66
Version=8.01.5717.0
Timestamp=12/31/1969 5:00 PM
Address=0E9D0000-0EAC4000
Process=[13336] iisexpress.exe
AppDomain=[2] /LM/W3SVC/2/ROOT-1-130857754150438760
This feels a whole lot like a .net module version mismatch but the only place I have any reference to or have ever used any NHtmlUnit or IKVM dlls is in the project (and it reproduces on a clean machine as well). Any thoughts on approaches to diagnosing this?