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

Fix Full-Permissions Requirement #971

Closed
anelder-stripe opened this issue Jul 24, 2017 · 4 comments
Closed

Fix Full-Permissions Requirement #971

anelder-stripe opened this issue Jul 24, 2017 · 4 comments
Labels

Comments

@anelder-stripe
Copy link
Contributor

anelder-stripe commented Jul 24, 2017

Right now there is a full-permissions requirement on the library, which means it doesn't run on every framework. There are two things causing the problem:

Registry Access

https://github.com/stripe/stripe-dotnet/blob/master/src/Stripe.net/Infrastructure/Client.cs#L88-L95

This code is attempting to access the registry; which means it requires UnmanagedCode permissions. A possible fix (provided by the amazing Engineers at dotnetfiddle) would be something like this

 private static string getFrameworkFromRegistry()
{
    if (!AppDomain.CurrentDomain.IsFullyTrusted)
        return "unknown";

Internal Modifier for SourceConverter\StripeDateTimeConverter + Certain Properties

When Newtonsoft.Json tries to create converters with internal access or set values to internal properties, it fails. Placing this inside of an InternalsVisibleTo-file should fix it:

[assembly: InternalsVisibleTo("Newtonsoft.Json")]

I think this file -- https://github.com/stripe/stripe-dotnet/blob/212b53759ca190f1a2ede3c65d40c3c08a6ef103/src/Stripe.net/Properties/InternalsVisibleTo.cs

@anelder-stripe
Copy link
Contributor Author

@mickbyrne
Copy link

The registry access also means the Stripe.net library doesn't work when running Visual Studio for Mac. I've just logged a new issue for you about it, #990.

@ob-stripe
Copy link
Contributor

@anelder-stripe Heads up that I removed the registry access entirely in 15.3.1.

@ob-stripe
Copy link
Contributor

Closing this issue due to staleness. The registry access was fixed a long time ago.

Note that Stripe.net is still not usable on .NET Fiddle, but I believe this is because:

  1. Stripe.net uses Newtonsoft.Json
  2. Newtonsoft.Json provides both strong named and not strong named packages
  3. Stripe.net only provides not strong named packages
  4. The version of Newtonsoft.Json on .NET Fiddle is the strong named one
  5. Due to the way strong naming works, a not strong named package cannot use a strong named package

We've discussed the possibility of strong naming Stripe.net in another thread and eventually decided against it (#40 (comment)). I'm open to reconsidering this, but we haven't received any requests to do so in the past year. (If you're reading this and think Stripe.net should provide strong named packages, please open a new issue for it.)

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

No branches or pull requests

3 participants