Exception trying to run Silverlight Stocktrader RI

Topics: Prism v2 - Silverlight 3
Feb 20, 2010 at 12:09 PM

Hi,

I am attempting to run the Silverlight Stocktrader reference implementation application under Visual Studio 2008. When I click on a stock and then click on the "+" plus button, it raises an exception:

Attempt by method 'StockTraderRI.Infrastructure.DependencyPropertyHelper.GetOrAddValue<System.__Canon>(System.Windows.DependencyObject, System.Windows.DependencyProperty)' to access method 'StockTraderRI.Infrastructure.OnValidationError+MonitorBindingValidationErrorsBehavior..ctor()' failed.

Learning something new becomes so disappointing when examples don't work straight out of the box!

Here's the stack trace:

[External Code] 
  StockTraderRI.Infrastructure!StockTraderRI.Infrastructure.DependencyPropertyHelper.GetOrAddValue<StockTraderRI.Infrastructure.OnValidationError.MonitorBindingValidationErrorsBehavior>(System.Windows.DependencyObject dependencyObject = {System.Windows.Controls.TextBox}, System.Windows.DependencyProperty property = {System.Windows.CustomAttachedDependencyProperty}) Line 38 + 0x2b bytes C#
  StockTraderRI.Infrastructure!StockTraderRI.Infrastructure.OnValidationError.MonitorBindingValidationErrors(System.Windows.FrameworkElement element = {System.Windows.Controls.TextBox}) Line 110 + 0x13 bytes C#
  StockTraderRI.Infrastructure!StockTraderRI.Infrastructure.OnValidationError.ShowToolTipPropertyChanged(System.Windows.DependencyObject dependencyObject = {System.Windows.Controls.TextBox}, System.Windows.DependencyPropertyChangedEventArgs e = {System.Windows.DependencyPropertyChangedEventArgs}) Line 136 + 0x8 bytes C#
  [External Code] 
  StockTraderRI.Infrastructure!StockTraderRI.Infrastructure.OnValidationError.SetShowToolTip(System.Windows.DependencyObject dependencyObject = {System.Windows.Controls.TextBox}, bool value = true) Line 99 + 0x35 bytes C#
  [External Code] 
  StockTraderRI.Modules.Position!StockTraderRI.Modules.Position.Orders.OrderDetailsView.OrderDetailsView() Line 25 + 0x8 bytes C#
  [External Code] 
> StockTraderRI.Modules.Position!StockTraderRI.Modules.Position.Controllers.OrdersController.StartOrder(string tickerSymbol = "STOCK0", StockTraderRI.Infrastructure.TransactionType transactionType = Buy) Line 112 + 0x2a bytes C#
  StockTraderRI.Modules.Position!StockTraderRI.Modules.Position.Controllers.OrdersController.OnBuyExecuted(string parameter = "STOCK0") Line 62 + 0x10 bytes C#
  Microsoft.Practices.Composite.Presentation!Microsoft.Practices.Composite.Presentation.Commands.DelegateCommand<string>.Execute(string parameter = "STOCK0") Line 83 + 0x11 bytes C#
  Microsoft.Practices.Composite.Presentation!Microsoft.Practices.Composite.Presentation.Commands.DelegateCommand<string>.System.Windows.Input.ICommand.Execute(object parameter = "STOCK0") Line 136 + 0x35 bytes C#
  Microsoft.Practices.Composite.Presentation!Microsoft.Practices.Composite.Presentation.Commands.CommandBehaviorBase<System.Windows.Controls.Primitives.ButtonBase>.ExecuteCommand() Line 127 + 0x22 bytes C#
  Microsoft.Practices.Composite.Presentation!Microsoft.Practices.Composite.Presentation.Commands.ButtonBaseClickCommandBehavior.OnClick(object sender = {System.Windows.Controls.Button}, System.Windows.RoutedEventArgs e = {System.Windows.RoutedEventArgs}) Line 43 + 0xb bytes C#
  [External Code] 

Can someone please tell me what I need to do to get this working?

Regards,

Tony

Feb 26, 2010 at 4:29 PM

Hi Tony,

Assuming you have the right prerequisites installed there should be no problem running the reference implementation. You can check the system requirements here. You can also try to re-extract the Prism files just in case any modifications were performed to them.

In case the above does not work, please provide a repro sample so we can find the cause for this issue.

Please let me know if this helps.

Damian Schenkelman
http://blogs.southworks.net/dschenkelman

Mar 2, 2010 at 7:27 PM

I also am getting this error and have the listed prerequisites. I also have Visual Studio 2010 Ultimate Final Release Candidate, .Net 4, and Microsoft Silverlight 4 installed. What kind of repro sample are you looking for?

Mar 17, 2010 at 6:23 PM
Edited Mar 17, 2010 at 6:53 PM

Try to change the class access modifier in the OnValidationError.cs from private to public, will solve the problem.

\RI\Silverlight\StockTraderRI.Infrastructure.Silverlight\OnValidationError.cs

public

class MonitorBindingValidationErrorsBehavior

public class ToggleBackgroundOnValidationBehavior

public class ShowToolTipOnValidationBehavior

 -Dinhduy

Mar 25, 2010 at 9:09 AM

Thanks, that worked for me!