2
Vote

System.InvalidOperationException: There is an error in XML document (5, 6).

description

running command "cpc ci" results in this exception. Full error message + stack trace is here:

c:\v1.2.15>cpc ci
Unhandled exception:
System.InvalidOperationException: There is an error in XML document (5, 6).
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(Stream stream)
at CodePlex.TfsLibrary.Utility.XmlSerializationRoot1.Deserialize(IFileSystem fileSystem, String path)
at CodePlex.TfsLibrary.Utility.CredentialsCache.Load()
at CodePlex.TfsLibrary.Utility.CredentialsCache.get_Item(String url)
at CodePlex.CodePlexClientLibrary.AuthenticatedCommand.GetCredentialsForUrl(String url)
at CodePlex.CodePlexClientLibrary.AuthenticatedCommand.OnCredentialCallback(ICredentials oldCredentials, String url)
at CodePlex.TfsLibrary.ClientEngine.TfsEngine.GetCredentials(String tfsUrl, Boolean force)
at CodePlex.TfsLibrary.ClientEngine.TfsEngine.SetupWorkspace(String localPath, Boolean includePendingEdits)
at CodePlex.TfsLibrary.ClientEngine.TfsEngine.Commit(String directory, String message, SourceItemCallback callback)
at CodePlex.CodePlexClientLibrary.CommitViewPresenter.Run(String localPath)
at CodePlex.CodePlexClientLibrary.StatusGuiView.Run()
at CodePlex.CodePlexClientLibrary.CommitCommand.Execute()
at CodePlex.CodePlexClientLibrary.ApplicationBase
1.Run(DependencyContainer container)
at CodePlex.CodePlexClientLibrary.ApplicationBase`1.Run()
System.Security.Cryptography.CryptographicException: Key not valid for use in specified state.

at System.Security.Cryptography.ProtectedData.Unprotect(Byte[] encryptedData, Byte[] optionalEntropy, DataProtectionScope scope)
at CodePlex.TfsLibrary.Utility.EncryptionUtil.DecryptString(String stringToDecrypt)
at CodePlex.TfsLibrary.Utility.CredentialsCacheEntry.set_Domain_Serialized(String value)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderCredentialsCacheEntries.Read2_CredentialsCacheEntry(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderCredentialsCacheEntries.Read3_entries()

The error is unnecessary, and the message is useless. It doesn't even tell me which XML file has the error. I had to look in the source code to find out. When I looked in the file, it seemed fine - there was no apparent error.

workaround: remove the file c:\users\<foo>\AppData\Local\Microsoft\Codeplex Client\CredentialsCache.xml .

The cpc executable

comments