-
Notifications
You must be signed in to change notification settings - Fork 460
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
Cannot load PayPal section from web.config #101
Comments
Seems like to only have broken in version 1.4.3. Rolling back to version 1.4.2 works ok for me. |
Thanks for reporting this, @pageroller. It looks like this might be related to some changes that were made with respect to declaring certain classes as Also, the |
The error disappeared when I downgraded it, so I think it may have been just something else triggering it internally. Thanks for taking a look though! |
I wonder if this could have to do with the fact that our build process performs the strong-name signing on the PayPal.dll file as a post-build process. The It may be time to add the SNK as part of the project here on GitHub as it's beginning to cause more problems (along with complicating the build process). This is also what Microsoft recommends here for open source projects:
|
@pageroller would you mind sharing how you have your project setup along with what your web.config file looks like? I tried reproducing this with both the Samples project here and a newly-created project, but I'm not seeing the exception thrown in either one. I also tried running the projects both with and without an |
I have same issue while calling ConfigManager.Instance.GetProperties(). So please tell me how to solve this issue? |
@VickyMahir, the current solution if you're experiencing this issue is to downgrade to version 1.4.2. Currently, I'm unable to reproduce the issue on my end so any details you can help provide would be great. The following information should help in tracking down the cause of this bug:
|
@jziaja , I have resolved issue in version 1.4.3 using below code so is it ok? var apiContext = new APIContext(token);
apiContext.Config = config; //PayPal.Api.ConfigManager.Instance.GetProperties();
// Define any custom configuration settings for calls that will use this object.
apiContext.Config["connectionTimeout"] = "10000"; // Quick timeout for testing purposes
//// Define any HTTP headers to be used in HTTP requests made with this APIContext object
if (apiContext.HTTPHeaders == null)
{
apiContext.HTTPHeaders = new Dictionary<string, string>();
apiContext.HTTPHeaders.Add("apiUsername", auth.Username);
apiContext.HTTPHeaders.Add("apiPassword", auth.Password);
apiContext.HTTPHeaders.Add("apiSignature", apiSignature);
} |
@VickyMahir, what is |
@jziaja , Nothing in config file. Every thing in my code file |
I meant on this line in the code you posted above: apiContext.Config = config; //PayPal.Api.ConfigManager.Instance.GetProperties(); What is the value of Also, are you using this SDK in combination with one of the Classic SDKs? |
@jziaja , Value of config is
I am using only PayPal NET SDK not any other SDK in my application. |
Thanks @VickyMahir. If you can reproduce this issue in a newly-created project, would you mind emailing me the zipped-up project files at jziaja@paypal.com? |
Sorry for the delay - I've emailed you a copy of the solution with the issue replicated. |
@pageroller do you have .net framework 4.6 RC installed? if you check the registry @ HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full and if the "release" key has a value of 393273 then you probably installed VS 2015. After removing the 4.6 RC from my system and reinstalling 4.5.1 it fixed the issue for me with the 1.4.3 nuget package. |
Thanks a ton to @kenney777 for discovering the issue with .NET 4.6 RC. 👍 Another developer on StackOverflow also encountered this issue and was able to resolve it by uninstalling .NET 4.6 RC. The root cause for the issue looks to be that .NET 4.6 RC is a bit stricter when executing a strong-name signed assembly with respect to how the assembly, class, and property attributes are defined in the assembly. Regarding this SDK, the .NET framework's behavior has changed in .NET 4.6 RC regarding the following attributes:
We're currently discussing internally what a better strategy might be on the strong-name signing. I know there's a lot of opinions flying around the open-source .NET world regarding whether or not an open source project should publish its private key. Microsoft suggests it for open source projects, and while I don't view the strong-name key we use as a means of security, I do view it as a means of establishing a level of trust with developers using it. For that reason, I'm going to investigate using a separate, publicly-available key that will be published here on GitHub, while our internal build process will still use our own, private key. I'll be working on this setup over on the issue-101 branch if you'd like to see the changes (it's currently missing the public key as I play around with the project settings and). Until this change is finalized (which I'll use this thread to provide updates on), please feel free to voice your opinion of how the strong-name signing should be handled for an open source project. Thanks! 👍 |
Regarding strong-name signing - I agree with your approach. This may be open source, but I for one would definitely want to know whether the binary I'm using is signed by PayPal or someone else who may have "fiddled" with it (given it's accessible to everyone). Users who build the SDK themselves, can provide their own key for strong naming. |
- Addresses #101 - SDK and Tests projects are now both setup to be signed with a strong-name key in the projects here on GitHub. - NOTE: The released version of the SDK will continue to be signed with a private strong-name key.
Would yall mind trying out this beta release for version 1.4.4 and see if it resolves the .NET 4.6 RC compatibility issue? For NuGet, you can run the following command in the Package Manager console to get the 1.4.4 beta:
I tested this build on Windows 8.1 with .NET 4.6 RC. Using version 1.4.3, I was able to reproduce the error. Using 1.4.4 beta, the error went away, and I was able to successfully load the config (without the need for an Thanks! |
Had the same issue with 1.4.3 (rolling back to 1.4.2 helped!) |
Thanks for confirming, @hmemcpy! I'll get this officially released by the end of today (want to run another round of tests on it first). |
- Addresses #101 - SDK and Tests projects are now both setup to be signed with a strong-name key in the projects here on GitHub. - NOTE: The released version of the SDK will continue to be signed with a private strong-name key.
i used paypal 1.4.4 dll but it give me following error Unable to cast object of type 'PayPal.SDKConfigHandler' to type 'System.Xml.XmlNode |
@sandipgend this issue is very old and may or may not be the same root cause for your issue. With that said, please open a new issue with any/all specific details that you can provide. |
Hello,
I am trying to set up PayPal in a new MVC5 web application.
Your documentation doesn't state that you need to add in the
<accounts />
element from the<paypal />
section (only<settings />
) so I had to dig through the code to add it in.Sample code should look like this:
When
<accounts />
isn't there it throws this error:I'm now getting this really strange error when attempting to call ConfigManager.Instance.GetProperties(); The error message is:
Stack trace:
Do you have any idea on what is going on?
The text was updated successfully, but these errors were encountered: