Error - Cannot Open Item

Hello, when trying to create a new project in StudioX whether it be from a blank task or a template I keep receiving the following error message. I have tried uninstalling and reinstalling StudioX to no avail. I am using StudioX 2021.4.1 Stable community License. What can I do to solve this? Thanks!

Error Cannot Open Item
21.4.1+Branch.master.Sha.69ff58090a26d41099d9308ed5608f70eff56035

The project ‘C:\Users\maura_skelton\Documents\UiPath\HelloWorld2\project.json’ could not be opened: Invalid character in the given encoding. Line 1, position 1…

Cannot open item: UiPath.Studio.Contracts.RecoverableException: The project ‘C:\Users\maura_skelton\Documents\UiPath\HelloWorld2\project.json’ could not be opened: Invalid character in the given encoding. Line 1, position 1…
—> System.Xml.XmlException: Invalid character in the given encoding. Line 1, position 1.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
at System.Xml.XmlTextReaderImpl.InvalidCharRecovery(Int32& bytesCount, Int32& charsCount)
at System.Xml.XmlTextReaderImpl.GetChars(Int32 maxCharsCount)
at System.Xml.XmlTextReaderImpl.ReadData()
at System.Xml.XmlTextReaderImpl.SwitchEncoding(Encoding newEncoding)
at System.Xml.XmlTextReaderImpl.ParseXmlDeclaration(Boolean isTextDecl)
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options)
at NuGet.Packaging.Core.NuspecCoreReaderBase.LoadXml(Stream stream, Boolean leaveStreamOpen)
at NuGet.Packaging.Core.NuspecCoreReaderBase…ctor(Stream stream, Boolean leaveStreamOpen)
at NuGet.Packaging.NuspecReader…ctor(Stream stream)
at NuGet.Protocol.LocalPackageFileCache.GetNuspec(String manifestPath, String expandedPath)
at NuGet.Protocol.LocalPackageFileCache.<>c__DisplayClass6_1.b__1()
at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode) --- End of stack trace from previous location --- at System.Lazy1.CreateValue()
at NuGet.Commands.LockFileUtils.CreateLockFileTargetLibrary(LibraryDependency libraryDependency, LockFileLibrary library, LocalPackageInfo package, RestoreTargetGraph targetGraph, LibraryIncludeFlags dependencyType, NuGetFramework targetFrameworkOverride, IEnumerable1 dependencies, LockFileBuilderCache cache) at NuGet.Commands.LockFileBuilder.CreateLockFile(LockFile previousLockFile, PackageSpec project, IEnumerable1 targetGraphs, IReadOnlyList1 localRepositories, RemoteWalkContext context) at NuGet.Commands.RestoreCommand.BuildAssetsFile(LockFile existingLockFile, PackageSpec project, IEnumerable1 graphs, IReadOnlyList1 localRepositories, RemoteWalkContext contextForProject) at NuGet.Commands.RestoreCommand.ExecuteAsync(CancellationToken token) at UiPath.NuGet.PackageManager.InstallCore(InstallPackageCommand installCommand) at UiPath.PackageExplorer.Core.Services.PackageInstaller.InstallWithRootPackageAssemblies(InstallPackageCommand installCommand) at UiPath.Studio.Core.Services.Packaging.PackageOperationBase.RestoreInternal(PackageOperationContext packageOperation, CancellationToken cancellationToken) at UiPath.Studio.Core.Services.Packaging.PackageOperationBase.<>c__DisplayClass23_0.<<Restore>b__0>d.MoveNext() --- End of stack trace from previous location --- at UiPath.Studio.Core.Services.Packaging.PackageOperationRestore.Execute(CancellationToken cancellationToken) at UiPath.Studio.Core.Services.Packaging.PackageService.RestoreProjectAsync(IProject project, CancellationToken cancellationToken) at UiPath.Studio.Plugin.Workflow.Shared.Project.BaseWorkflowProjectFactory.InitializeNewProjectModelInternal(String projectFilePath) at UiPath.Studio.Plugin.Workflow.Shared.Project.BaseWorkflowProjectFactory.OpenAsyncInternal(String path, IOpenOptions options) at UiPath.Studio.Plugin.Workflow.Shared.Project.BaseWorkflowProjectFactory.OpenAsync(String path, IOpenOptions options) at UiPath.Studio.Plugin.Workflow.Shared.Project.BaseWorkflowProjectFactory.OpenAsync(String path, IOpenOptions options) at UiPath.Studio.Core.Services.PersistableServiceBase3.OnOpenAsync(String path, IFactory2 resolvedFactory, IOpenOptions options) --- End of inner exception stack trace --- at UiPath.Studio.Core.Services.PersistableServiceBase3.OnOpenAsync(String path, IFactory2 resolvedFactory, IOpenOptions options) at UiPath.Studio.Core.CommonServices.ProjectServiceBase.OnOpenAsync(String path, IFactory2 resolvedFactory, IOpenOptions options)
at UiPath.Studio.Core.CommonServices.ProjectServiceBase.OnOpenAsync(String path, IFactory2 resolvedFactory, IOpenOptions options) at UiPath.Studio.Core.Services.PersistableServiceBase3.OpenAsync(OpenInformation openInfo)
at UiPath.Studio.Core.CommonServices.OpenCloseCommandsService.OpenProjectAsync(OpenInformation openInfo, IProject newProject)
at UiPath.Studio.Core.CommonServices.OpenCloseCommandsService.OpenNewProjectAsync(IProject newProjectItem)
at UiPath.Studio.Core.CommonServices.OpenCloseCommandsService.CreateNewProjectAsync(IProjectTemplate template)
at UiPath.Studio.Shell.ViewModels.StartPageViewModel.<>c__DisplayClass51_0.<b__0>d.MoveNext()
— End of stack trace from previous location —
at UiPath.Studio.Shell.ViewModels.StartPageViewModel.ExecuteCommand(Func1 commandExecute) at UiPath.Studio.Shell.ViewModels.StartPageViewModel.OnNewProjectCommand(String project) at UiPath.Studio.App.Desktop.MVVM.Commands.TaskCommand3.Execute(TExecuteParameter parameter, Boolean ignoreCanExecuteCheck)
at System.Threading.Tasks.Task.<>c.b__140_0(Object state)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler), HResult -2146233088

