none
Mystery "Undefined CLR namespace" error

    Question

  • This makes no sense, assuming the documentation I am working through is correct.

    I am relatively new to silverlight and ria, and so am working through the "Walkthrough: Taking a Tour of RIA Services" section of the ria services documentation I obtained from http://riaservices.codeplex.com/.

    I followed the instructions to the letter, and everything worked fine for roughly the first half of the 'walkthrough'.

    Then I started the 'Adding New Records' section.  At that point, the EmployeeList.xaml started producing two errors.  The first is the following:

    Undefined CLR namespace.  The 'clr-namespace' URI refers to a namespace 'HRApp.Web' that is not included in the assembly.

    The odd thing about this is that if I delete the 'Web' part of that specification, or the whole URI, and try to re-enter it, MS VS 2010 is able to autocomplete it.

    The second error is undoubtedly due to the first.  It is:

    The type 'ds:OrganizationContext' was not found.  Verify that you are not missing an assembly reference and that all referenced assemblies have been built. 

    Obviously, if the HRApp.Web namespace is not being found, the ds namespace isn't defined and the OrganizationContext won't be found.  Based on the last sentence in this message, I rebuilt HRApp.Web project, but that did not help.

    As this is an obvious (and so far useful) introduction to silverlight and ria, I doubt I am the first to be caught by this.  Is this a well known 'gotcha'?  Why does it occur, and is there a 'rule' or generally accepted practice that avoids it?

    My plan, for mastering silverlight and ria was to finish the exercises in this document, and then try making a prototype address book de novo (i.e. I made a schema in SQL EXPRESS 2008, with a fully normalized set of tables for people, addresses, phone numbers and email addresses - one person to many addresses, phone numbers and email addresses, and I was going to make a simple CRUD app for it using the same Silverlight business application template).

    Please note, while I am new to silverlight, I am not new to software development, or web app development (I know C/C++/C# well, and I have used Java servlets/JSF  for some web applications and cgi using perl on apache's httpd for others).  It is not that I don't understand the content of the document, but rather I either got caught by some quirk in the tools, or there is something that is missing from the instructions provided in the documentation (or there is something there that deals with this that I somehow missed).

    So, then, why did this happen and how do I fix it?

    Thanks

    Ted

    Monday, September 27, 2010 11:41 AM

Answers

  • Get through the walkthrough first, that gets you through the default "I have one hour to demo RIA Services to you and this is how we do that" version of RIA Services. Nikhil's example (there is a video from last years MIX if you want to follow along) shows you how RIA Services is used in the "real world" where demo-friendly drag and drop programming may not meet your needs.

    But that leaves the question as to why it happens.  Is it just that 'Cider' has problems?  And that rebuilding everything helps work around those problems?  That strikes me as a cause for concern.  Is it really stable enough to use for real world production? 

    It isn't Cider that has the problem. WCF RIA Services has something called "Live Intellisense" which attempts to keep the client side updated as you make changes on the server side. Dinesh had a post about it a few weeks ago where he asks if anyone would mind if they just took that feature back out. As you may be able to tell from the responses, most of us use things like RIA Services Class libraries which means that after we change our DomainServices we all tend to do a complete rebuild anyway. I am guessing that the live intellisense is updating visual studio but may not be updating Cider. So, it isn't a problem with tools stability. It is a problem with a "feature" that was added by RIA Services which turned out to be less of a feature then they first thought.

    Monday, September 27, 2010 1:31 PM

All replies

  • This is getting stranger and stranger!

    I just checked a few things and made an edit that has absolutely nothing to do with how the code works (to do with how the code is presented in the editor).  I saved all, and directed VS 2010 to rebuild everything.  Magically the errors that hit me disappeared.  Why?  The code I'd edited (more precisely reformatted) was not EmployeeList.xaml or EmployeeList.xaml.cs, and none of it had been identified as a cause of an error.

    1) I am happy the errors are gone, so I can proceed with the exercise.

    2) I am troubled, as I am when any error disappears and I do not know why, because I don't know what caused these errors and what I might have done that had the effect of getting rid of them.

    Can anyone enlighten me?

    Monday, September 27, 2010 11:56 AM
  • Are you seeing the problem at runtime or only within Visual Studio? Does rebuilding, closing and reopening the screen, closing and reopening Visual Studio help any? I have seen XAML errors in the past that exist only in Visual Studio due to Cider (aka the XAML editor in Visual Studio) but the application still builds correctly. Since the namespaces from RIA Services are generated code, this seems likely to be your problem.

    I am just guessing, I don't write applications the way that walkthrough does. I write them more like Nikhil does in his Book Club application which is at the link you provided. That means I don't use the DomainDataSource at all and so I am not using those namespaces.

    Monday, September 27, 2010 12:04 PM
  • Thanks Colin

    I see them only within Visual Studio.  closing or reopening the screen had no effect.  But as I mention in my second post, the error went away when I rebuilt everything.  Just rebuilding the part that it complained about had no effect, though (that was what I tried first). 

    So, it seems the edits I made to reformat the code (to my taste) had nothing to do with the errors or with making them go away.  It was that I then saved everything and rebuilt everything that did it.

    But that leaves the question as to why it happens.  Is it just that 'Cider' has problems?  And that rebuilding everything helps work around those problems?  That strikes me as a cause for concern.  Is it really stable enough to use for real world production? 

    Generally, I do like what I have seen so far.  I can imagine with it would have taken to develop something similar to the HRApp using cgi programming in Perl.  Smile  But the productivity boost means nothing if the development environment and platform are not sufficiently stable.

    I guess I got confused about where I got that walk through document (perhaps because I downloaded them at the same time) - I have retrieved so much documentation last week. 

    I do have the BookClub zip archive.  But I left it until after I finished this tutorial as it did not have a comparable tutorial like document in it (I assume that that is online there).

    Thanks

    Ted

    Monday, September 27, 2010 1:02 PM
  • Get through the walkthrough first, that gets you through the default "I have one hour to demo RIA Services to you and this is how we do that" version of RIA Services. Nikhil's example (there is a video from last years MIX if you want to follow along) shows you how RIA Services is used in the "real world" where demo-friendly drag and drop programming may not meet your needs.

    But that leaves the question as to why it happens.  Is it just that 'Cider' has problems?  And that rebuilding everything helps work around those problems?  That strikes me as a cause for concern.  Is it really stable enough to use for real world production? 

    It isn't Cider that has the problem. WCF RIA Services has something called "Live Intellisense" which attempts to keep the client side updated as you make changes on the server side. Dinesh had a post about it a few weeks ago where he asks if anyone would mind if they just took that feature back out. As you may be able to tell from the responses, most of us use things like RIA Services Class libraries which means that after we change our DomainServices we all tend to do a complete rebuild anyway. I am guessing that the live intellisense is updating visual studio but may not be updating Cider. So, it isn't a problem with tools stability. It is a problem with a "feature" that was added by RIA Services which turned out to be less of a feature then they first thought.

    Monday, September 27, 2010 1:31 PM
  • Hello there,

    I have the exact same problem exception made that a close/open - build/rebuild etc does not solve the problem....

    Monday, April 02, 2012 12:24 PM