Skip to content

Commit

Permalink
Ignore type warning in IotHubEventSerializer
Browse files Browse the repository at this point in the history
  • Loading branch information
mburumaxwell committed Nov 21, 2023
1 parent bc89e15 commit d2888cd
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ public IotHubEventSerializer(IOptionsMonitor<EventBusSerializationOptions> optio
if (source == IotHubEventMessageSource.Telemetry)
{
telemetry = await JsonNode.ParseAsync(utf8Json: stream, cancellationToken: cancellationToken).ConfigureAwait(false);

//var @event = new IotHubEvent { Source = source, Telemetry = telemetry, };
//return new EventEnvelope<T> { Event = @event, };
}
else if (source is IotHubEventMessageSource.TwinChangeEvents
or IotHubEventMessageSource.DeviceLifecycleEvents
Expand All @@ -67,11 +64,11 @@ or IotHubEventMessageSource.DeviceLifecycleEvents
OperationTimestamp = operationTimestamp,
Payload = payload,
};

//var @event = new IotHubEvent { Source = source, Event = opevent, };
}

#pragma warning disable IL2087
var @event = (T?)Activator.CreateInstance(targetType);
#pragma warning restore IL2087
var ihe = @event as IotHubEvent ?? throw new InvalidOperationException($"The event of type '{targetType.FullName}' could not be cast to '{BaseType.FullName}'.");
ihe.Source = source;
ihe.Telemetry = telemetry;
Expand Down

0 comments on commit d2888cd

Please sign in to comment.