Fix Output converter
This commit is contained in:
parent
a64860273b
commit
fec0f74c51
|
|
@ -115,7 +115,7 @@ public abstract class ActivityWithResult : Activity
|
|||
{
|
||||
if (output != null) Result = new Output(output);
|
||||
}
|
||||
|
||||
|
||||
protected ActivityWithResult(Output? output)
|
||||
{
|
||||
Result = output;
|
||||
|
|
@ -137,16 +137,22 @@ public abstract class Activity<T> : ActivityWithResult
|
|||
protected Activity(MemoryReference? output) : base(output)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
protected Activity(Output? output) : base(output)
|
||||
{
|
||||
}
|
||||
|
||||
public Activity<T> CaptureResult(MemoryReference output)
|
||||
{
|
||||
Result = new Output(output);
|
||||
Result = new Output<T>(output);
|
||||
return this;
|
||||
}
|
||||
|
||||
public new Output<T>? Result
|
||||
{
|
||||
get => base.Result as Output<T>;
|
||||
set => base.Result = value;
|
||||
}
|
||||
}
|
||||
|
||||
internal record SignalHandlerRegistration(Type SignalType, Func<object, SignalContext, ValueTask> Handler);
|
||||
|
|
@ -13,7 +13,7 @@ public class OutputJsonConverterFactory : JsonConverterFactory
|
|||
|
||||
public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
var type = typeToConvert.GetGenericArguments().First();
|
||||
var type = typeToConvert.GetGenericArguments().FirstOrDefault() ?? typeof(object);
|
||||
return (JsonConverter)ActivatorUtilities.CreateInstance(_serviceProvider, typeof(OutputJsonConverter<>).MakeGenericType(type))!;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue