Initialization of WPF application throwing an exception

Yanıt Initialization of WPF application throwing an exception

  • 07 Temmuz 2012 Cumartesi 06:00
     
     

    When i was trying to run an application on a remote machine im getting an exception like this,

    'Initialization of 'TestWpf.MainWindow' threw an exception.' Line number '8' and line position '817'.
    System.InvalidOperationException: Cannot have nested BeginInit calls on the same instance.
       at System.Windows.FrameworkElement.BeginInit()
       at MS.Internal.Xaml.Runtime.ClrObjectRuntime.InitializationGuard(XamlType xamlType, Object obj, Boolean begin)
    PresentationFramework
       at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
       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)
    System.Collections.ListDictionaryInternal

    It works perfectly on local machines.I checked framework components and it has .net 4 framework client profile on remote machines. 

    Any help appreciate.Thanks.

Tüm Yanıtlar

  • 07 Temmuz 2012 Cumartesi 18:33
     
     

    If application is on remote computer then probably error is because you don't have permission.

    http://social.msdn.microsoft.com/Forums/en/wpf/thread/a88a8186-3d83-4be7-a359-faa5d7deb2dd

    Following link should help you with steps to set permissions

    http://msdn.microsoft.com/en-us/library/33tceax8.aspx


    Gaurav Khanna | Microsoft VB.NET MVP

  • 10 Temmuz 2012 Salı 06:07
    Moderatör
     
     

    Hi sharon 5656,

    have you tried Khanna's suggestion that set the permissions, how about your issue now?

    best regards,


    Sheldon _Xiao[MSFT]
    MSDN Community Support | Feedback to us
    Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • 10 Temmuz 2012 Salı 06:56
     
     
    Hi Sharon, Please run the application in full trust. this you can set using ProjectProperties >> Security >> This is full trust applciation.

    Regards, http://shwetamannjain.blogspot.com or https://shwetalodha.wordpress.com/

  • 12 Temmuz 2012 Perşembe 06:01
     
     
    Im still getting the same initialization error...this is my first wpf application.Is there anything im missing in terms of wpf experience..? Any help appreciate..
  • 12 Temmuz 2012 Perşembe 06:24
     
     Yanıt

    Looks to me like it could be a XAML problem. For example, this thread mentions the same error when having 2 DatePickers controls bound to the same readonly property - https://wpf.codeplex.com/discussions/51024/ 


  • 12 Temmuz 2012 Perşembe 11:01
     
     

    you are right.its because of XAML problem.Getting an error from this line

     xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"

    Any help please..

  • 12 Temmuz 2012 Perşembe 14:03
     
     Yanıt

    you are right.its because of XAML problem.Getting an error from this line

     xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"

    Any help please..

    Add reference to DevExpress.Xpf.Grid.v12.1.dll in your project. If already added then remove it and then add it again.

    http://documentation.devexpress.com/#WPF/CustomDocument7385

    Also include above dll with exe when you run the application on remote computer (i.e. check on remot computer, folder containing exe file has above dll)


    Gaurav Khanna | Microsoft VB.NET MVP


  • 20 Temmuz 2012 Cuma 07:50
    Moderatör
     
     

    Hi sharon 5656,
     
    I am marking your issue as "Answered", if you have new findings about your issue, please let me know.


    Best regards,


    Sheldon _Xiao[MSFT]
    MSDN Community Support | Feedback to us
    Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.