Gemini Community Support Site

This Gemini community support site can be used to find solutions to product issues. You can log in using Open Id, Google Profile and even Facebook. Feel free to ask a question or browse FAQs and documentation. Product tour videos are also available along with how-to videos demonstrating key Gemini capabilities.




Exception thrown by the target of an invocation - GetProjectVersionAttributes

api

OK so my previous problem was an obvious problem with my code. However, whenever I call ProjectsService.GetProjectVersionAttributes(projectID) using a valid projectID, I get "Exception has been thrown by the target of an invocation", with stack trace:

[9024] CounterSoft Gemini: Exception has been thrown by the target of an invocation. :: CounterSoft.Gemini.WebServices ::    at CounterSoft.Gemini.WebServices.BaseService.ThrowResponseException(WebResponse response)
[9024]    at CounterSoft.Gemini.WebServices.BaseService.ProcessResponse[T](String url, Object obj, RequestType requestType)
[9024]    at CounterSoft.Gemini.WebServices.ProjectsService.GetProjectVersionAttributeValue(Int32 projectId, Int32 versionId, Int32 attributeId)
[9024]    at CounterSoft.Gemini.Services.Samples.FormReleaseNotes..ctor(ServiceManager sm, String initialText, Int32 versionid, Int32 projectid)
[9024] CounterSoft Gemini:    at CounterSoft.Gemini.WebServices.BaseService.ThrowResponseException(WebResponse response)
[9024]    at CounterSoft.Gemini.WebServices.BaseService.ProcessResponse[T](String url, Object obj, RequestType requestType)
[9024]    at CounterSoft.Gemini.WebServices.ProjectsService.GetProjectVersionAttributeValue(Int32 projectId, Int32 versionId, Int32 attributeId)
[9024]    at CounterSoft.Gemini.Services.Samples.FormReleaseNotes..ctor(ServiceManager sm, String initialText, Int32 versionid, Int32 projectid).

Am I doing something wrong?

alitheg
· 1
alitheg
Replies (13)
helpful
0
not helpful

Actually...is this a typing problem?

Calling GetProjectAttributes(66) correctly returns a result of type ProjectVersionAttributeEN[]

However, calling it with GetProjectAttributes(projectid), which is an Int32 and I've checked that it's value is '66' through DiagnosticsManager, throws the above exception.


alitheg
· 1
alitheg
helpful
0
not helpful

Disregard that. The exception is coming from GetProjectVersionAttributeValue(version.ProjectID, version.VersionID, attribute.AttributeID).

It still occurs when I enter the int values (verified as correct in the above) manually:

GetProjectVersionAttributeValue(66,196,1);


alitheg
· 1
alitheg
helpful
0
not helpful

Please make sure that the version has an attribute value (not default).


Mark Wing
· 9108
Mark Wing
helpful
0
not helpful

The version I'm trying to get the value for already has a (non-default) value.


alitheg
· 1
alitheg
helpful
0
not helpful

Just tested and all seems to work. Please catch the Exception (catch (GeminiRestException ex)) and investigate the error details using the debugger.


Mark Wing
· 9108
Mark Wing
helpful
0
not helpful

Ok, I've caught it and am looking through the detail of the exception.

The error's "inner message":

"Project Id does not match saved data Id value: 66."

with inner source "CounterSoft.Gemini.Presenter"
source "mscorlib"
Type HttpStatusCode.InternalServerError

There seems to be a 500 server error somewhere. The path of the response uri is

"/api/projects.ashx/projects/66/versions/196/versionattributevalues/1

And the headers read:

Connection: close
Content-length: 1826
Cache-control: private
Content-type: text/xml
Date: is correct (copying manually)
Server: Microsoft-IIS/6.0
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET

But I'm not seeing any more information I can use to try and solve it.

Any hints on where to look? Or is that enough?


alitheg
· 1
alitheg
helpful
0
not helpful

The error suggests that the attribute value does not belong to the project sent in (66).

Are you sure that the attribute value id is correct and has a value?


Mark Wing
· 9108
Mark Wing
helpful
0
not helpful

Yeah.

http://bilby/project/Admin/Versions.aspx?PROJID=66

has:

ID Version Number Version Name
                 196 0.7                   Third test system


and version attributes for 0.7 are:

"test release notes", where the default value is "Release notes"

 

Line from SQL database:

 

5 1 66 196 test release notes<br />
<Binary data>(attributevalueid,attributeid,projectid,versionid,attributevalue,tstamp)


alitheg
· 1
alitheg
helpful
0
not helpful

Please send your database and code to support at countersoft dot com


Mark Wing
· 9108
Mark Wing
helpful
0
not helpful

Email sent.


alitheg
· 1
alitheg
helpful
0
not helpful

I've got it!

The final argument of GetProjectVersionAttributeValue - "attributeid" - is not the attribute id as it is referred to in the attribute table. It is referring to the attributevalueid from the attributevalues table.

This means you need to know the exact entry in that table when trying to retrieve a version attribute value - surely not the way it's supposed to work?

I'd have thought the entity returned should be that entity that matches the 3 arguments, as in the following:

My database table entry:

5 1 66 196 "test release notes<br />"
"<Binary data>"(attributevalueid,attributeid,projectid,versionid,attributevalue,tstamp)

So at the moment to access this elemt from the API, I need to call GetProjectVersionAttributeValue(66,196,5). Surely it's better to access it using GetProjectVersionAttributeValue(66,196,1), since '1' is the attribute for all versions of this project - not just those with an already-defined value?

EDIT:

I've also found a workaround. Using GetProjectAttributeValues(projID,versID), you can obtain an entity that contains the attribute AttributeValueID - exactly the number required above. It requires a bit of looping and searching, but it does the job.


alitheg
· 1
alitheg
helpful
0
not helpful

Feel free to add it to our list: http://gemini.countersoft.com


Mark Wing
· 9108
Mark Wing
helpful
0
not helpful

alitheg
· 1
alitheg