CS7069 Reference to type 'Object' claims it is defined in 'System.Runtime', but it could not be foun

Not 100% sure if this is a LinqPad thing, but I'm on the latest beta build (5.07.04) and tried adding a nuget reference to "Birdhouse" and then this script:

var token = "test";
var client = new Birdhouse.NestClient(token);
var structures = await client.GetStructuresAsync();
structures.Dump();

I'm getting the error "CS7069 Reference to type 'Object' claims it is defined in 'System.Runtime', but it could not be found".

I created a visual studio 2015 console app to do the same thing and it worked fine (albeit in slow-mo compared to linqpad!). Not sure if it's a .net framework version difference??

I've uploaded the script here: http://share.linqpad.net/8og4qn.linq

(Note: if it works it will still error because the token isn't valid, but it will be a more sensible error!)

Comments

  • Googling the error message finds this: stackoverflow.com/q/36723359/256431 They don't know why, but referencing System.Runtime avoids the issue. I haven't checked if it solves your problem.
  • Ah you're right, it does.

    Stupidly, I saw that article before but it somehow didn't sink in. Must have been a senior moment!

    Anyway, thanks that has sorted it.
  • This shouldn't happen because LINQPad is designed to add that reference automatically.

    Looking at the NuGet package, it seems the 4.0-specific references are being added that shouldn't.

    You can fix this (at least in the case of the Birdhouse package) as follows:

    * Press F4 for References
    * Click the 'NuGet' hyperlink next to the Birdhouse reference
    * Click 'Show assemblies for this package'
    * Exclude the ones whose source ends in net40

    This fix is permanent, so you won't get that problem again when using Birdhouse.
  • That worked - thanks very much, Joe.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!