-
Notifications
You must be signed in to change notification settings - Fork 16
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
Appears when subscribing after publishing an event:System.FormatException: Could not deserialize JSON text #3
Comments
I added a parameterless constructor, please try again with v0.3.1, thanks. |
Please check your module dependency. Lines 17 to 22 in a47f1b5
|
I am using the 0.3.1 package directly now, and still can't receive messages. The error message is as follows
|
Could you please try this code: context.Services.AddTransient<CreateEmailNotificationEventHandler>(); |
Very good. After adding this sentence, emails can be sent normally, and parameters can also be passed normally. I hope it can be added to the document, so that other people will not encounter this problem |
|
Please create a new issue, thank you. |
ok It's already created. |
I installed in the Domain project EasyAbp.NotificationService.Domain and EasyAbp.NotificationService.Provider.Mailing packages, and introduced in DomainModule module:
The code follows the source code example to write the test:
However, the console did report the following error and did not execute the subscription event:
Detailed error message:
---> (Inner Exception #4) System.FormatException: Could not deserialize JSON text: '{"$type":"EasyAbp.NotificationService.Provider.Mailing.CreateEmailNotificationEto, EasyAbp.NotificationService.Provider.Mailing.Abstractions","Subject":"test","Body":"","TenantId":null,"UserIds":{"$type":"System.Collections.Generic.List
1[[System.Guid, System.Private.CoreLib]], System.Private.CoreLib","$values":["1a5d39c8-2822-42e0-a92e-39fae1a6a4ab"]}}'---> Newtonsoft.Json.JsonSerializationException: Unable to find a constructor to use for type EasyAbp.NotificationService.Provider.Mailing.CreateEmailNotificationEto. A class should either have a default constructor, one constructor with arguments or a constructor marked with the JsonConstructor attribute. Path 'Subject', line 1, position 152.
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject(JsonReader reader, JsonObjectContract objectContract, JsonProperty containerMember, JsonProperty containerProperty, String id, Boolean& createdFromNonDefaultCreator)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Rebus.Serialization.Json.JsonSerializer.Deserialize(String bodyString, Type type)
--- End of inner exception stack trace ---
at Rebus.Serialization.Json.JsonSerializer.Deserialize(String bodyString, Type type)
at Rebus.Serialization.Json.JsonSerializer.GetMessage(TransportMessage transportMessage, Encoding bodyEncoding)
at Rebus.Serialization.Json.JsonSerializer.Deserialize(TransportMessage transportMessage)
at Rebus.Compression.UnzippingSerializerDecorator.Deserialize(TransportMessage transportMessage)
at Rebus.Pipeline.Receive.DeserializeIncomingMessageStep.Process(IncomingStepContext context, Func
1 next) at Rebus.DataBus.ClaimCheck.HydrateIncomingMessageStep.Process(IncomingStepContext context, Func
1 next)at Rebus.Retry.FailFast.FailFastStep.Process(IncomingStepContext context, Func
1 next) at Rebus.Retry.Simple.SimpleRetryStrategyStep.DispatchWithTrackerIdentifier(Func
1 next, String identifierToTrackMessageBy, ITransactionContext transactionContext, String messageId, String secondLevelMessageId)<---`
Add error messages when using SMS for testing:
---> (Inner Exception #4) System.FormatException: Could not deserialize JSON text: '{"$type":"EasyAbp.NotificationService.Provider.Sms.CreateSmsNotificationEto, EasyAbp.NotificationService.Provider.Sms.Abstractions","Text":"test","Properties":{"$type":"System.Collections.Generic.Dictionary
2[[System.String, System.Private.CoreLib],[System.Object, System.Private.CoreLib]], System.Private.CoreLib","MyProperty":"123456"},"TenantId":null,"UserIds":{"$type":"System.Collections.Generic.List1[[System.Guid, System.Private.CoreLib]], System.Private.CoreLib","$values":["1a5d39c8-2822-42e0-a92e-39fae1a6a4ab"]}}' ---> Newtonsoft.Json.JsonSerializationException: Unable to find a constructor to use for type EasyAbp.NotificationService.Provider.Sms.CreateSmsNotificationEto. A class should either have a default constructor, one constructor with arguments or a constructor marked with the JsonConstructor attribute. Path 'Text', line 1, position 139. at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject(JsonReader reader, JsonObjectContract objectContract, JsonProperty containerMember, JsonProperty containerProperty, String id, Boolean& createdFromNonDefaultCreator) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) at Rebus.Serialization.Json.JsonSerializer.Deserialize(String bodyString, Type type) --- End of inner exception stack trace --- at Rebus.Serialization.Json.JsonSerializer.Deserialize(String bodyString, Type type) at Rebus.Serialization.Json.JsonSerializer.GetMessage(TransportMessage transportMessage, Encoding bodyEncoding) at Rebus.Serialization.Json.JsonSerializer.Deserialize(TransportMessage transportMessage) at Rebus.Compression.UnzippingSerializerDecorator.Deserialize(TransportMessage transportMessage) at Rebus.Pipeline.Receive.DeserializeIncomingMessageStep.Process(IncomingStepContext context, Func
1 next)at Rebus.DataBus.ClaimCheck.HydrateIncomingMessageStep.Process(IncomingStepContext context, Func
1 next) at Rebus.Retry.FailFast.FailFastStep.Process(IncomingStepContext context, Func
1 next)at Rebus.Retry.Simple.SimpleRetryStrategyStep.DispatchWithTrackerIdentifier(Func
1 next, String identifierToTrackMessageBy, ITransactionContext transactionContext, String messageId, String secondLevelMessageId)<---
The text was updated successfully, but these errors were encountered: