Invalid character in the given encoding. line 1 position 1

Hi,

I unable to create a new project - I reinstalled - deleted all folders - tried everything but no luck.

invalid character in the given encoding. line 1 position 1 is the error.
logs:
21.4.4+Branch.master.Sha.a8b5101efe02651274064093e9c7410fedff7696

The project ‘C:\Users\karamj\Documents\UiPath\NewBlankTask1\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\karamj\Documents\UiPath\NewBlankTask1\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.Protocol.LocalPackageFileCache.GetNuspec(String manifestPath, String expandedPath)
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__DisplayClass52_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

I have the same issue

@Jad_Karami


go to %USERPROFILE%/.nuget and delate packages and it will work

Hi Mariyem,

I tried searching %USERPROFILE%/.nuget but I was not able to find anything.

However, I did manually search for packages and I deleted the folder but I am getting below error now :
21.4.4+Branch.master.Sha.a8b5101efe02651274064093e9c7410fedff7696

Could not find a part of the path ‘C:\Users\karamj\AppData\Local\UiPath\app-21.4.4\ProjectTemplates\Business Project’.

Cannot create new item: UiPath.Studio.Contracts.RecoverableException
—> System.IO.DirectoryNotFoundException: Could not find a part of the path ‘C:\Users\karamj\AppData\Local\UiPath\app-21.4.4\ProjectTemplates\Business Project’.
at System.IO.Enumeration.FileSystemEnumerator1.CreateDirectoryHandle(String path, Boolean ignoreNotFound) at System.IO.Enumeration.FileSystemEnumerator1.Init()
at System.IO.Enumeration.FileSystemEnumerable1..ctor(String directory, FindTransform transform, EnumerationOptions options, Boolean isNormalized) at System.IO.Enumeration.FileSystemEnumerableFactory.UserFiles(String directory, String expression, EnumerationOptions options) at System.IO.Directory.InternalEnumeratePaths(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options) at System.IO.Directory.GetFiles(String path) at System.IO.Abstractions.DirectoryWrapper.GetFiles(String path) at UiPath.Studio.Shared.FileSystemExtensions.DirectoryCopy(IFileSystem fileSystem, String from, String dest, Func2 directoryFilter, Func2 fileFilter, Boolean overwrite) at UiPath.Studio.Plugin.Workflow.Shared.Project.Templates.Strategies.ProjectTemplateCopyStrategy.Copy(IExtendedFileSystem fileSystem, IProjectTemplate temptate, String projectTemplatePath) at UiPath.Studio.Plugin.Workflow.Shared.Project.BaseWorkflowProjectFactory.CreateNewAsyncInternal(IProjectTemplate template, ProjectTemplate projectTemplate) at UiPath.Studio.Core.Services.PersistableServiceBase3.OnNewAsync(TTemplate template, IFactory2 resolvedFactory) --- End of inner exception stack trace --- at UiPath.Studio.Core.Services.PersistableServiceBase3.OnNewAsync(TTemplate template, IFactory2 resolvedFactory) at UiPath.Studio.Core.CommonServices.ProjectServiceBase.OnNewAsync(IProjectTemplate template, IFactory2 resolvedFactory)
at UiPath.Studio.Core.Services.PersistableServiceBase3.CreateNewAsync(TTemplate template) at UiPath.Studio.Core.CommonServices.ProjectServiceBase.CreateNewAsync(IProjectTemplate template) at UiPath.Studio.Core.CommonServices.OpenCloseCommandsService.CreateNewProjectAsync(IProjectTemplate template) at UiPath.Studio.Shell.ViewModels.StartPageViewModel.<>c__DisplayClass52_0.<<OnNewProjectCommand>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.TaskCommand`3.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

Hi @Jad_Karami did you move the packages on nuget file ?
if you removed the one in UI path please recover the file from" recycle bin "
and cherche for nuget and delete packages.

Blockquote