09 Sep 2021 02:11 PM
Hello,
I am configuring a request attribute based on a .NET Method, looking to extract the return value of this:
public static ICollection<ErrorCode> GetErrors(this SearchResponse response) { if (response.ContainsError()) { return (from error in response.Response.Errors where null != error.RejectReason select new ErrorCode { Code = error.RejectReason.Code, Description = error.RejectReason.Description }).ToList(); } return null; }
Doing a simple toString() on the return value yields the object name, not the contents.
Is there a way for me to access the contents of that collection and print them out in a request attribute?
Thank you
09 Sep 2021 03:32 PM
Hey Gmichels. Do you have a toString() in the code base? Dynatrace will try to invoke the toString you specify to try to get the string out. In theory, as long as you yourself can cast something to the string, you can call Dynatrace to use the toString. If that doesn't work, try adding a String var1 = content.toString(); and then accessing var1 with the request attribute.+
Thanks -
Bob Crumley
09 Sep 2021 03:59 PM
Hi Bobby, thanks for your reply. Unfortunately I can't change the code, so I was looking for some ways around it.
Thanks