DynamicsNinja / FlowExecutionHistory

XrmToolBox tool that allows you to browse Power Automate flow runs by applying multiple filters including multiple flows at the same time.
MIT License
10 stars 0 forks source link

The new version keeps having many issues #31

Closed emibanana closed 5 months ago

emibanana commented 6 months ago

Hi,

Sorry for bothering but the new versions (since 2023.10.20) has many unsolved issues and it is still happening. Quite frustrating...

For example when you select all flow in the environment, and ask the app to show flow in the last 48hrs, it works fine, but if you just go over some threadhold, for example, 72hrs? the app will crash with below error:

Error Time: 2024-05-21 09:57:44.589 System.InvalidOperationException Collection was modified; enumeration operation may not execute. Flow Execution History at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) at System.Collections.Generic.List1.Enumerator.MoveNextRare() at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable1 source, Func2 predicate) at Fic.XTB.FlowExecutionHistory.Services.FlowClient.GetFlowRunsFromCache(String flowId, String status, DateTimeOffset dateFrom) at Fic.XTB.FlowExecutionHistory.Services.FlowClient.GetFlowRuns(Flow flow, String status, DateTimeOffset dateFrom, DateTimeOffset dateTo, Int32 durationThreshold, Boolean includeTriggerOutputs) at Fic.XTB.FlowExecutionHistory.FlowExecutionHistory.<>c__DisplayClass27_0.<GetFlowRuns>b__3(Flow f) at System.Threading.Tasks.Parallel.<>c__DisplayClass17_01.b1() at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask) at System.Threading.Tasks.Task.<>cDisplayClass176_0.b__0(Object )

And then when you adjust the time back to 48hrs, it will crash again:

See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.

** Exception Text ** Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'System.Collections.Generic.Dictionary`2[System.String,System.Object]' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly. To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array. Path 'body', line 1, position 1240. at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureArrayContract(JsonReader reader, Type objectType, JsonContract contract) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings) at Fic.XTB.FlowExecutionHistory.Models.FlowRun.GetTriggerOutputs() at Fic.XTB.FlowExecutionHistory.Forms.TriggerOutputsFilterForm.UpdateAttributes() at Fic.XTB.FlowExecutionHistory.FlowExecutionHistory.<>cDisplayClass27_0.b2(RunWorkerCompletedEventArgs args) at XrmToolBox.Extensibility.Worker.<>cDisplayClass4_0.b0(Object s, RunWorkerCompletedEventArgs e) at System.ComponentModel.BackgroundWorker.OnRunWorkerCompleted(RunWorkerCompletedEventArgs e)

More errors can occur from time to time randomly, for example says index is out of bond, all errors generally occur when I select bigger time span to retrive the flow history, however I can really tell how "big" is "too big", you some time can trigger these errors with a very small time span and the app stuck forever (have to restart the entire xrmtoolbox!)

emibanana commented 6 months ago

Here is another issue that reported before but still unsolved:

Object reference not set to an instance of an object.

at Fic.XTB.FlowExecutionHistory.Services.FlowClient.<>cDisplayClass19_0.b0(FlowRunsCache x) at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable1 source, Func2 predicate) at Fic.XTB.FlowExecutionHistory.Services.FlowClient.GetFlowRunsFromCache(String flowId, String status, DateTimeOffset dateFrom) at Fic.XTB.FlowExecutionHistory.Services.FlowClient.GetFlowRuns(Flow flow, String status, DateTimeOffset dateFrom, DateTimeOffset dateTo, Int32 durationThreshold, Boolean includeTriggerOutputs) at Fic.XTB.FlowExecutionHistory.FlowExecutionHistory.<>cDisplayClass27_0.b3(Flow f) at System.Threading.Tasks.Parallel.<>cDisplayClass17_0`1.b1() at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask) at System.Threading.Tasks.Task.<>cDisplayClass176_0.b0(Object )

This can happen randomly when i change the time frame 1 day backwards / deselect a flow name / or even just a refresh, quite frustrating

emibanana commented 6 months ago

Hi, updates:

I have narrow down the issue, it is related to the app wasn't able to read the flow run history of one of my specific flow. As soon as I include this flow in the flow execution history app, random error will keep occuring, see below is the structure of my flow:

image

It involving taking a http request with a customised JSON input, and then deserialise the JSON and execute child flow.

An example input body will look like this:

"body": [
    {
        "key": "purchaseinvoice_project",
        "guid": "3b50f9de-1032-ee11-bdf3-00224893b259"
    }
]

image

DynamicsNinja commented 5 months ago

Today my colleague had the same issue, but only in situations when he is using "Select All" on the flow list, no matter the filter. Now I know how to reproduce it and have the environment to do it, I will try to keep you posted.

emibanana commented 4 months ago

BTW the issue still presist after almost 2 months:

See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.

** Exception Text ** Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'System.Collections.Generic.Dictionary`2[System.String,System.Object]' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly. To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array. Path 'body', line 1, position 1234. at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureArrayContract(JsonReader reader, Type objectType, JsonContract contract) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings) at Fic.XTB.FlowExecutionHistory.Models.FlowRun.GetTriggerOutputs() at Fic.XTB.FlowExecutionHistory.Forms.TriggerOutputsFilterForm.UpdateAttributes() at Fic.XTB.FlowExecutionHistory.FlowExecutionHistory.<>cDisplayClass27_0.b2(RunWorkerCompletedEventArgs args) at XrmToolBox.Extensibility.Worker.<>cDisplayClass4_0.b0(Object s, RunWorkerCompletedEventArgs e) at System.ComponentModel.BackgroundWorker.OnRunWorkerCompleted(RunWorkerCompletedEventArgs e)

======= very frustrated, also when it gets error it just crash the entire xrmtoolbox, this thing is a nuke

emibanana commented 4 months ago

De-selecting the "http" flow which contains the custom JSON object in trigger message will work, as I reported before.

Also this plugin's date range selection field is moved outside of the screen container for some reason

image

emibanana commented 4 months ago

just kindly want to see if you recieve this issue @DynamicsNinja

DynamicsNinja commented 4 months ago

I saw your comment, but at the moment I don't have time to investigate the issue you described, will try to give it a go next month.