Read Text File - Exception Has Been Thrown

Been using read text file all day and now all of a sudden as soon as i add a new read textfile activity I get the Exception Thrown and the below error

26.0.182-cloud.21895+Branch.release-s182.Sha.a13df80d2b59a230f75f9a3da59183d0d94f3298.a13df80d2b59a230f75f9a3da59183d0d94f3298

Exception has been thrown by the target of an invocation.

Error: System.Exception: Exception has been thrown by the target of an invocation.
—> System.Exception: A TwoWay or OneWayToSource binding cannot work on the read-only property ‘Content’ of type ‘System.Activities.Presentation.Model.ModelItemImpl’.
at MS.Internal.Data.PropertyPathWorker.CheckReadOnly(Object item, Object info)
at MS.Internal.Data.PropertyPathWorker.ReplaceItem(Int32 k, Object newO, Object parent)
at MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32 k, ICollectionView collectionView, Object newValue, Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.Activate(Object item)
at System.Windows.Data.BindingExpression.AttachToContext(AttachAttempt attempt)
at System.Windows.Data.BindingExpression.AttachOverride(DependencyObject target, DependencyProperty dp)
at System.Windows.Data.BindingExpressionBase.Attach(DependencyObject target, DependencyProperty dp)
at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
at System.Windows.Data.BindingOperations.SetBinding(DependencyObject target, DependencyProperty dp, BindingBase binding)
at UiPath.Studio.Plugin.Workflow.Presentation.ArgumentHelper.SetExpressionBinding(ExpressionTextBox expressionTextBox, ArgumentDirection argumentDirection, IWidgetViewModel viewModel)
at UiPath.Studio.Plugin.Workflow.Presentation.SimpleExpressionWidget.SetExpressionTextBoxBinding()
at UiPath.Studio.Plugin.Workflow.Presentation.SimpleExpressionWidget.OnExpressionTextBoxLoaded()
at InvokeStub_SimpleExpressionWidget.OnExpressionTextBoxLoaded(Object, Object, IntPtr*)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
— End of inner exception stack trace —
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
at Microsoft.Xaml.Behaviors.Core.CallMethodAction.Invoke(Object parameter)
at Microsoft.Xaml.Behaviors.TriggerBase.InvokeActions(Object parameter)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root)
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
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 -2146232828

Check this thread, different scenario but same error .

I don’t even understand that solution

restart machine and delete project.json ?

Ive now opened a back up copy (losing all my work)

and still can’t add Read Text File without it giving the error

Sometimes project.json can get corrupted.
Deleting it forces Studio to recreate a fresh project.json, removing invalid or broken entries.
If the cache and project.json are out of sync then you can get random designer/runtime errors.
Removing it and restarting helps UiPath rebuild everything cleanly.

You should always include “make a backup copy” not just “delete project.json” - there are lots of things that can be lost when you delete project.json

but how do I open the project, without project.json

Ive been at this a while and always open via the json. Ive tried loading using a workflow file but all my dependancies are now missing etc

@rmorgan

when you delete project.json it would be recreated with basic packages and not all that you install

did you happen to recently upgrade studio or packages?

any other changes to project

cheers

You open a project by double-clicking one of the XAML files.

Make sure to make a backup copy of project.json - don’t just delete it.

You will also need to reinstall your dependencies. You may also lose other project settings.

This happens on a brand new project as well just tested it

read text file is fine until I install Web.Activities packages then it starts the error

have downgraded the Web.Activities package to the earliest version and its fine now

This has been confirmed by UiPath as a compatability issue between the latest paackages

,the root cause appears to be a dependency conflict between UiPath.WebAPI.Activities and UiPath.System.Activities. Specifically, there is a version mismatch in the UiPath.Platform dependency, which is causing this exception in Studio

I’d strongly advise always ignoring the suggestion to delete the project.json. Maybe 5-6 years ago it was kind of ok to basically ‘reset’ dependencies, but these days you lose so much stuff by deleting it that its terrible advice and very rarely will it solve anything in my opinion.

Its a layover of brute force, guessing until it works, type of debugging.

Regarding your actual root cause, dependency conflict. Make sense, try to include that in descriptions of your issue, you mentioned you’d been using it fine all day, but neglected to mention that you updated some dependencies and that caused the conflict.

Its a good idea to use source control, so you can easily revert back to working versions to compare what changes you have made, so if you aren’t doing it I would suggest that.

Now although what your saying is true, there is another behaviour that occured that I ommited.

I’d actually managed to use the deserialise XML in another work flow without actually having the WebAPI package installed I don’t know how in a new sequence.

The issue occured when I added the XML derserialise to another already existing sequence that it installed the WebAPI package and the issue started.