O/T Object Data Sources problems in VS 2008

O/T Object Data Sources problems in VS 2008

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


simon_may posted on Tuesday, September 09, 2008

I just love Winforms data binding but I have had some problems using it in VS 2008 (and for that matter had similar problems in VS 2005 as well)

I have Googled high and low for any articles, blogs, etc (as one does) that might mention the issues I find, but to no avail. So I thought I might take the liberty of asking here, where the likelyhood of people doing the same as me is high, so please accept my apologies for going off topic.

Everything starts out fine. New project, generate some new CSLA based objects and then create a form and add a new data source, selecting 'object' data source, add reference to Business Object library assembly then drilling through the treeview to the object I want to bind to. No problems all is well.

Many objects added and forms designed later it all starts to go pear shaped. My BOs are geneated with partial class files and i decide to add a property to the user code file. I then rebuild the assembly go to the form designer data sources window and refresh the data sources. I then look for the new property in the data source and it is not there. What a pain, Ok stuff happens, so I delete the data source and add it again, no luck. Get Reflector and look at the assembly, the property is there no problem. So I clean, rebuld, shutdown VS restart, kick the cat, make a cup of tea and after a lot of messing around the property appears.

Now recently I added new objects to the library project and went to create  data sources based on them, but cant see them in the 'Add Data Source' wizzard. Again Reflector to check and there they are, I havent got much hair to start with but it is getting thinner day by day.

Ok, you probably get the drift by now. This is bloody anoying. So has anyone any ideas of what I am doing wrong, know of any known issues that I haven't tracked down, or has any magic chants that I can recite to excorcise the deamons in VS to let me get on with the work in hand.

Any ideas warmly welcomed.

Simon

ajj3085 replied on Tuesday, September 09, 2008

Are your BOs in the same assembly as the forms?  That will cause some problems.

simon_may replied on Tuesday, September 09, 2008

No. Separate projects/assemblies, same solution

JonnyBee replied on Tuesday, September 09, 2008

What is your configuration of version numbers on you assemblies (in particular the BO assemblies).
Datasources are stamped with version number in the xml-file.

There has been some problems concerning generic classes:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=249597&SiteID=1

Partial classes and duplicate summary tags may also cause problems:
http://forums.msdn.microsoft.com/en-US/csharpide/thread/ecaa4be7-6b2c-4f69-83bd-f0883ab3b168/

And a couple of other tips here to:
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=105432
http://connect.microsoft.com/VisualStudio/feedback/Workaround.aspx?FeedbackID=105432

Hope this helps - and keep us updated on your findings.

/jonnybee

simon_may replied on Wednesday, September 10, 2008

Hi JonnyBee, Thanks for the suggestion and links. There is no disparity between the version numbers.

In fact I started a completely new solution and a new form and created a new data source from the original problem BO library assembly. Same result: could not see the the BO that I had added.

Somthing is very wrong here but I just cannot put my finger on it. I am wondering as to how VS treats the objects it is binding to. Is it creating shadow dirctories and app domains as I beleive it does when dealing with web form databinding sources (little knowledge here) and for some reason it has not using the latest version of the library. I have deleted all instances of the library and then rebuilt. same problem.

Added a new project (library) to my test solution and a test class with test property, went to form designer and created data source - no problems. Wierd

Simon

 

rsbaker0 replied on Wednesday, September 10, 2008

simon_may:

...so I clean, rebuld, shutdown VS restart, kick the cat, make a cup of tea and after a lot of messing around the property appears. ...

I think this is the crux of the issue, something goes haywire in VS that can only be fixed by either a complete rebuild or by exiting and restarting it.

I have similar problems with data sources too -- I'll go to add one and my assembly doesn't show up in the list.

Also, user controls I have built start breaking in the designer with bizarre messages (type not found, type couldn't be loaded, type doesn't implement a method that it obviously does, etc.). I do nothing other than close and reopen VS, and it's fixed.

simon_may replied on Wednesday, September 10, 2008

Yeah, VS restarts have helped in the past but not this time (also have had problems with user controls as well, although not for quite a while). Maybe it will have to be a reinstall. What a pain.

simon_may replied on Wednesday, September 10, 2008

Ok, someone show me where the humble pie is (this was all pretty much self inflicted).

The classes concerned were not public, duh!!! (VS's default 'add new item' template does not generate an access modifier for the class and I had forgotten to change that).

However, there is some mittigation for my post.

First of all, I have had problems with properties not showing up as expected rsbaker0 has kindly confirmed that there are problems. So I didnt have as open a mind as I should have.

Secondly, these new classes were in a new namespace and even this namespace was not present in the the 'add data source' wizzard (This led me to beleive that there was something badly wrong because of course Reflector showed the namespace no problem). Obviously, if the wizzard does not see any public classes it sees no point in including the namespace.

Anyway sorry for wasting peoples' time and thanks to those who took a look and especially to the guys who responded.

Anyway back to the grind.

Simon

Copyright (c) Marimer LLC