none
WPF: Exception has been thrown by the target of an invocation on user's computer RRS feed

  • Question

  • I'm trying to run my WPF application on my user's computer, but upon startup it gives the following error:

    An unhandled exception occurred

    Inner exception: Exception has been thrown by the target of an invocation.

    Stack trace:

    at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)

       at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)

       at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)

       at System.Activator.CreateInstance(Type type, Boolean nonPublic)

       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(Type type, Object[] args)

       at System.Xaml.Schema.SafeReflectionInvoker.CreateInstanceCritical(Type type, Object[] arguments)

       at System.Xaml.Schema.XamlTypeInvoker.CreateInstance(Object[] arguments)

       at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateInstance(XamlType xamlType, Object[] args)

       at System.Xaml.XamlObjectWriter.Logic_CreateAndAssignToParentStart(ObjectWriterContext ctx)

       at System.Xaml.XamlObjectWriter.WriteStartMember(XamlMember property)

       at System.Windows.Markup.WpfXamlLoader.TransformNodes(XamlReader xamlReader, XamlObjectWriter xamlWriter, Boolean onlyLoadOneNode, Boolean skipJournaledProperties, Boolean shouldPassLineNumberInfo, IXamlLineInfo xamlLineInfo, IXamlLineInfoConsumer xamlLineInfoConsumer, XamlContextStack`1 stack, IStyleConnector styleConnector)

       at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)

       at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)

       at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)

       at System.Windows.Application.LoadBamlStreamWithSyncInfo(Stream stream, ParserContext pc)

       at System.Windows.Application.LoadComponent(Uri resourceLocator, Boolean bSkipJournaledProperties)

       at System.Windows.Application.DoStartup()

       at System.Windows.Application.<.ctor>b__1(Object unused)

       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)

       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

    Why would this happen?  I've got no idea which line of code causes the error.  Everything works on my development computer.

    Tuesday, September 24, 2013 12:26 AM

Answers

  • Hi Amandz,

    Welcome to MSDN forum.

    It seems you have a “class not registered problem” with that COM component you’re calling on your user’s computer.

    If there's some COM component missing, the query into the registry with corresponding CLSID will fail. So we could use process monitor to monitor the application's activities towards the registry to figure out what CLSID of COM component is missing.

    http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx

    Hope useful to you.

    Best Regards,


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, September 25, 2013 1:11 AM
    Moderator

All replies

  • Hi Amandz,

    Welcome to MSDN forum.

    It seems you have a “class not registered problem” with that COM component you’re calling on your user’s computer.

    If there's some COM component missing, the query into the registry with corresponding CLSID will fail. So we could use process monitor to monitor the application's activities towards the registry to figure out what CLSID of COM component is missing.

    http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx

    Hope useful to you.

    Best Regards,


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, September 25, 2013 1:11 AM
    Moderator
  • Are you binding any object in you code? If yes, then I think some property is throwing an exception. That is because, by default binding uses reflection and during this process an object creation is getting failed. So, try wrapping all properties in try/catch (or the ones which are being used in XAML).

    I hope this helps.


    Please mark this post as answer if it solved your problem. Happy Programming!

    Tuesday, October 1, 2013 4:40 PM