Azure / Azure/azure-stream-analytics
Custom deserializer does not output Nullable types
- Dominant language
- C#
- Stars
- 229
- Forks
- 920
- PR merge metrics
- No merged PRs in 30d
Description
According to [this page](https://learn.microsoft.com/en-us/azure/stream-analytics/custom-deserializer-examples), 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
```cs
public class Test
{
public int? OptionalInt { get; set; }
}
```
I get the following errors:
```json
{
"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"
}
}
```
```json
{
"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?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.