Skip to main content
Home Forums Silverlight Programming WCF RIA Services Bug in DomainService class created in XAML
7 replies. Latest Post by waldred on July 8, 2009.
(1)
enantiom...
Member
39 points
59 Posts
05-29-2009 4:40 PM |
I posted this in the Silverlight 3 forum, but now think it is really an RIA issue:
There is an exception that is thrown when I try to add my DomainService class in XAML. Visual studio gives me an error that says "AG_E_UNKNOWN_ERROR". If I open the project in expression blend 3 it says "Cannot create an instance of 'CompanyManager'" and the inner exception says "Object reference not set to an instance of an object". The stack trace is CompanyManager->HttpDomainClient(Uri service)->HttpDomainClient(Uri service, bool useSSL)->HttpDomainClient.ComposeAbsoluteServiceUri. When I actually run the project everything runs just fine but the Designer won't show me anything. I have tried this on both XP and Vista with Linq2Sql and Entities with the same result. I installed everything that the MS page recommends:
http://silverlight.net/getstarted/silverlight3/default.aspx
the RIA Services example from MS also has the same problem on my computers.
http://code.msdn.microsoft.com/RiaServices/Release/ProjectReleases.aspx?ReleaseId=2387
if I disassemble the generated DomainContext class I get this in the constructor that is failing:
// Methods public MyDomainContext() : base(new HttpDomainClient(new Uri("DataService.axd/SilverlightRIA-Web-MyDomainService/", UriKind.Relative))) { }
where the ComposeAbsoluteServiceUri has the following code:
[Conditional("SILVERLIGHT")]private void ComposeAbsoluteServiceUri(){ if (!this._serviceUri.IsAbsoluteUri) { if (Application.Current == null) { throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Resource.DomainClient_ApplicationNotInitialized, new object[0])); } string absoluteUri = Application.Current.Host.Source.AbsoluteUri; if (this._usesSsl && absoluteUri.StartsWith("http:", StringComparison.OrdinalIgnoreCase)) { absoluteUri = "https:" + absoluteUri.Remove(0, "http:".Length); } this._serviceUri = new Uri(new Uri(absoluteUri), this._serviceUri); }}We know that Application.Current is not null, I know that the _serviceUri has been set since it is passed in explicitly. 'Host' or 'Source' could be null. This probably looks like the most probable bug. It might actually make sense since when the designer tries to instantiate this, the Application may not have been fully constructed?
[Conditional("SILVERLIGHT")]private void ComposeAbsoluteServiceUri(){ if (!this._serviceUri.IsAbsoluteUri) { if (Application.Current == null) { throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Resource.DomainClient_ApplicationNotInitialized, new object[0])); } string absoluteUri = Application.Current.Host.Source.AbsoluteUri; if (this._usesSsl && absoluteUri.StartsWith("http:", StringComparison.OrdinalIgnoreCase)) { absoluteUri = "https:" + absoluteUri.Remove(0, "http:".Length); } this._serviceUri = new Uri(new Uri(absoluteUri), this._serviceUri); }}
We know that Application.Current is not null, I know that the _serviceUri has been set since it is passed in explicitly. 'Host' or 'Source' could be null. This probably looks like the most probable bug. It might actually make sense since when the designer tries to instantiate this, the Application may not have been fully constructed?
Hopefully this bug is fixed fast...
Matt.Ruwe
2 points
5 Posts
07-04-2009 9:55 AM |
I'm getting an almost identical issue (different class names, but same error description). Any help or response to this question will help multiple folks.
Thanks,Matt
mohnani....
323 points
66 Posts
07-06-2009 3:29 AM |
This is a known issue and we are looking to fix this.
waldred
702 points
113 Posts
07-06-2009 1:41 PM |
A fix for this issue will be available in our next public release.
theo67
524 points
177 Posts
07-06-2009 1:44 PM |
Will there be a more frequent update of the RIA-services?
07-06-2009 8:53 PM |
Yes, we are planning to have another CTP refresh in the future sometime around the SL3 release date. Announcements will be made in this forum as usual. :)
07-08-2009 1:25 PM |
Super. I am fine with bugs in software that hasn't been released yet, I am just surprised that it took months to get a reply on this. No worries though, thanks for the update.
07-08-2009 9:55 PM |
enantiomer2000:I am just surprised that it took months to get a reply on this
Me too. I just happened to be going through 'unanswered posts' and came across it. Apologies for having missed it previously.