Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Edited Issue: Null argument exception when trying to return an entry with a custom edit link in minimal metadata mode [776]

$
0
0
Scenario:
I have defined an entity set with a custom edit link (that doesn't follows conventions) and when I try to retrieve an entity in minimal metadata mode to check that the edit link gets emitted, I get a null reference exception.

Reason:

The problem happens in the line 118 of the file EntitySetLinkBuilderAnnotation.cs
"generatedEditLink.Equals(new Uri(idLink))"

Here, idLink is null and the new Uri(idLink) call fails.

Request:
GET http://localhost:10000/CustomConventions/StubEntity(1) HTTP/1.1
Host: localhost:10000
Connection: Keep-Alive

Exception detail:

System.ArgumentNullException occurred
HResult=-2147467261
Message=Value cannot be null.
Parameter name: uriString
Source=System
ParamName=uriString
StackTrace:
at System.Uri..ctor(String uriString)
at System.Web.Http.OData.Builder.EntitySetLinkBuilderAnnotation.BuildEditLink(EntityInstanceContext instanceContext, ODataMetadataLevel metadataLevel, String idLink) in c:\work\aspnetwebstack\src\System.Web.Http.OData\OData\Builder\EntitySetLinkBuilderAnnotation.cs:line 118
InnerException:

Metadata document:
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">
<edmx:DataServices m:DataServiceVersion="3.0" m:MaxDataServiceVersion="3.0" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<Schema Namespace="CustomConventionsLinkRepro.Models" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
<EntityType Name="StubEntity">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="Id" Type="Edm.Int32" Nullable="false" />
</EntityType>
</Schema>
<Schema Namespace="Default" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
<EntityContainer Name="Container" m:IsDefaultEntityContainer="true">
<EntitySet Name="StubEntity" EntityType="CustomConventionsLinkRepro.Models.StubEntity" />
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx>

Repro steps:
1) Open the attached project as administrator.
2) Point the System.Web.Odata.dll reference to the location of your dll.
3) Enable break on thown exceptions.
4) Run the project.


Viewing all articles
Browse latest Browse all 7215

Trending Articles