Rename the project.json file to something else like project.json.old then open the project. Pretty sure it’ll recreate the project.json file correctly.

If @postwick suggestion doesn’t work please supply the project.json

  1. First Delete json file or move to another folder
  2. And open Main.xaml
  3. New Project.json file be created automatically

Let me know if you still facing the issue

Hi Shubham, I tried this suggestion and am still facing the issure. I get this Open Document Error when I try to open the Main.xaml after deleting the json file. Uploading the json file here as well. Let me know if there is anything else I can do!
project.json (1.4 KB)
image
21.4.1+Branch.master.Sha.69ff58090a26d41099d9308ed5608f70eff56035

Invalid character in the given encoding. Line 1, position 1.

Open Document Error: UiPath.Studio.Contracts.RecoverableException
—> UiPath.Studio.Contracts.RecoverableException: The project ‘C:\Users\maura_skelton\Documents\UiPath\NewBlankTask2\project.json’ could not be opened: Invalid character in the given encoding. Line 1, position 1…
—> System.Xml.XmlException: Invalid character in the given encoding. Line 1, position 1.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
at System.Xml.XmlTextReaderImpl.InvalidCharRecovery(Int32& bytesCount, Int32& charsCount)
at System.Xml.XmlTextReaderImpl.GetChars(Int32 maxCharsCount)
at System.Xml.XmlTextReaderImpl.ReadData()
at System.Xml.XmlTextReaderImpl.SwitchEncoding(Encoding newEncoding)
at System.Xml.XmlTextReaderImpl.ParseXmlDeclaration(Boolean isTextDecl)
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options)
at NuGet.Packaging.Core.NuspecCoreReaderBase.LoadXml(Stream stream, Boolean leaveStreamOpen)
at NuGet.Packaging.Core.NuspecCoreReaderBase…ctor(Stream stream, Boolean leaveStreamOpen)
at NuGet.Packaging.NuspecReader…ctor(Stream stream, IFrameworkNameProvider frameworkProvider, Boolean leaveStreamOpen)
at NuGet.Packaging.NuspecReader…ctor(Stream stream)
at NuGet.Protocol.LocalPackageFileCache.GetNuspec(String manifestPath, String expandedPath)
at NuGet.Protocol.LocalPackageFileCache.<>c__DisplayClass6_1.b__1()
at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode) --- End of stack trace from previous location --- at System.Lazy1.CreateValue()
at NuGet.Commands.LockFileUtils.CreateLockFileTargetLibrary(LibraryDependency libraryDependency, LockFileLibrary library, LocalPackageInfo package, RestoreTargetGraph targetGraph, LibraryIncludeFlags dependencyType, NuGetFramework targetFrameworkOverride, IEnumerable1 dependencies, LockFileBuilderCache cache) at NuGet.Commands.LockFileBuilder.CreateLockFile(LockFile previousLockFile, PackageSpec project, IEnumerable1 targetGraphs, IReadOnlyList1 localRepositories, RemoteWalkContext context) at NuGet.Commands.RestoreCommand.BuildAssetsFile(LockFile existingLockFile, PackageSpec project, IEnumerable1 graphs, IReadOnlyList1 localRepositories, RemoteWalkContext contextForProject) at NuGet.Commands.RestoreCommand.ExecuteAsync(CancellationToken token) at UiPath.NuGet.PackageManager.InstallCore(InstallPackageCommand installCommand) at UiPath.PackageExplorer.Core.Services.PackageInstaller.InstallWithRootPackageAssemblies(InstallPackageCommand installCommand) at UiPath.Studio.Core.Services.Packaging.PackageOperationBase.RestoreInternal(PackageOperationContext packageOperation, CancellationToken cancellationToken) at UiPath.Studio.Core.Services.Packaging.PackageOperationBase.<>c__DisplayClass23_0.<<Restore>b__0>d.MoveNext() --- End of stack trace from previous location --- at UiPath.Studio.Core.Services.Packaging.PackageOperationRestore.Execute(CancellationToken cancellationToken) at UiPath.Studio.Core.Services.Packaging.PackageService.RestoreProjectAsync(IProject project, CancellationToken cancellationToken) at UiPath.Studio.Plugin.Workflow.Shared.Project.BaseWorkflowProjectFactory.InitializeNewProjectModelInternal(String projectFilePath) at UiPath.Studio.Plugin.Workflow.Shared.Project.BaseWorkflowProjectFactory.OpenAsyncInternal(String path, IOpenOptions options) at UiPath.Studio.Plugin.Workflow.Shared.Project.BaseWorkflowProjectFactory.OpenAsync(String path, IOpenOptions options) at UiPath.Studio.Plugin.Workflow.Shared.Project.BaseWorkflowProjectFactory.OpenAsync(String path, IOpenOptions options) at UiPath.Studio.Core.Services.PersistableServiceBase3.OnOpenAsync(String path, IFactory2 resolvedFactory, IOpenOptions options) --- End of inner exception stack trace --- at UiPath.Studio.Core.Services.PersistableServiceBase3.OnOpenAsync(String path, IFactory2 resolvedFactory, IOpenOptions options) at UiPath.Studio.Core.CommonServices.ProjectServiceBase.OnOpenAsync(String path, IFactory2 resolvedFactory, IOpenOptions options)
at UiPath.Studio.Core.CommonServices.ProjectServiceBase.OnOpenAsync(String path, IFactory2 resolvedFactory, IOpenOptions options) at UiPath.Studio.Core.Services.PersistableServiceBase3.OpenAsync(OpenInformation openInfo)
at UiPath.Studio.Core.CommonServices.OpenCloseCommandsService.OpenDocumentAsync(OpenInformation openInfo)
— End of inner exception stack trace —
at UiPath.Studio.Core.CommonServices.OpenCloseCommandsService.OpenDocumentAsync(OpenInformation openInfo)
at UiPath.Studio.Core.CommonServices.OpenCloseCommandsService.OpenPath(String filePath)
at UiPath.Studio.Shell.ShellApplication.StudioShellApplication.ProcessWithCommandLine()
at UiPath.Studio.Shell.ShellApplication.StudioShellApplication.<>c__DisplayClass19_0.<b__0>d.MoveNext()
— End of stack trace from previous location —
at System.Threading.Tasks.Task.<>c.b__140_0(Object state)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler), HResult -2146233088

Hello, can you share the project entirely ? We would like to have a look at it. Also if possible we would like to get the logs ( %localappdata%/UiPath/Logs)

Regards,
Dragos.

Sure! This error has happened with any project I’ve tried to create. I tried the solutions proposed above on several of them. Let me know if there is anything else needed. Thanks!

Project:
NewBlankTask2.zip (113.6 KB)

Logs:
Logs.zip (9.4 KB)

Seems a problem with the Nuget cache. Could you please try deleting the Packages folder in the
%USERPROFILE%/.nuget folder?

And, after this, try to create a new project in StudioX again?

2 Likes

Thank you Flavius! This was the solution and I am able to create a new project now.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.