Skip to content

Conversation

@abannsunny
Copy link
Contributor

Trying to bind to the DrawingComplete eventcallback resulted in this error:

       Uncaught (in promise) Error: System.NotSupportedException: Deserialization of types without a parameterless constructor, a singular parameterized constructor, or a parameterized constructor annotated with 'JsonConstructorAttribute' is not supported. Type 'AzureMapsControl.Components.Atlas.Feature'. Path: $.data | LineNumber: 0 | BytePositionInLine: 34.
 ---> System.NotSupportedException: Deserialization of types without a parameterless constructor, a singular parameterized constructor, or a parameterized constructor annotated with 'JsonConstructorAttribute' is not supported. Type 'AzureMapsControl.Components.Atlas.Feature'.
   --- End of inner exception stack trace ---
   at System.Text.Json.ThrowHelper.ThrowNotSupportedException(ReadStack& state, Utf8JsonReader& reader, NotSupportedException ex)

Turns out it was a system.text.json error because the AzureMapsControl.Components.Atlas.Feature class is an abstract class.
I took out the abstract keyword and tested it and it works.

  • Please verify that the linting of the typescript is valid using npm run lint under src/AzureMapsControl.Components. Did this
  • Please verify that the library also compiles with a release configuration using dotnet build -c Release before creating your pull request. Did this
  • Please be sure that all the unit tests are passing using dotnet test. Did this
  • Please verify that the rules in .editorconfig are respected. Did this
  • Please update the documentation if necessary. Not needed

@abannsunny
Copy link
Contributor Author

I just pushed new changes to the PR. Could you please take a look?

I did run into an issue while writing tests.
JsonSerializer.Serialize(feature); will not use my overriden Write function:
public override void Write(Utf8JsonWriter writer, Feature value, JsonSerializerOptions options)

I would appreciate it if you can let me know why it is behaving that way.

So I had to send in _jsonSerializerOptions forcing it to use camel case like so .
JsonSerializer.Serialize(result, _jsonSerializerOptions)

Let me know if I can improve upon this. Also if you need me to do more work on the PR let me know. I tested the sample application and it works well.

Thank you!

Copy link
Owner

@arnaudleclerc arnaudleclerc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, thanks for implementing that!

@arnaudleclerc
Copy link
Owner

I did run into an issue while writing tests.
JsonSerializer.Serialize(feature); will not use my overriden Write function:
public override void Write(Utf8JsonWriter writer, Feature value, JsonSerializerOptions options)

I would appreciate it if you can let me know why it is behaving that way.

I will try to take a look at it and come back to you if I find the reason why.

@arnaudleclerc arnaudleclerc merged commit 8393100 into arnaudleclerc:develop Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants