maha-khedr / google-api-dotnet-client

Automatically exported from code.google.com/p/google-api-dotnet-client
Apache License 2.0
0 stars 0 forks source link

Google.Apis.Core referencing Newtonsoft.Json v 4.5 #488

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Forgive my ignorance but I am a little out of my depth with .Net assemblies, 
etc.  I don't think this is a newbie issue, but then...

I have created a COM component to access Google Drive from within a Windows 
Application (it's a connector).  When I try to deploy the component together 
with it's dependent assemblies (as retrieved by NuGet), I get the following 
error reported:

Google.Apis.Json.NewtonsoftJsonSerializer' threw an exception.
    InnerException is 'System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
File name: 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, 
PublicKeyToken=30ad4fe6b2a6aeed'
   at Google.Apis.Json.NewtonsoftJsonSerializer..cctor()

=== Pre-bind state information ===
LOG: DisplayName = Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, 
PublicKeyToken=30ad4fe6b2a6aeed
 (Fully-specified)
LOG: Appbase = file:///C:/XXXX/
LOG: Initial PrivatePath = NULL
Calling assembly : Google.Apis.Core, Version=1.8.2.23761, Culture=neutral, 
PublicKeyToken=null.
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will 
only be probed in default load context, like with Assembly.Load().
LOG: No application configuration file found.
LOG: Using host configuration file: 
LOG: Using machine configuration file from 
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, 
PublicKeyToken=30ad4fe6b2a6aeed
LOG: Attempting download of new URL file:///C:/XXXX/Newtonsoft.Json.DLL.
LOG: Attempting download of new URL 
file:///C:/XXXX/Newtonsoft.Json/Newtonsoft.Json.DLL.
LOG: Attempting download of new URL file:///C:/XXXX/Newtonsoft.Json.EXE.
LOG: Attempting download of new URL 
file:///C:/XXXX/Newtonsoft.Json/Newtonsoft.Json.EXE.
LOG: Attempting download of new URL file:///C:/XXXX/GDDS/Newtonsoft.Json.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Major Version
LOG: Attempting download of new URL 
file:///C:/XXXX/GDDS/Newtonsoft.Json/Newtonsoft.Json.DLL.
LOG: Attempting download of new URL file:///C:/XXXX/GDDS/Newtonsoft.Json.EXE.
LOG: Attempting download of new URL 
file:///C:/XXXX/GDDS/Newtonsoft.Json/Newtonsoft.Json.EXE.
'
   at Google.Apis.Json.NewtonsoftJsonSerializer..ctor()
   at Google.Apis.Services.BaseClientService.Initializer..ctor()
   at GoogleDriveStore.GoogleDriveStoreAddIn.getDriveService()
   at GoogleDriveStore.GoogleDriveStoreAddIn.XXXXSDK.IStoreAddIn.Initialize(String DatabaseID, Object StoreUri, String StoreConfiguration, String UserName, String Password)

I have spent all day working on the assumption that .Net was getting an old 
reference from the environment and this was the source of the problem (the 
testing was happening in a VM with a number of different applications 
containing references to Newtonsoft.Json.dll).

I finally decided to dump the assembly information from Google.Apis.Core, using 
ildasm.exe, to reveal (to my stunned amazement):

AssemblyRef #3 (23000003)
-------------------------------------------------------
    Token: 0x23000003
    Public Key or Token: 30 ad 4f e6 b2 a6 ae ed 
    Name: Newtonsoft.Json
    Version: 4.5.0.0
    Major Version: 0x00000004
    Minor Version: 0x00000005
    Build Number: 0x00000000
    Revision Number: 0x00000000
    Locale: <null>
    HashValue Blob:
    Flags: [none] (00000000)

NuGet has downloaded version 6.0.5 of Newtonsoft.Json.dll to use with 
Google.Apis.  It seems that the reference to Newtonsoft.Json is somewhat old.  
I have downloaded the 4.5 version and stored it into a sub-folder and now find 
that I am having a similar issue with System.Net.Http.Primitives v1.5 being 
required where NuGet is offering v2.1.0.

I might be missing something, but to me it seems that DLL HELL has been 
replaced by Assembly Soup...

What am I doing wrong?

Original issue reported on code.google.com by peterdav...@gmail.com on 22 Sep 2014 at 8:21

GoogleCodeExporter commented 9 years ago
Pacakges were upgraded and release 1.9.0 is out there. Can you please check if 
you still have the problem?

Original comment by pele...@google.com on 30 Sep 2014 at 4:32

GoogleCodeExporter commented 9 years ago
There are still problems here.  Google.Apis.Core is referencing 
System.Net.Http.Primitives version 1.5.0.0.  Google.Apis.Auth.PlatformServices 
is referencing System.Net.Http version 2.2.22.0.  There are lots of references 
to System.IO, System.Runtime and System.Threading.Tasks version 1.5.11 (coming 
from the System.Net.Http* assemblies), which I cannot find any download of.  I 
have been trying different combinations of packages as retrieved by NuGet but 
there doesn't seem to be any combination found so far which results in a clean 
build.  I have tried using Update-Packages -reinstall Google.Apis.Drive.v2 but 
the result is still lots of dependency issues.  I realise that the cross 
dependency issues with System.* assemblies is a Microsoft issue. Any 
suggestions as to how to move forward?

Original comment by peterdav...@gmail.com on 8 Oct 2014 at 10:51

GoogleCodeExporter commented 9 years ago
Can you just check if the Drive sample works for you - 
https://code.google.com/p/google-api-dotnet-client/source/browse/Drive.Sample/RE
ADME.html?repo=samples?

It worked for me, so I'm not sure exactly what is the problem you are having 
and WHY?

Sorry... Looking forward to hear form you.

Original comment by pele...@google.com on 10 Oct 2014 at 2:42

GoogleCodeExporter commented 9 years ago
I'm going to close this issue now, because I didn't hear from you, and we 
already updated all our NuGet packages.

Feel free to reopen it and provide more data.
Thanks for reporting!
Eyal

Original comment by pele...@google.com on 28 Nov 2014 at 10:36