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

Incompatible with PowerShell Core due to Newtonsoft.Json 11.0.1 #112

Closed
NiknakSi opened this issue May 28, 2018 · 2 comments
Closed

Incompatible with PowerShell Core due to Newtonsoft.Json 11.0.1 #112

NiknakSi opened this issue May 28, 2018 · 2 comments

Comments

@NiknakSi
Copy link
Contributor

I'm unable to use the Certes library in PowerShell Core due to the dependency on NewtonSoft.Json 11.0.1. At present you will receive a type init exception as soon as you try to create a new AcmeContext. This is due to the unique way pwsh works where it will stick with the first version of a module it loads, and unfortunately since pwsh itself has a dependency on Newtonsoft.Json, it sticks with the version it loads on startup.

See here: PowerShell/PowerShell#2083

Currently there is no way for a module to have its own AppDomain or context. Until the PowerShell team fix that (maybe in 6.2), please could you revert the version of Newtonsoft.Json used by Certes to 10.0.3? I've grabbed the repo, made the change, and it compiled ok. The referenced assembly then works ok in PowerShell Core.

@fszlin
Copy link
Owner

fszlin commented May 29, 2018

Hi @NiknakSi , I am not sure this is a proper solution, but it’s fine to me if this allows you to use Certes in PowerShell core.

Looks like you have the changes ready, feel free to send a pull request. 😉
Does it require exactly 10.0.3? will 10.0.1 or 9.0.1 compatible?

@NiknakSi
Copy link
Contributor Author

I agree it's not really a proper solution, but it's the only one I can see at the moment. Microsoft may add better isolation for imported modules and/or assembly redirects. PowerShell 5.1 is fine at the moment.

It does need to be exactly 10.0.3 since that's what PS Core is using. The Nuspec should be ok with >= 10.0.3 in it though.

I've setup a PR, #115

Thanks :)

fszlin pushed a commit that referenced this issue May 30, 2018
* Changed to Newtonsoft.Json 10.0.3 for PowerShell Core

PowerShell Core only supports one version of a referenced assembly per session and it already references Newtonsoft.Json 10.0.3 internally, so provides no opportunity for Certes to reference version 11.x. Until this situation is resolved by Microsoft (potentially in PowerShell Core 6.2) the only workaround is to change the dependency here. See PowerShell/PowerShell#2083 and PowerShell/PowerShell#6757

#112
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