Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
The following code does throws an Exception when calling the Connect method in Silverlight
Dim comObject = System.Runtime.InteropServices.Automation.AutomationFactory.CreateObject("pfcls.pfcAsyncConnection")
Dim conn = comObject.Connect(Nothing, Nothing, Nothing, 1)
The Exception Info is
System.ArgumentException was caught
Message=Value does not fall within the expected range.
StackTrace:
at MS.Internal.ComAutomation.ComAutomationNative.CheckInvokeHResult(UInt32 hr, String memberName, String exceptionSource, String exceptionDescription, String exceptionHelpFile, UInt32 exceptionHelpContext)
at MS.Internal.ComAutomation.ComAutomationNative.Invoke(Boolean tryInvoke, String memberName, ComAutomationInvokeType invokeType, ComAutomationInteropValue[] rgParams, IntPtr nativePeer, ComAutomationInteropValue& returnValue)
at MS.Internal.ComAutomation.ComAutomationObject.InvokeImpl(Boolean tryInvoke, String name, ComAutomationInvokeType invokeType, Object& returnValue, Object[] args)
at MS.Internal.ComAutomation.ComAutomationObject.Invoke(String name, ComAutomationInvokeType invokeType, Object[] args)
at System.Runtime.InteropServices.Automation.AutomationMetaObjectProvider.TryInvokeMember(InvokeMemberBinder binder, Object[] args, Object& result)
at System.Runtime.InteropServices.Automation.AutomationMetaObjectProviderBase.<.cctor>b__4(Object obj, InvokeMemberBinder binder, Object[] args)
at CallSite.Target(Closure , CallSite , Object , Object& , Object& , Object& , Object& )
at CallSite.Target(Closure , CallSite , Object , Object& , Object& , Object& , Object& )
at Microsoft.VisualBasic.CompilerServices.IDOUtils.CreateRefCallSiteAndInvoke(CallSiteBinder Action, Object Instance, Object[] Arguments)
at Microsoft.VisualBasic.CompilerServices.IDOBinder.IDOGet(IDynamicMetaObjectProvider Instance, String MemberName, Object[] Arguments, String[] ArgumentNames, Boolean[] CopyBack)
at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack)
at SimpleSilverlightApplication.MainPage.OnConnectClick(Object sender, RoutedEventArgs e)
InnerException: MS.Internal.ComAutomation.ComAutomationObjectException
ErrorCode=-2147024809
Message=INVALID VARIANT TYPE
InnerException:
Meanwhile The following Almost Identical Code works in WPF
Dim comObject =comObject = Microsoft.VisualBasic.Interaction.CreateObject("pfcls.pfcAsyncConnection")
Dim conn = comObject.Connect(Nothing, Nothing, Nothing, 1)
Has anyone been able to connect to Pro/Engineer from a Silverlight Application and How?