Getting CSLALight to Build

Getting CSLALight to Build

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


FCazabon posted on Monday, November 02, 2009

Hi,

I've been trying to get the CSLALight stuff to build and run the demo apps for a while now with much frustration. I do not think the problem is with CSLA itself, but believe that there is some installation problem I have on my PC. Due to my lack of experience with all the technologies involved I am having difficulty working out what is wrong.

I have VS2008 with SP1 installed.
I installed Silverlight 2 SDK and Silverlight 3 Tools (which includes the Silverlight 3 SDK).

When I open the cslacs (3.8 beta 3) solution and try to build it I get a number of warnings and errors. I also installed the ASP.NET MVC thing that was mentioned in the new thread about the release of beta 3.

For example, this is one of the warnings:
Warning 1 #warning: 'Improve if items is a counting bag' C:\csla\cslacs\Csla\C5\Hashing\HashBag.cs 297 10 Csla

and this is one of the errors:

Error 14 The type or namespace name 'Interactivity' does not exist in the namespace 'System.Windows' (are you missing an assembly reference?) C:\csla\cslacs\Csla\Wpf\Execute.cs 3 22 Csla

Can anyone help me sort this out? I would really love to get csla light up and running for a new peoject.

Thanks

RockfordLhotka replied on Monday, November 02, 2009

I'm glad you caught this. The Dependencies folder isn't being exported as part of my release process...

If you download and unpack the cslatest or cslalighttest archive you'll get the Dependencies folder, which includes the System.Windows.Interactivity.dll file you need.

I'll fix my release process to export Dependencies so the file is there for release.

(please note that to get localization and intellisense help for System.Windows.Interactivity you need to install the Blend 3 SDK and change the project references to the SDK directory - my inclusion of the assembly in the CSLA download enables CSLA to build, but doesn't (can't) include everything you'd normally get with the SDK)

FCazabon replied on Tuesday, November 03, 2009

Thanks Rocky.

That fixed that problem and I have now got much further in evaluating this stuff.

I have tried to run the InventoryDemo solution and am getting this error when I click on the Products (or Warehouses or Customers) button:

DataPortal.Fetch failed (The type initializer for 'InvDal.MockDb' threw an exception.)

Any idea what could be the cause of this?

RockfordLhotka replied on Tuesday, November 03, 2009

I don't know. The only thing that comes to mind is to make sure the web app is your startup app in the solution, though I think you'd get a different exception if that were wrong...

FCazabon replied on Wednesday, November 04, 2009

The web app is the startup app. Any hints on trying to debug this, bearing in mind that I'm a beginner in VS, .NET and CSLA?

RockfordLhotka replied on Wednesday, November 04, 2009

What is the full stack trace from the exception you are getting? Often the real problem is in line 2 or 3 of the stack trace.

FCazabon replied on Wednesday, November 04, 2009

I'm googling how to create a stack trace right now. :)

FCazabon replied on Wednesday, November 04, 2009

Hmm. No real luck with getting the stack trace for you.

I start the project with debugging, click on Products and get the error. At this point in tim eI look in the VS IDE and bring up the Call Stack window, but it is blank/empty. I try to Attach to a different process, but there is only the one process that looks like it has anything to do with this project and that is already selected.

Any assistance will be greatly appreciated.

FCazabon replied on Wednesday, November 04, 2009

I've found some information getting sent to the Output window:

A first chance exception of type 'Csla.Server.DataPortalException' occurred in Csla.DLL
A first chance exception of type 'Csla.Server.DataPortalException' occurred in Csla.DLL
A first chance exception of type 'Csla.DataPortalException' occurred in Csla.DLL
A first chance exception of type 'Csla.DataPortalException' occurred in Csla.DLL

Maybe this is what you asked for?

RockfordLhotka replied on Wednesday, November 04, 2009

If you get the exception, just do a ToString() on it - that'll get you the
stack trace.

FCazabon replied on Wednesday, November 04, 2009

Please remember I'm a beginner here. Where/how do I do a ToString() on an exception? All that happens is I get a messagebox displaying the original error message. I don't know things well enough to track down where this is happening in the code.

RockfordLhotka replied on Wednesday, November 04, 2009

I appreciate the challenges you are facing. But I must be honest and say
that I personally don't have time to teach the basics of using .NET and VS
through the forum, sorry...

Your best bet is to put a breakpoint in the constructor for the MockDb class
to see if that even runs. The top level exception says the type initialize
didn't run though, which is usually a bad sign - means something is wrong
with the type loader, or maybe (if you are lucky) with the constructor.

This is a very odd exception - so you are unfortunately a beginner trying to
debug a type of exception that throws most experts for a loop.

FCazabon replied on Wednesday, November 04, 2009

Fair enough. I understand (and half expected) that.

Hopefully someone else with more time on their hands may be able to help me out.

Meanwhile I will go back to getting my head around the basics.

