Trello.NET icon indicating copy to clipboard operation
Trello.NET copied to clipboard

All requests returning null

Open rmorrin opened this issue 10 years ago • 16 comments

Hi there,

I've tried a number of the examples from the wiki, and am unfortunately unable to get any usable data back from the API. I've debugged the request itself and can definitely see the raw JSON coming back, so maybe be an issue deserializing the response?

Simplified example:

var trello = new Trello(ConfigurationManager.AppSettings["TrelloAPIKey"]);
trello.Authorize(ConfigurationManager.AppSettings["TrelloAPIToken"]);

Board theTrelloDevBoard = trello.Boards.WithId("4d5ea62fd76aa1136000000c"); // null

rmorrin avatar Jul 31 '14 22:07 rmorrin

After a bit more investigation, the issue seems to be caused by the version of Json.NET (4.5.11) included in the default MVC web project. Updating the Json.NET package resolves the issue.

The exception thrown inside RestSharp is:

Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

The issue can be reproduced by the following (Assuming VS2013):

  • Create new ASP.NET Web Application
  • Select MVC template
  • Install Trello.NET via NuGet
  • Attempt to retrieve any data from Trello - see previous comment

Hope this helps!

rmorrin avatar Aug 01 '14 11:08 rmorrin

Thanks so much for this! I just spent way too much time going down a rabbit hole trying to figure this one out.

bcwood avatar Oct 16 '14 08:10 bcwood

What version of Newtonsoft.Json did you use? I had nulls with 4.5.1 and nothing changed after I upgraded to 6.0.6 This line returns null, however some JSON is coming back from the server:

trello.Boards.ForMe()

Just tried to debug Trello.NET source code and got an exception

 Could not convert string 'pink' to dictionary key type 'TrelloNet.Color'

So it looks like this issue might be related to https://github.com/dillenmeister/Trello.NET/issues/57

takemyoxygen avatar Nov 23 '14 16:11 takemyoxygen

@takemyoxygen Not entirely sure on the version - It would have been the latest version at that date. Though from what I can tell, I think the issue you're experiencing is due to something different.

I did notice there have been a number of PRs submitted to address the new label colors (#61, #58) but the maintainer has yet to respond to either. Perhaps you could could merge them into your own build and see if that resolves things.

rmorrin avatar Nov 24 '14 09:11 rmorrin

@rmorrin, thanks. Actually, #61 is my pull-request, so it resolved my problem.

takemyoxygen avatar Nov 24 '14 09:11 takemyoxygen

@takemyoxygen So it is - missed that one! Glad it's sorted :smile:

rmorrin avatar Nov 24 '14 09:11 rmorrin

Since it's been a couple days and we needed this fix for work, we pushed up a version to NuGet with takemyoxygen's fix: https://www.nuget.org/packages/TrelloNet.Temp.Fork/

I'm planning on taking it down once dillenmeister pushes up a fixed version but just figured I would share in case someone needed the fix now.

JaCraig avatar Dec 03 '14 15:12 JaCraig

Hi James, Are you sure you uploaded the right binaries on Nuget ? The package you linked does not seem to contain takemyoxygen's fix. Its behavior is identical to Trello.NET 0.6.2's official package.

jpatte avatar Dec 29 '14 16:12 jpatte

We're using the DLLs in production at the moment without issue and our build server pulls from Nuget before it deploys. Takemyoxygen's fix only deals with the new color options that Trello added so if you're running into another issue that's not related to that, you're going to get back null data because that's what Trello.Net seems to do for any issue that isn't a failed request.

On Mon, Dec 29, 2014 at 11:16 AM, Julien Patte [email protected] wrote:

Hi James, Are you sure you uploaded the right binaries on Nuget ? The package you linked does not seem to contain takemyoxygen's fix. Its behavior is identical to Trello.NET 0.6.2's official package.

— Reply to this email directly or view it on GitHub https://github.com/dillenmeister/Trello.NET/issues/53#issuecomment-68270866 .

JaCraig avatar Dec 30 '14 14:12 JaCraig

Facing the same issue, seems to be related with board objects only IEnumerable<Board> allMyBoards = trello.Boards.ForMember(trello_me); // returns null Board theTrelloDevBoard = trello.Boards.WithId("4d5ea62fd76aa1136000000c"); // returns null var myBoard = trello.Boards.Add("My Board"); // returns null, board is added though

But: IEnumerable<Card> allCardsAssignedToMe = trello.Cards.ForMember(trello_me); //Works fine

Any solution yet?

TrelloNet: 0.6.2. Json: 6.0.0 RestSharp: 105.0.1

toddel avatar Feb 06 '15 14:02 toddel

I am currently having to use the "Trello.NET (temp fork)" package which seems to have this fix (or at least from the api calls I am using so far).

Is there any time-scale on this getting folded in?

Thanks, Ed

edmundg avatar May 26 '15 14:05 edmundg

No idea. I'm the one that pushed that package up because I figured that dillenmeister would have a fix in a month or two and we just needed something where I worked right then and there (I was going to hide it once this was patched up). But this project hasn't been updated in about a year so no idea if he's going to update this or not. A couple people where I work tried contacting him also to see if we could help out but didn't get a response. So maybe dead project? Maybe he's really busy? Not sure at this point.

JaCraig avatar May 26 '15 15:05 JaCraig

Thanks jacraig for letting me know and good work with the fix it's been very helpful.

Would be nice if the project can be kept alive somehow or revived in a different location but I'm new to github so not sure how any of that could work.

edmundg avatar May 26 '15 16:05 edmundg

Thanks! I used the Edge version - was that correct?

garfbradaz avatar Jun 19 '15 23:06 garfbradaz

i updated my JSON package with the command

Install-Package Newtonsoft.Json

now i'm able to call some functions:

  1. trello.Members.Me()
  2. Organizations.ForMember()

I still get null sets for:

  1. Boards methods
  2. Cards methods
  3. List methods (because no boards)

If I pass my board id to the test API using my key and token i get a result. So I think I'm not crazy.

russlamb avatar Aug 01 '17 22:08 russlamb

Amazingly, I didn't realize this code hasn't been updated since 2014.

Other people have suggested Manatee.Trello or using the "Edge" version on NuGet. I'm going to try manatee. It was last updated in June 2017 as of this comment.

russlamb avatar Aug 01 '17 22:08 russlamb