CslaDataProvider in csla 4 error - StackOverflowException

CslaDataProvider in csla 4 error - StackOverflowException

Old forum URL: forums.lhotka.net/forums/t/9845.aspx


JJLoubser posted on Thursday, December 09, 2010

we have manage to upgrade our big project from csla 3.8 to csla 4, but with this error in the xaml cslaAdapter binding:

- An unhandled exception of type 'System.StackOverflowException' occurred in Unknown Module.

the fetch to the Server works so the binding work. but there is a problem when the xaml start loading. What is it with the xaml?

*******************************************************************************************************************

Code-behind: 

 

protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {

            ////string userIP = App.Current.Resources["txtUserIP"].ToString();
            ////string userBrowser = App.Current.Resources["txtUserBrowser"].ToString();
            ////string userBrowserVersion = App.Current.Resources["txtUserBrowserVersion"].ToString();
            ////Business.LogActionTakenCO.LogActionTaken(e.Uri.ToString(), userIP, userBrowser, userBrowserVersion, (o, arg) => { });

            App.LogAction(e.Uri.ToString());

            ContentStackPanel.Visibility = Visibility.Collapsed;

            CslaDataProvider myCslaDataProvider = this.Resources["data"] as CslaDataProvider;

            myCslaDataProvider.FactoryParameters.Clear();

            string strId;

            if (this.NavigationContext.QueryString.ContainsKey("Id"))
            {
                strId = this.NavigationContext.QueryString["Id"];
            }
            else
            {
                strId = AppUser.Id.ToString();
            }

            int id = Int32.Parse(strId);

            myCslaDataProvider.FactoryParameters.Add(id);

            myCslaDataProvider.Refresh(); //call to Server work, but error in xaml - stack overflow, must be the CSLAadapter binding


            App.LogAction(e.Uri.ToString());

        }

 

 

 

*******************************************************************************************************************

xaml resources:

 

<navigation:Page x:Class="EcoBookings.Requestor.RequestorHome"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           xmlns:csla="clr-namespace:Csla.Silverlight;assembly=Csla" xmlns:cslaXaml="clr-namespace:Csla.Xaml;assembly=Csla.Xaml"
           xmlns:s="clr-namespace:System;assembly=mscorlib"
           xmlns:this="clr-namespace:EcoBookings"
           mc:Ignorable="d"
           xmlns:datagrid="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           xmlns:theming="clr-namespace:System.Windows.Controls.Theming;assembly=System.Windows.Controls.Theming.Toolkit"
           Title="Requestor Home"
           Style="{StaticResource PageStyle}"  VerticalAlignment="Top">
    <navigation:Page.Resources>
     <this:VisibilityConverter x:Key="VisibilityConverter" />
        <this:InvisibilityOnEmptyStringConverter x:Key="InvisibilityOnEmptyStringConverter" />
        <this:EditOrNewButtonConverter x:Key="EditOrNewButtonConverter" />
        <this:StringPipeSplitConverter x:Key="StringPipeSplitConverter" />
        <cslaXaml:ErrorDialog x:Key="DataErrorDialog"
                      DialogTitle="Error"
                      DialogFirstLine="An error has occurred:"
                      ShowExceptionDetail="False" />
        <cslaXaml:CslaDataProvider x:Key="data"
                           ObjectType="Business.RequestorInfoROR, Business"
                           ManageObjectLifetime="True"
                           FactoryMethod="GetRequestorInfoROR"
                           DataChanged="CslaDataProvider_DataChanged"
                           IsInitialLoadEnabled="False"
                           >
            <cslaXaml:CslaDataProvider.FactoryParameters>
                <s:Int32>1</s:Int32>
            </cslaXaml:CslaDataProvider.FactoryParameters>
        </cslaXaml:CslaDataProvider>

    </navigation:Page.Resources>

 

 

****************************************************************************************************************

JJLoubser replied on Wednesday, January 05, 2011

there was an error on one of the Autharasation read and write property methods that we created:

...

{

base.CanRead(propertyname)

 

}

...

we just change it a bit

Copyright (c) Marimer LLC