MyOwnClone / google-api-dotnet-client

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

[4.0/4.5 Framework] Operation Could Destabilize Runtime [Fix Included] Google.Apis.Services BaseClientService.cs #330

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Import the current Google.Apis service.
2. Publish to a server running 4.5 Framework
3. Find a way to execute method:  "public virtual T 
DeserializeResponse<T>(IResponse input)". I used  UserInfo. 
"
What is the expected output? What do you see instead?
I should be able to continue on; however, the server returns an exception which 
points to a catch on line 211. 

What version of the product are you using? On what operating system?
.NET 1.3.0 Beta - Stable Release

Please provide any additional information below.
The issue has to do with a signature change within a virtual member called, 
IsEnum, you can find more information over here: 
http://stackoverflow.com/questions/6919808/why-does-this-line-cause-a-verificati
onexception-when-running-under-net-4

I verified the issue by running peverify against the google.api dll, the 
following message appeared:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>peverify C:\Users\chrisb\
Documents\ApplicationDevelopment\Working\BloggerThroughGlass\code.google.com\src
\Src\GoogleApis\bin\Debug\Google.Apis.dll /verbose

Microsoft (R) .NET Framework PE Verifier.  Version  4.0.30319.1
Copyright (c) Microsoft Corporation.  All rights reserved.

[IL]: Error: [C:\Users\chrisb\Documents\ApplicationDevelopment\Working\BloggerTh
roughGlass\code.google.com\src\Src\GoogleApis\bin\Debug\Google.Apis.dll : Google
.Apis.Services.BaseClientService::DeserializeResponse[T]][mdToken=0x60001bf][off
set 0x0000004A] The 'this' parameter to the call must be the calling method's 't
his' parameter.
1 Error(s) Verifying C:\Users\chrisb\Documents\ApplicationDevelopment\Working\Bl
oggerThroughGlass\code.google.com\src\Src\GoogleApis\bin\Debug\Google.Apis.dll

I fixed issue by casting the _TYPE interface for this line of code around 
typeOf in Google.Apis.Services.BaseClientService.cs, line 158.

From:
           if (typeof(T).Equals(typeof(string))

To:
           if (((_Type)typeof(T)).Equals((_Type)typeof(string)))

I rebuilt the DLL, and I imported it into my project. It works like a charm 
now, no errors. I thought that I should let you guys know.

Thanks! 

Original issue reported on code.google.com by cbarthol...@gmail.com on 25 May 2013 at 2:53

GoogleCodeExporter commented 9 years ago

Original comment by pele...@google.com on 28 May 2013 at 1:22

GoogleCodeExporter commented 9 years ago
I could not produce that in the current development version (which was upgraded 
to .NET 4.0). Can you please recheck if it still happens to you, or we can 
close this issue?

Original comment by pele...@google.com on 7 Jun 2013 at 1:24

GoogleCodeExporter commented 9 years ago
hello,

I believe the issue has to do with a server running 4.5. On a pure 4.0
server it's fine.

GoDaddy hosting supports 4.5/4.0 ( which basically means 4.5). I was able
to reproduce it after bumping the my own server framework to 4.5.

The issue doesn't occur in your local devweb environment: it has to be
published to a server running IIS7.0, w/ 4.5 framework. My apologies if I
wasn't clear.

Regardless, if you run pnverify like my example above, it does identify the
issue.

I'm using a custom DLL that I fixed and compiled myself from source, so I'm
fine, but if i revert my change then i get the error.

Original comment by cbarthol...@gmail.com on 7 Jun 2013 at 6:22

GoogleCodeExporter commented 9 years ago

Original comment by pele...@google.com on 17 Sep 2013 at 3:27

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Thank You 

Original comment by cbarthol...@gmail.com on 17 Sep 2013 at 1:41

GoogleCodeExporter commented 9 years ago

Original comment by pele...@google.com on 1 Oct 2013 at 5:31

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I have the same problem, that problem as old persists in version 1.8? 

I can not recompile because mine is "Visual Studio Express"

Original comment by buscaex...@gmail.com on 24 Feb 2014 at 1:58

GoogleCodeExporter commented 9 years ago
Can you patch a change so I would be able to review it?

Take a look in our "becoming a contributor" page 
-https://code.google.com/p/google-api-dotnet-client/wiki/BecomingAContributor

Original comment by pele...@google.com on 24 Feb 2014 at 3:28

GoogleCodeExporter commented 9 years ago
Oh wow, yea, I'd be honored. I'll take look at it this evening.

On Mon, Feb 24, 2014 at 10:28 AM,
<google-api-dotnet-client@googlecode.com>wrote:

Original comment by cbarthol...@gmail.com on 24 Feb 2014 at 5:16

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Good Afternoon, 

The "IIS" of hosting is set to "medium trust level." em 32Bits. 
The "Api" is compatible? 

I tried to recompile the project with google [assembly: 
AllowPartiallyTrustedCallers], but not accepted. 

I saw several issues related to this error. 
http://json.codeplex.com/discussions/354045 

Sorry for the insistence, but the error is impossible to use the API, which is 
the largest lodge in latin america one, then many others who try to use this 
hosting will not succeed.

Would help solve the error because I need to use api in my website 
www.buscaextra.com.br has another way to help? 

thank you

Original comment by buscaex...@gmail.com on 7 Mar 2014 at 3:56

GoogleCodeExporter commented 9 years ago
Hello,

I'm working on patching the fix today. I'll notify via this thread when the
patch has been pushed for review.

Thanks!

Original comment by cbarthol...@gmail.com on 7 Mar 2014 at 3:59

GoogleCodeExporter commented 9 years ago
Hello, 

Could you send me your source, or a new dll? 
Just to take the test at my base to see if it will solve. 

thank you 
Felipe

Original comment by buscaex...@gmail.com on 7 Mar 2014 at 11:29

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I tried to open the project myself to make the change mentioned above but was 
unable to fully load the project. I received "One or more projects in the 
solution were not loaded correctly" I am not sure what I need to install or 
what is missing.

Would it be possible to provide me a link with the updated DLL please?

Original comment by Dan...@gmail.com on 23 Jun 2014 at 8:47

GoogleCodeExporter commented 9 years ago
Hello, 

I'm so sorry about dropping the ball on this one. Thanks for the poke. I just 
committed a fix to this project. The change that I submitted was when the _Type 
interface was relevant in VS2010, but it is not longer used in VS2012, which 
the original project has been updated to. 

The problem, however, still does exist. Therefore, I did apply a slightly 
different fix (same issue in all parts regarding peverify failing on the same 
line). So, although I had committed the change, I'll need it to be approved. In 
the mean time, I've attached the recently built DLL to this thread so that you 
verify if it works for you. Otherwise, when it’s approved, you should be able 
to pull it down as part of the suite. 

Thanks for your patience - my apologies!
Christopher 

Original comment by cbarthol...@gmail.com on 25 Jun 2014 at 4:49

Attachments:

GoogleCodeExporter commented 9 years ago
https://codereview.appspot.com/110190043/ is the code review 

Original comment by cbarthol...@gmail.com on 25 Jun 2014 at 5:50

GoogleCodeExporter commented 9 years ago

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

GoogleCodeExporter commented 9 years ago
Finally (So SORRY!!!) I verified and committed this one.
It will be available in 1.9.1 (next weeks)

THANKS!

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