Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency issue when using .NET 4.5 with 1.10.1-rc1 #694

Closed
jskeet opened this issue Mar 7, 2016 · 3 comments
Closed

Dependency issue when using .NET 4.5 with 1.10.1-rc1 #694

jskeet opened this issue Mar 7, 2016 · 3 comments
Assignees

Comments

@jskeet
Copy link
Collaborator

jskeet commented Mar 7, 2016

Our nuspec file for Google.Apis.Core has the following dependencies:

<dependencies>
  <group targetFramework="net45">
    <dependency id="Newtonsoft.Json" version="7.0.1" />
  </group>
  <group>
    <!-- Fallback group, used if nothing else matches. -->
    <dependency id="Microsoft.Bcl" version="1.1.10" />
    <dependency id="Microsoft.Bcl.Async" version="1.0.168" />
    <dependency id="Microsoft.Bcl.Build" version="1.0.21" />
    <dependency id="Microsoft.Net.Http" version="2.2.29" />
    <dependency id="Newtonsoft.Json" version="7.0.1" />
  </group>
</dependencies>

That means in theory we shouldn't need Microsoft.Bcl.Async when using .NET 4.5 - which makes sense, as we've already got all the Task goodness (including Task.Run) in the BCL.

Now, Google.Apis.Auth depends on Google.Apis.Core, so that's how we used to get the task dependencies - transitively. (At least, that's my understanding...)

With 1.10.1-rc1, the following program:

using Google.Apis.Auth.OAuth2;

class Program
{
    static void Main(string[] args)
    {
        var credentials = GoogleCredential.GetApplicationDefaultAsync().Result;
    }
}

crashes with:

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
   at Google.Apis.Auth.OAuth2.DefaultCredentialProvider.CreateDefaultCredentialAsync()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at System.Lazy`1.get_Value()
   at Program.Main(String[] args) in C:\[...]\Program.cs:line 9

The Google.Apis.Auth.PlatformServices library contains a dependency on the Microsoft.Threading.Tasks.dll, apparently for Microsoft.Runtime.CompilerServices.ConfiguredTaskAwaitable.

Basically, it looks like we need another project for Google.Apis.Auth.PlatformServices for .NET 4.5 to avoid requiring that dependency. (Currently the DotNet40 assembly is copied into lib\net45 in the Google.Apis.Auth nuspec file.)

I haven't started doing any of this in case I've misunderstood - assigning to Matt for initial comments as least.

(As a workaround, clients can add an explicit dependency on Microsoft.Bcl.Async themselves.)

@mmdriley
Copy link
Contributor

This will be fixed by #696 since the PlatformServices assemblies we install on net45 will target net45 and won't have these dependencies anymore.

If that gets delayed, the solution is to list these dependencies in every group in Google.Apis.nuspec and Google.Apis.Auth.nuspec.

@jskeet
Copy link
Collaborator Author

jskeet commented Mar 16, 2016

Agreed on both counts. Hoping we'll go for the simpler approach :)

@mmdriley
Copy link
Contributor

Confirmed fixed in 1.11.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants