Skip to content

Could not deserialize Json Text #1199

@NWessel

Description

@NWessel

I might be doing something wrong or misunderstanding how to use Rebus - I'm trying to receieve a message from Dataverse (Microsoft product) through the azure service bus, through a topic.

It might be a simple thing im missing..

I have the following code

DI
Image

Subscribe to topic
Image

Handle message (I've tried creating a class, using a string, object and now jsonnode - they all failed with similar error)
Image

I get the following error message

System.FormatException: Could not deserialize JSON text: '{"BusinessUnitId":"0f803ca6-c335-ef11-840a-000d3a25a1a8","CorrelationId":"292f1ed9-9197-4d43-92be-3217ad383d54","Depth":1,"InitiatingUserAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/134.0.0.0 Safari\/537.36 Edg\/134.0.0.0","InitiatingUserAzureActiveDirectoryObjectId":"b8dce20e-5d6e-4e7a-86f3-320550c914f3","InitiatingUserId":"9f873ca6-c335-ef11-840a-000d3a25a1a8","InputParameters":[{"key":"Target","value":{"__type":"Entity:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts","Attributes":[{"key":"pum_name","value":"Test financials December 2024s"},{"key":"pum_initiativeid","value":"1c55a645-ad97-4f7d-8889-a3f93ff0dd34"},{"key":"modifiedon","value":"\/Date(1741679163000)\/"},{"key":"modifiedby","value":{"__type":"EntityReference:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts","Id":"9f873ca6-c335-ef11-840a-000d3a25a1a8","KeyAttributes":[],"LogicalName":"systemuser","Name":null,"RowVersion":null}},{"key":"modifiedonbehalfby","value":null}],"EntityState":null,"FormattedValues":[],"Id":"1c55a645-ad97-4f7d-8889-a3f93ff0dd34","KeyAttributes":[],"LogicalName":"pum_initiative","RelatedEntities":[],"RowVersion":"4754260"}}],"IsExecutingOffline":false,"IsInTransaction":false,"IsOfflinePlayback":false,"IsolationMode":1,"MessageName":"Update","Mode":1,"OperationCreatedOn":"\/Date(1741679168000+0000)\/","OperationId":"c82d3be3-4cfe-ef11-bae3-00224880df6d","OrganizationId":"9a786e6b-2739-ef11-8e4b-000d3a4b6756","OrganizationName":"unq9a786e6b2739ef118e4b000d3a4b6","OutputParameters":[],"OwningExtension":{"Id":"7bc60dfb-9ee9-4770-8a7d-eb6683e2dc34","KeyAttributes":[],"LogicalName":"sdkmessageprocessingstep","Name":null,"RowVersion":null},"ParentContext":{"BusinessUnitId":"0f803ca6-c335-ef11-840a-000d3a25a1a8","CorrelationId":"292f1ed9-9197-4d43-92be-3217ad383d54","Depth":1,"InitiatingUserAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/134.0.0.0 Safari\/537.36 Edg\/134.0.0.0","InitiatingUserAzureActiveDirectoryObjectId":"b8dce20e-5d6e-4e7a-86f3-320550c914f3","InitiatingUserId":"9f873ca6-c335-ef11-840a-000d3a25a1a8","InputParameters":[{"key":"Target","value":{"__type":"Entity:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts","Attributes":[{"key":"pum_name","value":"Test financials December 2024s"},{"key":"pum_initiativeid","value":"1c55a645-ad97-4f7d-8889-a3f93ff0dd34"}],"EntityState":null,"FormattedValues":[],"Id":"1c55a645-ad97-4f7d-8889-a3f93ff0dd34","KeyAttributes":[],"LogicalName":"pum_initiative","RelatedEntities":[],"RowVersion":null}},{"key":"x-ms-app-name","value":"pum_PowerPPMEssentials"},{"key":"SuppressDuplicateDetection","value":false}],"IsExecutingOffline":false,"IsInTransaction":false,"IsOfflinePlayback":false,"IsolationMode":1,"MessageName":"Update","Mode":1,"OperationCreatedOn":"\/Date(1741679168000+0000)\/","OperationId":"c82d3be3-4cfe-ef11-bae3-00224880df6d","OrganizationId":"9a786e6b-2739-ef11-8e4b-000d3a4b6756","OrganizationName":"unq9a786e6b2739ef118e4b000d3a4b6","OutputParameters":[],"OwningExtension":{"Id":"7bc60dfb-9ee9-4770-8a7d-eb6683e2dc34","KeyAttributes":[],"LogicalName":"sdkmessageprocessingstep","Name":null,"RowVersion":null},"ParentContext":null,"PostEntityImages":[],"PreEntityImages":[],"PrimaryEntityId":"1c55a645-ad97-4f7d-8889-a3f93ff0dd34","PrimaryEntityName":"pum_initiative","RequestId":"4621ef1a-792c-4197-9ee9-eea553971599","SecondaryEntityName":"none","SharedVariables":[{"key":"IsAutoTransact","value":true},{"key":"AcceptLang","value":"en-US,en;q=0.9"},{"key":"x-ms-app-name","value":"pum_PowerPPMEssentials"},{"key":"ChangedEntityTypes","value":[{"__type":"KeyValuePairOfstringstring:#System.Collections.Generic","key":"pum_dependency","value":"Update"},{"__type":"KeyValuePairOfstringstring:#System.Collections.Generic","key":"pum_initiative","value":"Update"},{"__type":"KeyValuePairOfstringstring:#System.Collections.Generic","key":"fileattachment","value":"Create"}]}],"Stage":30,"UserAzureActiveDirectoryObjectId":"b8dce20e-5d6e-4e7a-86f3-320550c914f3","UserId":"9f873ca6-c335-ef11-840a-000d3a25a1a8"},"PostEntityImages":[{"key":"AsynchronousStepPrimaryName","value":{"Attributes":[{"key":"pum_name","value":"Test financials December 2024s"},{"key":"pum_initiativeid","value":"1c55a645-ad97-4f7d-8889-a3f93ff0dd34"}],"EntityState":null,"FormattedValues":[],"Id":"1c55a645-ad97-4f7d-8889-a3f93ff0dd34","KeyAttributes":[],"LogicalName":"pum_initiative","RelatedEntities":[],"RowVersion":null}}],"PreEntityImages":[],"PrimaryEntityId":"1c55a645-ad97-4f7d-8889-a3f93ff0dd34","PrimaryEntityName":"pum_initiative","RequestId":"4621ef1a-792c-4197-9ee9-eea553971599","SecondaryEntityName":"none","SharedVariables":[{"key":"IsAutoTransact","value":true},{"key":"AcceptLang","value":"en-US,en;q=0.9"},{"key":"x-ms-app-name","value":"pum_PowerPPMEssentials"}],"Stage":40,"UserAzureActiveDirectoryObjectId":"b8dce20e-5d6e-4e7a-86f3-320550c914f3","UserId":"9f873ca6-c335-ef11-840a-000d3a25a1a8"}' ---> System.ArgumentNullException: Value cannot be null. (Parameter 'returnType') at System.Text.Json.ThrowHelper.ThrowArgumentNullException(String parameterName) at System.Text.Json.JsonSerializer.Deserialize(ReadOnlySpan1 utf8Json, Type returnType, JsonSerializerOptions options)
at Rebus.Serialization.Json.SystemTextJsonSerializer.DeserializeUtf8(Byte[] body, Type type)
--- End of inner exception stack trace ---
at Rebus.Serialization.Json.SystemTextJsonSerializer.DeserializeUtf8(Byte[] body, Type type)
at Rebus.Serialization.Json.SystemTextJsonSerializer.GetMessage(TransportMessage transportMessage, Encoding bodyEncoding)
at Rebus.Serialization.Json.SystemTextJsonSerializer.Deserialize(TransportMessage transportMessage)
at Rebus.Compression.UnzippingSerializerDecorator.Deserialize(TransportMessage transportMessage)
at Rebus.Pipeline.Receive.DeserializeIncomingMessageStep.Process(IncomingStepContext context, Func1 next) at Rebus.DataBus.ClaimCheck.HydrateIncomingMessageStep.Process(IncomingStepContext context, Func1 next)
at Rebus.Retry.Simple.DefaultRetryStep.Process(IncomingStepContext context, Func1 next)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions