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

Initialize-ACMEVault throws Error resolving type specified in JSON #139

Closed
jozefizso opened this issue May 27, 2016 · 4 comments
Closed

Comments

@jozefizso
Copy link

I am trying to create a new vault profile. When the Initialize-ACMEVault command executes it throws the Error resolving type specified in JSON 'ACMESharp.Vault.Profile.VaultProfile, ACMESharp.Vault'. Path '$type', line 2, position 67. exception.

$env:ACMESHARP_VAULT_PROFILE = 'vault1_profile'
$vault = 'c:\vault\vault1'
$vaultParams = @{ RootPath = $vault; CreatePath = $true }
Set-ACMEVaultProfile -ProfileName $env:ACMESHARP_VAULT_PROFILE -Provider local -VaultParameters $vaultParams -Force
Initialize-ACMEVault -BaseService LetsEncrypt-STAGING -Force -VaultProfile $env:ACMESHARP_VAULT_PROFILE

Initialize-ACMEVault : Error resolving type specified in JSON 'ACMESharp.Vault.Profile.VaultProfile, ACMESharp.Vault'. Path '$type', line 2, position 67.
At line:1 char:1
+ Initialize-ACMEVault -BaseService $service -Force -VaultProfile $env: ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Initialize-ACMEVault], JsonSerializationException
    + FullyQualifiedErrorId : Newtonsoft.Json.JsonSerializationException,ACMESharp.POSH.InitializeVault

The vault profile file looks like the others:

{
  "$type": "ACMESharp.Vault.Profile.VaultProfile, ACMESharp.Vault",
  "Name": "vault1_profile",
  "ProviderName": "local",
  "ProviderParameters": null,
  "VaultParameters": {
    "$type": "System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[System.Object, mscorlib]], mscorlib",
    "CreatePath": true,
    "RootPath": "c:\\vault\\vault1"
  }
}
@jozefizso
Copy link
Author

Some application installed Newtonsoft.Json into GAC. PowerShell was loading the GAC version of assembly and it caused the issue. Removing it from GAC fixed the problem.

gacutil -u Newtonsoft.Json

Uninstalled: Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL

@ebekker
Copy link
Owner

ebekker commented Jun 6, 2016

Thanks for troubleshooting this, I've added you issue details to the FAQ so others can benefit from your experience.

@ghost
Copy link

ghost commented Mar 19, 2018

I'm getting this same error and there is no assemblies found matching Newtonsoft.Json.

@srbrills
Copy link

srbrills commented Apr 5, 2018

Navigate to your local app data folder, and go to ACMESharp\vaultProfiles. In there, you will find a file that represents your vault profile in JSON. Remove the first '$type' node for the VaultProfile type, and it solved the issue for me.

If you look at the ACMESharp.JsonHelper generic Load method for streams, the JSON deserializer has serializer settings type name resolution set to automatic, which that behavior changes between IDEs. It might be better to have that setting set to not use any type name resolution based on declared .NET types, but I haven't tested changing it.

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

3 participants