Thanks

FCazabon replied on Tuesday, November 10, 2009

Rocky,

I've managed to get a bit further with the debugging (I've downloaded the full 3.8 version and started over from scratch ensuring I had all the folders set as recommended).

The error that is occurring is:

String was not recognized as a valid DateTime.

I would guess this is because I don't use American format dates and the dates used in LoadOrders are in that format.

Is there somewhere to change the settings used date format settings in CSLA, or do I need to change the demo code?

FWIW I changed the dates to the British (DD/MM/YYYY) format and the demo now works.


The call stack is:

> Csla.DLL!Csla.Reflection.MethodCaller.CallMethod(object obj = {InvDal.ProductList}, Csla.Reflection.DynamicMethodHandle methodHandle = {Csla.Reflection.DynamicMethodHandle}, object[] parameters = {object[0]}) Line 359 C#
Csla.DLL!Csla.Reflection.MethodCaller.CallMethod(object obj = {InvDal.ProductList}, string method = "Fetch", object[] parameters = {object[0]}) Line 270 + 0xf bytes C#
Csla.DLL!Csla.Server.FactoryDataPortal.InvokeMethod(string factoryTypeName = "InvDal.ProductList,InvDal", string methodName = "Fetch", Csla.Server.DataPortalContext context = {Csla.Server.DataPortalContext}) Line 59 + 0x2a bytes C#
Csla.DLL!Csla.Server.FactoryDataPortal.Fetch(System.Type objectType = {Name = "ProductList" FullName = "InvLib.ProductList"}, object criteria = 1, Csla.Server.DataPortalContext context = {Csla.Server.DataPortalContext}) Line 133 + 0x4c bytes C#
Csla.DLL!Csla.Server.DataPortalSelector.Fetch(System.Type objectType = {Name = "ProductList" FullName = "InvLib.ProductList"}, object criteria = 1, Csla.Server.DataPortalContext context = {Csla.Server.DataPortalContext}) Line 75 + 0x14 bytes C#
Csla.DLL!Csla.Server.DataPortal.Fetch(System.Type objectType = {Name = "ProductList" FullName = "InvLib.ProductList"}, object criteria = 1, Csla.Server.DataPortalContext context = {Csla.Server.DataPortalContext}) Line 186 + 0x12 bytes C#
Csla.DLL!Csla.DataPortalClient.LocalProxy.Fetch(System.Type objectType = {Name = "ProductList" FullName = "InvLib.ProductList"}, object criteria = 1, Csla.Server.DataPortalContext context = {Csla.Server.DataPortalContext}) Line 42 + 0x1b bytes C#
Csla.DLL!Csla.DataPortal.Fetch(System.Type objectType = {Name = "ProductList" FullName = "InvLib.ProductList"}, object criteria = 1) Line 232 + 0x12 bytes C#
Csla.DLL!Csla.DataPortal.Fetch(System.Type objectType = {Name = "ProductList" FullName = "InvLib.ProductList"}) Line 203 + 0x2f bytes C#
Csla.DLL!Csla.Server.Hosts.Silverlight.WcfPortal.Fetch(Csla.Server.Hosts.Silverlight.CriteriaRequest request = {Csla.Server.Hosts.Silverlight.CriteriaRequest}) Line 139 + 0x9 bytes C#
[External Code]

RockfordLhotka replied on Tuesday, November 10, 2009

Ahh, interesting.

If you look in InvDal\MockDb.cs you can see that I initialize a "database" in memory with mock data. This includes some date values.

I didn't think about culture settings. But I suppose my fixed date values won't parse on your machine because your culture settings are different.

I suppose the answer is to initialize the dates like this: new DateTime(2008, 10, 5)

instead of what I do now like this: DateTime.Parse("10/5/08")

 

FCazabon replied on Tuesday, November 10, 2009

Thanks, that's what I had done, and it works.

ludwigs3rd replied on Monday, November 23, 2009

I'm having the same problem with 3.8.1. I downloaded cslatest and cslalighttest for 3.8.0 and 3.8.1 and haven't been able to find the Dependencies folder. The root folder contains Data* folders then DPException and that's it.

ludwigs3rd replied on Monday, November 23, 2009

Sorry, just installed Silverlight 3 SDK and Blend 3 SDK and it seems to have fixed the problem.

RockfordLhotka replied on Monday, November 23, 2009

The top level items in cslacs-3.8.1-091111.zip are

cslacs
Dependencies
README.txt

In the cslalightcs-3.8.1-091111.zip archive the top level items are

cslacs
cslalightcs
Dependencies
README.txt

It is true that there is no longer a Dependencies folder in the test
archives, because you can't build the test projects without first having
CSLA .NET for Windows or CSLA .NET for Sivleright. I thought it was silly to
make everyone download the dependencies twice, when they clearly already got
them in the framework download.

Copyright (c) Marimer LLC