-
Notifications
You must be signed in to change notification settings - Fork 55
Fix NullReferenceException when history contains entity events #617
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
b6168ef
59dfa2e
1ae6146
99ee0e7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -523,10 +523,19 @@ public override async Task<IList<HistoryEvent>> GetOrchestrationHistoryAsync( | |
| using AsyncServerStreamingCall<P.HistoryChunk> streamResponse = | ||
| this.sidecarClient.StreamInstanceHistory(streamRequest, cancellationToken: cancellation); | ||
|
|
||
| Microsoft.DurableTask.ProtoUtils.EntityConversionState? entityConversionState = | ||
| this.options.EnableEntitySupport | ||
| ? new(insertMissingEntityUnlocks: false) | ||
|
||
| : null; | ||
|
|
||
| Func<P.HistoryEvent, HistoryEvent> converter = entityConversionState is null | ||
| ? Microsoft.DurableTask.ProtoUtils.ConvertHistoryEvent | ||
| : entityConversionState.ConvertFromProto; | ||
|
|
||
| List<HistoryEvent> pastEvents = []; | ||
| while (await streamResponse.ResponseStream.MoveNext(cancellation)) | ||
| { | ||
| pastEvents.AddRange(streamResponse.ResponseStream.Current.Events.Select(DurableTask.ProtoUtils.ConvertHistoryEvent)); | ||
| pastEvents.AddRange(streamResponse.ResponseStream.Current.Events.Select(converter)); | ||
| } | ||
|
|
||
| return pastEvents; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -124,8 +124,12 @@ public static string LoadAndRun( | |
| P.OrchestratorRequest request = P.OrchestratorRequest.Parser.Base64Decode<P.OrchestratorRequest>( | ||
| encodedOrchestratorRequest); | ||
|
|
||
| List<HistoryEvent> pastEvents = request.PastEvents.Select(ProtoUtils.ConvertHistoryEvent).ToList(); | ||
| IEnumerable<HistoryEvent> newEvents = request.NewEvents.Select(ProtoUtils.ConvertHistoryEvent); | ||
| ProtoUtils.EntityConversionState entityConversionState = new(insertMissingEntityUnlocks: false); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dont we need instanceid specified here?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The orchestration instance ID is automatically set when the ExecutionStarted event is processed during history conversion (see ProtoUtils.cs line 62: |
||
|
|
||
| Func<P.HistoryEvent, HistoryEvent> converter = entityConversionState.ConvertFromProto; | ||
|
|
||
| List<HistoryEvent> pastEvents = request.PastEvents.Select(converter).ToList(); | ||
| IEnumerable<HistoryEvent> newEvents = request.NewEvents.Select(converter); | ||
| Dictionary<string, object?> properties = request.Properties.ToDictionary( | ||
| pair => pair.Key, | ||
| pair => ProtoUtils.ConvertValueToObject(pair.Value)); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this has nothing to do with enableentitysupport, remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 99ee0e7. EntityConversionState is now always created regardless of EnableEntitySupport since history may contain entity events even if the client option is disabled.