Azure / Azure/azure-functions-dotnet-worker
EventGridEvent 'data property' empty when ObjectSerializer set to NewtonsoftJsonObjectSerializer
- Dominant language
- C#
- Stars
- 466
- Forks
- 215
- Avg merge
- 3d 10h
- Merged PRs (30d)
- 7
Description
I am using NewtonsoftJsonObjectSerializer in the workerdefault settings. I set this like so:
```
.ConfigureFunctionsWorkerDefaults((hostContext, applicationBuilder) =>
{
...
}, o =>
{
o.Serializer = new NewtonsoftJsonObjectSerializer(JsonUtils.JsonSerializerSettings);
})
```
Now when I create a EventGridEvent object and sent is trough an output binding the data property is filled but when I receive it in my logic app the data property is empty:

This is how I create the messages:
```
[EventGridOutput(TopicEndpointUri = "IfsEmployeeEventGridTopicUriSetting", TopicKeySetting = "IfsEmployeeEventGridTopicKeySetting")]
public async Task> Run(
.....
var employeeChanges = await _gech.Execute();
var eventMessages = employeeChanges
.Select(m => new EventGridEvent($"{m.Subject}", "Employee", "1.0", m)
{
Id = $"{m.NewEmployeeEntity.PersonId}_Employee",
EventTime = m.NewEmployeeEntity.TimestampOrDefault.UtcDateTime
}).ToList();
return eventMessages;
....)
```
When I look at the Data propery in debugmode I see the data property filled, but I is not using my JsonSerializerSettings, because it is written as PascalCase and not camelCase.

Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing how ConfigureFunctionsWorkerDefaults applies NewtonsoftJsonObjectSerializer to the EventGridOutput binding, using the EventGridEvent construction shown in the issue. Compare the serialized payload sent through the output binding with the populated Data value seen in the debugger; done means the received Logic App event contains the expected data using the configured serializer settings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100