@@ -81,7 +81,7 @@ private string GetActivityDetails(JsonElement activityRoot, out int activityType
8181 activityDescriptor = null ;
8282 activityTypeVersion = 0 ;
8383
84- // First we check whether the activity type name is a 'well-known' activity; not a workflow-as-activity
84+ // First, we check whether the activity type name is a 'well-known' activity; not a workflow-as-activity
8585
8686 // If the activity type version is specified, use that to find the activity descriptor.
8787 if ( activityRoot . TryGetProperty ( "version" , out var activityVersionElement ) )
@@ -101,16 +101,16 @@ private string GetActivityDetails(JsonElement activityRoot, out int activityType
101101 if ( activityRoot . TryGetProperty ( "workflowDefinitionVersionId" , out var workflowDefinitionVersionIdElement ) )
102102 {
103103 var activityDescriptorOverride = FindActivityDescriptorByCustomProperty ( "WorkflowDefinitionVersionId" , workflowDefinitionVersionIdElement ) ;
104- if ( activityDescriptorOverride is not null )
105- {
106- activityDescriptor = activityDescriptorOverride ;
107- activityTypeVersion = activityDescriptor . Version ;
108- }
104+ if ( activityDescriptorOverride is null )
105+ return activityTypeName ;
106+
107+ activityDescriptor = activityDescriptorOverride ;
108+ activityTypeVersion = activityDescriptor . Version ;
109109 }
110110 // This is also a special case when working with the WorkflowDefinitionActivity: if no 'well-known' activity could be found, it might be a workflow-as-activity with a workflowDefinitionId
111111 else if ( activityDescriptor is null
112- && activityRoot . TryGetProperty ( "workflowDefinitionId" , out var workflowDefinitionIdElement )
113- && workflowDefinitionIdElement . ValueKind == JsonValueKind . String )
112+ && activityRoot . TryGetProperty ( "workflowDefinitionId" , out var workflowDefinitionIdElement )
113+ && workflowDefinitionIdElement . ValueKind == JsonValueKind . String )
114114 {
115115 activityDescriptor = FindActivityDescriptorByCustomProperty ( "WorkflowDefinitionId" , workflowDefinitionIdElement ) ;
116116 activityTypeVersion = activityDescriptor ? . Version ?? 0 ;
@@ -123,13 +123,9 @@ private string GetActivityDetails(JsonElement activityRoot, out int activityType
123123 {
124124 if ( valueElement . ValueKind != JsonValueKind . String )
125125 return null ;
126-
126+
127127 var searchValue = valueElement . GetString ( ) ;
128- return activityRegistry . Find ( x =>
129- {
130- return x . CustomProperties . TryGetValue ( customPropertyName , out var value )
131- && ( string ? ) value == searchValue ;
132- } ) ;
128+ return activityRegistry . Find ( x => x . CustomProperties . TryGetValue ( customPropertyName , out var value ) && ( string ? ) value == searchValue ) ;
133129 }
134130
135131 private JsonSerializerOptions GetClonedOptions ( JsonSerializerOptions options )
@@ -140,7 +136,7 @@ private JsonSerializerOptions GetClonedOptions(JsonSerializerOptions options)
140136 clonedOptions . Converters . Add ( new ExpressionJsonConverterFactory ( expressionDescriptorRegistry ) ) ;
141137 return clonedOptions ;
142138 }
143-
139+
144140 private JsonSerializerOptions GetClonedWriterOptions ( JsonSerializerOptions options )
145141 {
146142 var clonedOptions = GetClonedOptions ( options ) ;
0 commit comments