I am making progress in getting a prototype of my application to use Silverlight and am basing it on the Rolodex example, but it is a slow process :(. Currently I am getting a type initializer error after I go into the login screen and get to the following code:
BASIdentity.GetIdentity(username, password, (o, e) =>
{
if (e.Object == null)
{
SetPrincipal(BASIdentity.UnauthenticatedIdentity());
}
else
{
SetPrincipal(e.Object);
}
completed(null, EventArgs.Empty);
});
This code is in my BASPrincipal.cs module and here is the exception message generated:
System.TypeInitializationException was unhandled by user code
Message="The type initializer for 'BAS.Business.Security.BASIdentity' threw an exception."
TypeName="BAS.Business.Security.BASIdentity"
StackTrace:
at BAS.Business.Security.BASIdentity.GetIdentity(String username, String password, EventHandler`1 completed)
at BAS.Business.Security.BASPrincipal.Login(String username, String password, EventHandler`1 completed)
at BAS.LoginControl.LogInButton_Click(Object sender, RoutedEventArgs e)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)
InnerException: System.TypeLoadException
Message="Could not load type 'System.Windows.Controls.IEditableObject' from assembly 'System.Windows.Controls.Data, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'."
StackTrace:
at Csla.Core.FieldManager.PropertyInfoManager.get_PropertyInfoCache()
at Csla.Core.FieldManager.PropertyInfoManager.GetPropertyListCache(Type objectType)
at Csla.Core.FieldManager.PropertyInfoManager.RegisterProperty[T](Type objectType, PropertyInfo`1 info)
at Csla.ReadOnlyBase`1.RegisterProperty[P](PropertyInfo`1 info)
at BAS.Business.Security.BASIdentity..cctor()
InnerException:
The code for BASIdentity looks correct and was based on the RolodexIdentity code so I am a bit puzzeled. It is probably something simple, but being new to Silverlight, there are a lot of gotchas and I think I am finding all of them.
Thank you,
Keith
The core of the exception is this:
Message="Could not load type 'System.Windows.Controls.IEditableObject' from assembly 'System.Windows.Controls.Data, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'."
It seems that you might not have a reference to this assembly in your main SL app, so the assembly isn't in the xap file, so the type loader can't find it.
I think your Silverlight run time is too old. This
interface was moved from Controls.Data into (I think) System.ComponentModel in
RTM of Silverlight.
Sergey Barskiy
Principal Consultant
office: 678.405.0687 |
mobile: 404.388.1899
Microsoft Worldwide Partner of the Year | Custom
Development Solutions, Technical Innovation
From: CyclingFoodmanPA
[mailto:cslanet@lhotka.net]
Sent: Wednesday, January 14, 2009 8:26 PM
To: Sergey Barskiy
Subject: [CSLA .NET] Type Initializer Error
I am making progress in getting a prototype of my application to use
Silverlight and am basing it on the Rolodex example, but it is a slow process
:(. Currently I am getting a type initializer error after I go into the
login screen and get to the following code:
BASIdentity.GetIdentity(username,
password, (o, e) =>
{
if (e.Object == null)
{
SetPrincipal(BASIdentity.UnauthenticatedIdentity());
}
else
{
SetPrincipal(e.Object);
}
completed(null, EventArgs.Empty);
});
This code is in my BASPrincipal.cs
module and here is the exception message generated:
System.TypeInitializationException was unhandled by user code
Message="The type initializer for
'BAS.Business.Security.BASIdentity' threw an exception."
TypeName="BAS.Business.Security.BASIdentity"
StackTrace:
at
BAS.Business.Security.BASIdentity.GetIdentity(String username, String password,
EventHandler`1 completed)
at
BAS.Business.Security.BASPrincipal.Login(String username, String password,
EventHandler`1 completed)
at
BAS.LoginControl.LogInButton_Click(Object sender, RoutedEventArgs e)
at
System.Windows.Controls.Primitives.ButtonBase.OnClick()
at
System.Windows.Controls.Button.OnClick()
at
System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs
e)
at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control
ctrl, EventArgs e)
at MS.Internal.JoltHelper.FireEvent(IntPtr
unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)
InnerException: System.TypeLoadException
Message="Could not load type 'System.Windows.Controls.IEditableObject'
from assembly 'System.Windows.Controls.Data, Version=2.0.5.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35'."
StackTrace:
at
Csla.Core.FieldManager.PropertyInfoManager.get_PropertyInfoCache()
at
Csla.Core.FieldManager.PropertyInfoManager.GetPropertyListCache(Type
objectType)
at
Csla.Core.FieldManager.PropertyInfoManager.RegisterProperty[T](Type objectType,
PropertyInfo`1 info)
at
Csla.ReadOnlyBase`1.RegisterProperty[P](PropertyInfo`1 info)
at
BAS.Business.Security.BASIdentity..cctor()
InnerException:
The code for BASIdentity looks
correct and was based on the RolodexIdentity code so I am a bit puzzeled.
It is probably something simple, but being new to Silverlight, there are a lot
of gotchas and I think I am finding all of them.
Thank you,
Keith
Copyright (c) Marimer LLC