Watin error - Unable to cast COM object of type 'mshtml.HTMLDocumentClass' to interface type 'mshtml.DispHTMLDocument' - watin

I have been unable to solve this error in the WatiN.Core.IE constructor. This is WatiN 1.3, as I am using MvcContrib.TestHelper.WatiN which appears to depend on WatiN 1.3. This is on a Windows 7 64-bit machine. My colleague has the same configuration and is able to run our tests without this error.
TearDown : System.InvalidCastException : Unable to cast COM object of type 'mshtml.HTMLDocumentClass' to interface type 'mshtml.DispHTMLDocument'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{3050F55F-98B5-11CF-BB82-00AA00BDCE0B}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, ref MessageData msgData)
at mshtml.HTMLDocumentClass.get_readyState()
at WatiN.Core.WaitForComplete.WaitWhileDocumentStateNotComplete(IHTMLDocument2 htmlDocument)
at WatiN.Core.WaitForComplete.WaitForCompleteOrTimeout()
at WatiN.Core.IEWaitForComplete.DoWait()
at WatiN.Core.DomContainer.WaitForComplete(IWait waitForComplete)
at WatiN.Core.IE.WaitForComplete()
at WatiN.Core.IE.CreateNewIEAndGoToUri(Uri uri, LogonDialogHandler logonDialogHandler, Boolean createInNewProcess)
at WatiN.Core.IE..ctor()

Related

xunit cannot discover tests after upgrading to v2

