2

So I'm using Grapevine.RESTClient to manage the client side of my REST interface. I'm using it to communicate between a service running in LocalSystem and a process run by the user on the same machine.

My problem is that when the service is not running my client gets an exception with a message of 'Error: Value cannot be null. Parameter name: cookies'

I'm trying to create some logic on the client that is supposed to understand and accept that sometimes the service is unavailable like when the service is auto updating.

Or maybe I should just accept that the message of the exception is a little odd?

RESTClient client;
client = new RESTClient(baseUrl);
RESTRequest request = new RESTRequest(resource);
request.Method = Grapevine.HttpMethod.GET;
request.ContentType = Grapevine.ContentType.JSON;
request.Timeout = 30000;
RESTResponse response = client.Execute(request);

The above throws a System.ArgumentNullException with e.Message = "Value cannot be null.\r\nParameter name: cookies"


Hmmm... Looking at the Grapevine code on github it seems the code tries to add a cookie collection to this.Cookies even if the response object was created out of e.response in the catch block of the GetResponse call. It may or may not have a cookie collection. There should have been a test for null block around the this.Cookies.Add(response.Cookies) right?

https://github.com/scottoffen/Grapevine/blob/master/Grapevine/Client/RESTClient.cs


Unable to create a grapevine tag as the developer of grapevine suggested to do. Dont have enough points

Scott Offen
  • 6,933
  • 3
  • 21
  • 24
Holm76
  • 216
  • 2
  • 11
  • Code samples would be useful, it's hard to tell what you are doing from this description. – jjczopek Aug 17 '15 at 08:34
  • If you know Grapevine it should be pretty easy to get an idea. I've added some code to the post to make it clear. And I also looked in the implementation of Grapevine to maybe get an idea of whats going on. – Holm76 Aug 17 '15 at 09:50
  • I hope you find v4.0 easier to use in this regard. Over the next month the documentation on the site should be completely flushed out, but if you've used Grapevine before, it should be too hard to figure out. – Scott Offen Aug 03 '16 at 04:41

1 Answers1

0

I've had the same problem. Unfortunately the error message is misleading. To me the fix was to add a default proxy to the file App.config.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.net>
        <defaultProxy useDefaultCredentials="true" />
    </system.net>
</configuration>
Christian Schyma
  • 190
  • 1
  • 2
  • 16
  • If there is something Grapevine should be doing by default, open an issue on the project page and I'll take a look at it. Thanks! – Scott Offen Aug 03 '16 at 04:42