Skip to content
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

Custom deserializer does not output Nullable types #169

Open
woppa684 opened this issue Jun 5, 2023 · 0 comments
Open

Custom deserializer does not output Nullable types #169

woppa684 opened this issue Jun 5, 2023 · 0 comments

Comments

@woppa684
Copy link

woppa684 commented Jun 5, 2023

According to this page, nullable types should be possible:

  • T is a class or a struct.
  • All public fields in T are either
    • One of [sbyte, byte, short, ushort, int, uint, long, DateTime, string, float, double] or their nullable equivalents.
    • Another struct or class following the same rules.
    • Array of type T2 that follows the same rules.
    • IListT2 where T2 follows the same rules.
    • Doesn't have any recursive types.

When trying to output a class like

public class Test
{
    public int? OptionalInt { get; set; }
}

I get the following errors:

{
    "eventName": "streamingNode0.output-output#0$0",
    "time": "2023-06-05T09:12:59.1792641Z",
    "resourceId": "",
    "operationName": "Send Events",
    "category": "Execution",
    "status": "Failed",
    "level": "Warning",
    "properties": {
        "Message": "Output adapter has encountered an error while preparing data to be sent.",
        "Type": "OutputAdapterError",
        "Correlation ID": "de3007a5-072b-42b1-b4b4-6f5000b05a56",
        "Error": "- Cannot convert value of type 'System.Int32' to JSON!\r\n"
    }
}
{
    "eventName": "output-output#0$0",
    "time": "2023-06-05T09:12:59.1638651Z",
    "resourceId": "output",
    "operationName": "",
    "category": "UnsupportedDataTypeError",
    "status": "",
    "level": "Warning",
    "properties": {
        "BriefMessage": "Column [OptionalInt] contains value with unsupported data type 'System.Int32'",
        "Message": "Column [OptionalInt] contains value with unsupported data type 'System.Int32'",
        "EventCount": 0
    }
}

Changing int? to int makes it work as expected. Am I doing something wrong or is this not supported?

@woppa684 woppa684 changed the title Custom deserializer does not decode Nullable types Custom deserializer does not output Nullable types Jun 5, 2023
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

No branches or pull requests

1 participant