dzharii / swd-recorder

Selenium WebDriver Page Recorder (Page Objects)
MIT License
189 stars 71 forks source link

Unhandled exception is thrown while using Chrome #8

Closed upgundecha closed 11 years ago

upgundecha commented 11 years ago

I'm running SWD Page Recorder on Windows 7 and Chromedriver.exe is copied in C:\ChromeDriver\ (added to PATH)

When I select Chrome from the Browser list on Browser Settings tab and click on Start button, I see following exception

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Reflection.CustomAttributeFormatException: 'NullValueHandling' property specified was not found. ---> System.Reflection.CustomAttributeFormatException: 'NullValueHandling' property specified was not found.
   at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
   --- End of inner exception stack trace ---
   at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
   at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimePropertyInfo property, RuntimeType caType)
   at System.Reflection.RuntimePropertyInfo.GetCustomAttributes(Type attributeType, Boolean inherit)
   at System.Attribute.InternalGetCustomAttributes(PropertyInfo element, Type type, Boolean inherit)
   at System.Attribute.GetCustomAttributes(MemberInfo element, Type type, Boolean inherit)
   at Newtonsoft.Json.Utilities.WebDriver307921.ReflectionUtils.GetAttributes[T](ICustomAttributeProvider attributeProvider, Boolean inherit) in :line 0
   at Newtonsoft.Json.Utilities.WebDriver307921.ReflectionUtils.GetAttribute[T](ICustomAttributeProvider attributeProvider, Boolean inherit) in :line 0
   at Newtonsoft.Json.Serialization.WebDriver307921.JsonTypeReflector.GetAttribute[T](MemberInfo memberInfo) in :line 0
   at Newtonsoft.Json.Serialization.WebDriver307921.JsonTypeReflector.GetAttribute[T](ICustomAttributeProvider attributeProvider) in :line 0
   at Newtonsoft.Json.Serialization.WebDriver307921.DefaultContractResolver.SetPropertySettingsFromAttributes(WebDriver307921.JsonProperty property, ICustomAttributeProvider attributeProvider, String name, Type declaringType, WebDriver307921.MemberSerialization memberSerialization, Boolean& allowNonPublicAccess) in :line 0
   at Newtonsoft.Json.Serialization.WebDriver307921.DefaultContractResolver.CreateProperty(MemberInfo member, WebDriver307921.MemberSerialization memberSerialization) in :line 0
   at Newtonsoft.Json.Serialization.WebDriver307921.DefaultContractResolver.CreateProperties(Type type, WebDriver307921.MemberSerialization memberSerialization) in :line 0
   at Newtonsoft.Json.Serialization.WebDriver307921.DefaultContractResolver.CreateObjectContract(Type objectType) in :line 0
   at Newtonsoft.Json.Serialization.WebDriver307921.DefaultContractResolver.CreateContract(Type objectType) in :line 0
   at Newtonsoft.Json.Serialization.WebDriver307921.DefaultContractResolver.ResolveContract(Type type) in :line 0
   at Newtonsoft.Json.Serialization.WebDriver307921.JsonSerializerInternalWriter.GetContractSafe(Object value) in :line 0
   at Newtonsoft.Json.Serialization.WebDriver307921.JsonSerializerInternalWriter.Serialize(WebDriver307921.JsonWriter jsonWriter, Object value) in :line 0
   at Newtonsoft.Json.WebDriver307921.JsonSerializer.SerializeInternal(WebDriver307921.JsonWriter jsonWriter, Object value) in :line 0
   at Newtonsoft.Json.WebDriver307921.JsonSerializer.Serialize(WebDriver307921.JsonWriter jsonWriter, Object value) in :line 0
   at Newtonsoft.Json.WebDriver307921.JsonConvert.SerializeObject(Object value, WebDriver307921.Formatting formatting, WebDriver307921.JsonSerializerSettings settings) in :line 0
   at Newtonsoft.Json.WebDriver307921.JsonConvert.SerializeObject(Object value, WebDriver307921.Formatting formatting, WebDriver307921.JsonConverter[] converters) in :line 0
   at Newtonsoft.Json.WebDriver307921.JsonConvert.SerializeObject(Object value, WebDriver307921.JsonConverter[] converters) in :line 0
   at OpenQA.Selenium.Remote.DesiredCapabilitiesJsonConverter.WriteJson(WebDriver307921.JsonWriter writer, Object value, WebDriver307921.JsonSerializer serializer) in :line 0
   at Newtonsoft.Json.Serialization.WebDriver307921.JsonSerializerInternalWriter.SerializeConvertable(WebDriver307921.JsonWriter writer, WebDriver307921.JsonConverter converter, Object value, WebDriver307921.JsonContract contract, WebDriver307921.JsonContainerContract collectionContract, WebDriver307921.JsonProperty containerProperty) in :line 0
   at Newtonsoft.Json.Serialization.WebDriver307921.JsonSerializerInternalWriter.SerializeValue(WebDriver307921.JsonWriter writer, Object value, WebDriver307921.JsonContract valueContract, WebDriver307921.JsonProperty member, WebDriver307921.JsonContainerContract containerContract, WebDriver307921.JsonProperty containerProperty) in :line 0
   at Newtonsoft.Json.Serialization.WebDriver307921.JsonSerializerInternalWriter.SerializeDictionary(WebDriver307921.JsonWriter writer, WebDriver307921.IWrappedDictionary values, WebDriver307921.JsonDictionaryContract contract, WebDriver307921.JsonProperty member, WebDriver307921.JsonContainerContract collectionContract, WebDriver307921.JsonProperty containerProperty) in :line 0
   at Newtonsoft.Json.Serialization.WebDriver307921.JsonSerializerInternalWriter.SerializeValue(WebDriver307921.JsonWriter writer, Object value, WebDriver307921.JsonContract valueContract, WebDriver307921.JsonProperty member, WebDriver307921.JsonContainerContract containerContract, WebDriver307921.JsonProperty containerProperty) in :line 0
   at Newtonsoft.Json.Serialization.WebDriver307921.JsonSerializerInternalWriter.Serialize(WebDriver307921.JsonWriter jsonWriter, Object value) in :line 0
   at Newtonsoft.Json.WebDriver307921.JsonSerializer.SerializeInternal(WebDriver307921.JsonWriter jsonWriter, Object value) in :line 0
   at Newtonsoft.Json.WebDriver307921.JsonSerializer.Serialize(WebDriver307921.JsonWriter jsonWriter, Object value) in :line 0
   at Newtonsoft.Json.WebDriver307921.JsonConvert.SerializeObject(Object value, WebDriver307921.Formatting formatting, WebDriver307921.JsonSerializerSettings settings) in :line 0
   at Newtonsoft.Json.WebDriver307921.JsonConvert.SerializeObject(Object value, WebDriver307921.Formatting formatting, WebDriver307921.JsonConverter[] converters) in :line 0
   at Newtonsoft.Json.WebDriver307921.JsonConvert.SerializeObject(Object value, WebDriver307921.JsonConverter[] converters) in :line 0
   at OpenQA.Selenium.Remote.Command.get_ParametersAsJsonString() in :line 0
   at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute) in :line 0
   at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute) in :line 0
   at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) in :line 0
   at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities) in :line 0
   at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities) in :line 0
   at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeDriverService service, ChromeOptions options, TimeSpan commandTimeout) in :line 0
   at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeOptions options) in :line 0
   at OpenQA.Selenium.Chrome.ChromeDriver..ctor() in :line 0
   at SwdPageRecorder.WebDriver.SwdBrowserUtils.WebDriverUtils.StartEmbededWebDriver(WebDriverOptions browserOptions) in d:\projects_current\swd-recorder\SwdPageRecorder\SwdPageRecorder.WebDriver\SwdBrowserUtils\WebDriverUtils.cs:line 97
   at SwdPageRecorder.WebDriver.SwdBrowserUtils.WebDriverUtils.Initialize(WebDriverOptions browserOptions, Boolean& isRemote) in d:\projects_current\swd-recorder\SwdPageRecorder\SwdPageRecorder.WebDriver\SwdBrowserUtils\WebDriverUtils.cs:line 35
   at SwdPageRecorder.WebDriver.SwdBrowser.Initialize(WebDriverOptions browserOptions) in d:\projects_current\swd-recorder\SwdPageRecorder\SwdPageRecorder.WebDriver\SwdBrowser.cs:line 63
   at SwdPageRecorder.UI.BrowserSettingsTabPresenter.StartDriver(WebDriverOptions browserOptions) in d:\projects_current\swd-recorder\SwdPageRecorder\SwdPageRecorder.UI\SwdMain\Tabs\Presenters\BrowserSettingsTabPresenter.cs:line 80
   at SwdPageRecorder.UI.BrowserSettingsTabPresenter.StartNewBrowser(WebDriverOptions browserOptions) in d:\projects_current\swd-recorder\SwdPageRecorder\SwdPageRecorder.UI\SwdMain\Tabs\Presenters\BrowserSettingsTabPresenter.cs:line 65
   at SwdPageRecorder.UI.BrowserSettingsTabView.btnStartWebDriver_Click(Object sender, EventArgs e) in d:\projects_current\swd-recorder\SwdPageRecorder\SwdPageRecorder.UI\SwdMain\Tabs\BrowserSettingsTabView.cs:line 51
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1008 (RTMGDR.030319-1000)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
SwdPageRecorder
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Users/unmesh.gundecha/Downloads/SwdPageRecorder_Latest/SwdPageRecorder_Latest/SwdPageRecorder.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1002 built by: RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1001 built by: RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1001 built by: RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.233 built by: RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1015 (RTMGDR.030319-1000)
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1015 built by: RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.ComponentModel.DataAnnotations
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.ComponentModel.DataAnnotations/v4.0_4.0.0.0__31bf3856ad364e35/System.ComponentModel.DataAnnotations.dll
----------------------------------------
System.Runtime.Serialization
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Serialization/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Serialization.dll
----------------------------------------
System.Xml.Linq
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml.Linq/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.Linq.dll
----------------------------------------
System.Data
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.237 (RTMGDR.030319-2300)
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
upgundecha commented 11 years ago

I can see this already reported (in Russian)

dzharii commented 11 years ago

Thank you so much @upgundecha , You found an amazing bug.
The problem was in ILmerge utility I am using to merge a dozen .dll files into a single executable. In fact, Webdriver also uses this utility for such purpose. Looks like merging merged files had introduced this issue.
Please, try the updated build, I hope I’ve fixed the issue Latest: http://goo.gl/76k6I

upgundecha commented 11 years ago

Thanks @dzhariy this works perfect now!

mattbrailsford commented 5 years ago

Looks like merging merged files had introduced this issue.

@dzharii I know this was a while ago, but could you explain what the issue was and how you resolved it? I have the same issue in a project which is using ILMerge to merge in JSON.NET

dzharii commented 5 years ago

Hi @mattbrailsford, I remember, once I have excluded WebDriver.dll -- this solved the merge issue. My plan was to experiment with each dependency, excluding one from ILMerge and shiping it as is. The first or second try was WebDriver.dll... and that solved the issue.

dzharii commented 5 years ago

@mattbrailsford now I think this is beacuse WebDriver.dll was bundled with ILMerge and it also had JSON.net as a dependency, and a different version. This project, SWD recorder, also uses JSON.net, this could cause dependency conflict

mattbrailsford commented 5 years ago

Thanks @dzharii Appreciate you providing the extra context. 👍