After upgrading to xunit2 and following the migration guide (http://xunit.github.io/docs/test-migration.html), I get the following error when discovering tests in my projects:
------ Discover test started ------
[xUnit.net 00:00:00.0701819] Exception discovering tests from MyLibrary.Tests.dll: System.MissingMethodException: Constructor on type 'Xunit.Sdk.TestFrameworkProxy' not found.
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(String assemblyString, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)
at System.AppDomain.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at Xunit.RemoteAppDomainManager.CreateObject[TObject](String assemblyName, String typeName, Object[] args)
at Xunit.Xunit2Discoverer..ctor(ISourceInformationProvider sourceInformationProvider, IAssemblyInfo assemblyInfo, String assemblyFileName, String xunitExecutionAssemblyPath, String configFileName, Boolean shadowCopy, String shadowCopyFolder)
at Xunit.XunitFrontController.CreateInnerController()
at Xunit.XunitFrontController.get_InnerController()
at Xunit.Runner.VisualStudio.TestAdapter.VsTestRunner.DiscoverTests[TVisitor](IEnumerable`1 sources, IMessageLogger logger, Func`3 visitorFactory, Action`3 visitComplete, Stopwatch stopwatch)
========== Discover test finished: 0 found (0:00:00.2454142) ==========
I have no experience debugging testrunners or xunit, so I don't know where to look. I hope someone has encountered the problem before and can give a quick answer, but my google-fu shows nothing.
I don't know what information would be useful for tracking down this problem, so I'll add things as people ask for them.
From the test runner documentation: If you're having problems discovering or running tests, you may be a victim of a corrupted runner cache inside Visual Studio.
Deleting %TEMP%\VisualStudioTestExplorerExtensions seems to fix the issue.
Ref.: http://xunit.github.io/docs/running-tests-in-vs.html
Make sure you have installed both Xunit and Xunit.Runner.VisualStudio nuget packages

Type: System.Reflection.TargetInvocationException build in Unity 3D for Windows Store Apps

I am making a build in Unity 3D for Windows Store Apps, but encountered an Unhandled Exception. I haven't experienced such an exception earlier till date.
When running my game, I get a lot(!) of entries in the UnityPlayer.log like this:
Exception: Exception has been thrown by the target of an invocation.
Type: System.Reflection.TargetInvocationException
Module: mscorlib
InnerException: Object reference not set to an instance of an object.
AdditionalInfo:Invoking System.Collections.IEnumerator::MoveNext method with argument count: 0
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at WinRTBridge.MethodTools.InvokeMethod(Object instance, Int32 methodIndex, Object[] args)
(Filename: Line: 65)

Empty XElement in Descendants loop

I have a windows phone 7.1 app that tries to get data from a web service. The data is in XML format. Language is vb.net under Visual Studio 2010 with the Async CTP 3.
I have successfully retrieved the response from the web service and parsed the string into an XDocument. But I have problem when trying to populate a viewmodel by looping through the XML because the loop variable contains nothing (I want it to contain XElement):
Private Async Function GetMovies() As Task
Dim client As New WebClient
Dim address = (New Uri(New Uri(APIROOT), "movieschedule/movies")).ToString
Dim resulttxt = Await client.DownloadStringTaskAsync(address)
Dim resultdoc = XDocument.Parse(resulttxt)
Dim resultlist As New Collections.ObjectModel.ObservableCollection(Of Movies)
For Each movie In resultdoc.Descendants("movie")
' **the variable 'movie' contains nothing**
Dim m As New Movies With {
.Cast = movie.Attribute("cast").Value,
...
.Title = movie.Attribute("title").Value
}
resultlist.Add(m)
Next
Movies = resultlist
End Function
Example of XML from the web service:
<movies>
<movie code="MOV1299" title="Age of Heroes" is3D="0" genre="THRILLER" rating="D" cast="Sean Bean, Danny Dyer, Izabella Miko, James D'Arcy, Sebastian Street, William Houston" director="Adrian Vitoria" language="ENGLISH" subtitle="BAHASA INDONESIA" />
<movie code="MOV1325" title="Fast and Furious 5" is3D="0" genre="ACTION" rating="D" cast="Vin Diesel, Paul Walker, Dwayne Johnson, Jordana Brewster, Tyrese Gibson, Elsa Pataky" director="Justin Lin" language="ENGLISH" subtitle="BAHASA INDONESIA" />
</movies>
I have put a breakpoint on the line that creates new Movies. I can confirm variable resultdoc is populated. I tried in the immediate window resultdoc.Descendants("movie").Count returned 15. resultdoc.Descendants("movie").First.Attribute("code").Value correctly returned "MOV1299".
I got this error when I continued from the breakpoint:
System.NullReferenceException was unhandled
Message=NullReferenceException
StackTrace:
at MyApp.MainPageVM.VB$StateMachine_2_GetMovies.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.<>c__DisplayClass5.<OnCompletedInternal>b__1(Object state)
at System.Reflection.RuntimeMethodInfo.InternalInvoke(RuntimeMethodInfo rtmi, Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark)
at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, StackCrawlMark& stackMark)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at System.Delegate.DynamicInvokeOne(Object[] args)
at System.MulticastDelegate.DynamicInvokeImpl(Object[] args)
at System.Delegate.DynamicInvoke(Object[] args)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.Dispatch(DispatcherPriority priority)
at System.Windows.Threading.Dispatcher.OnInvoke(Object context)
at System.Windows.Hosting.CallbackCookie.Invoke(Object[] args)
at System.Windows.Hosting.DelegateWrapper.InternalInvoke(Object[] args)
at System.Windows.RuntimeHost.ManagedHost.InvokeDelegate(IntPtr pHandle, Int32 nParamCount, ScriptParam[] pParams, ScriptParam& pResult)
Why the variable movie contains nothing? How do I make it contain the proper XElement from resultdoc.Descendants("movie")?
[Copied down from the comment]
Go to the Exceptions dialog box (should be under the debug menu) and select to break when NullReferenceException is thrown. You will see exactly where the error is. What may be happening is that one of the XML nodes you are getting back from the server does not have a title or cast or one of the other attribute on them and you are dying on that

Interface not registered(0x80040155) when running Pex On Specific machine

Pex 0.94.0.0 Release Visual Studio 10.0.40219.1 Bug Report
How to reproduce:
Open a class library project
Create an empty method
Right Click->Run Pex
I run without problem on another machine (In Office, VS2010 Utimate)
But I got this exception on my home computer(VS2010 Professtional)
exception details:
System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'EnvDTE.DTE'.
This operation failed because the QueryInterface call on the COM component for the interface with IID
'{04A72314-32E9-48E2-9B87-A63603454F3E}') failed due to the following error: Interface not registered.
(Exception from HRESULT: 0x80040155)
at Microsoft.Pex.VsPackage.VsServiceProviderHelper.GetService[T](IServiceProvider serviceProvider)
at Microsoft.Pex.VsPackage.Helpers.ProjectHelper.SaveAllFiles(IServiceProvider serviceProvider)
at Microsoft.Pex.VsPackage.Actions.ActionComponent.SaveAll()
at Microsoft.Pex.VsPackage.Actions.ExplorationActionBase.InternalExecute()
at Microsoft.Pex.VsPackage.Actions.ActionComponent.Execute(Object target)
Current stacktrace
at Microsoft.Pex.VsPackage.Controls.ErrorReport.CreateReport(Exception ex)
at Microsoft.Pex.VsPackage.Controls.ErrorReport.<>c_DisplayClass4.b_3()
at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at Microsoft.Pex.VsPackage.Helpers.UIThreadInvoker.SafeMethodInvoker.Invoke()
at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
at System.Windows.Forms.Control.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.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
relevant environment variables:
COR_ENABLE_PROFILER=
COR_PROFILER=
PROCESSOR_ARCHITECTURE=x86
machine data:
processor count = 4
Turns out to be some weird registry problem
Reinstalling Windows can solve it

Unable to add user with CrmService API in Dynamics CRM

We have Dynamics CRM 4 update rollup 6 configured as an IFD and have set the UserRootPath using the deployment configuration tool. Adding users through the CRM interface works perfectly. However, when trying to add a user through the CrmService API, the user is not added and we get the trace message included below. Adding users through the CrmService API works if we remove the UserRootPath setting from the organization. The path appears to be correct, works within other LDAP tools, and the user is within the specified OU. We are using the path "LDAP://dcserver/OU=testorg;OU=Hosting;DC=domain;DC=local".
[2009-09-29 13:19:54.7] Process: w3wp |Organization:---- |Thread: 9 |Category: Platform.Sdk |User: ---- |Level: Error | CompositeSoapExtensionExceptionHandler.Handle
>CrmSoapExtension detected CrmException:
System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.DirectoryServices.DirectoryServicesCOMException (0x80072020): An operations error occurred.
at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_AdsObject()
at System.DirectoryServices.DirectorySearcher.FindAll(Boolean findMoreThanOne)
at System.DirectoryServices.DirectorySearcher.FindOne()
at Microsoft.Crm.ObjectModel.SystemUserServiceInternal`1.CheckUserUnderRootPath(String domainAccountName, ExecutionContext context)
at Microsoft.Crm.ObjectModel.SystemUserServiceInternal`1.CreateInternal(Guid organizationId, IBusinessEntity systemuser, ExecutionContext context)
at Microsoft.Crm.ObjectModel.SystemUserServiceInternal`1.Create(IBusinessEntity systemuser, ExecutionContext context)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Web.Services.Protocols.LogicalMethodInfo.Invoke(Object target, Object[] values)
at Microsoft.Crm.Extensibility.InternalOperationPlugin.Execute(IPluginExecutionContext context)
at Microsoft.Crm.Extensibility.PluginStep.Execute(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.Pipeline.Execute(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.MessageProcessor.Execute(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.InternalMessageDispatcher.Execute(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.ExternalMessageDispatcher.Execute(String messageName, Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, PropertyBag fields, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId)
at Microsoft.Crm.Sdk.RequestBase.Process(Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId)
at Microsoft.Crm.Sdk.RequestBase.Process(CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId)
at Microsoft.Crm.Sdk.CrmServiceInternal.Execute(RequestBase request, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId)
at Microsoft.Crm.Sdk.Crm2007.CrmService.Execute(Request request)
--- End of inner exception stack trace ---
The 0x80072020 error is related to a generic "Access Denied" in AD.
Depending on your configuration, you could try to pinpoint the issue by modifying the following:
1) Grant the "delegate" option to the application pool user using Active Directory Users and Computers.
2) Add a web.config to the MSCRMServices folder and turn impersonation on such as:
< identity impersonate="true" userName="mydomain\bob" password="builder" />

Resources