question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Azure Messaging Eventgrid (4.6.0) issue with JObject in data property

See original GitHub issue

We have been using Microsoft.Azure.Eventgrid 3.2.x package for quite a while now in our function projects to publish messages. When publishing, we use a JObject to fill the data property of the EventGridEvent, works like a charm as shown in the following example

var data = new JObject { {"fileId", fileId}, {"fileName", fileName} };

and later on this JObject is used as var eventGridEvent = new EventGridEvent( Guid.NewGuid().ToString(), subject, **someJObject**, eventType, DateTime.Now, "1.0" );

Last week we saw that this nuget package has been deprecated and we needed to move to the new Azure Messaging Eventgrid 4.6.x nuget package so we did. When using empty JObjects in some cases (just sending a notification that something is ready for processing), we also use the above code, which breaks (new method signature isn’t reflected in above example). In run time, we get the error: The collection type ‘Newtonsoft.Json.Linq.JObject’ is not supported.

When we do some modifications to use a json string instead, all quotation marks get translated to unicode formatting (even when specifying the formatter to None). The Microsoft Docs example to use objects and serialize them might be an option, but requires quite some code changes.

In the end, this left us in a non working situation on production, where we had to rollback to the old package.

Any idea if JObject support for the data element will be back into support? Is this just some bug that needs to be resolved, or is this by design?

Awaiting your responses.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
SahinOzdemircommented, Sep 8, 2021

Hi,

Thanks for your quick responses! I’ll check if the provided solution solves our issue.

1reaction
JoshLove-msftcommented, Sep 7, 2021

@pakrym pointed out that in .NET 6.0 (which is still in preview), there is a JsonNode type being included in System.Text.Json which should have similar semantics to the JObject so swapping out those types would be a third option.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] Data property not populated for EventGridEvent object
Library name and version Azure.Messaging.EventGrid 4.12.0 Describe the bug I want to send an event using event grid, with some data.
Read more >
[BUG] Can't send complex object as data in EventGridEvent
Name and version of the Library package used: Azure.Messaging.EventGrid -Version 4.0.0-beta.1.
Read more >
Azure.Messaging.EventGrid 4.7.0
To send events to a topic or domain using Azure Active Directory, the authenticated identity should have the "EventGrid Data Sender" role ...
Read more >
Azure PowerShell release notes
Fixed an issue of 'StorageAccountName' field in context object when the ... Azure PowerShell cmdlets send telemetry data to Microsoft to ...
Read more >
Azure Event Grid client library for Java
Package containing the data models for EventGridPublisherClient. ... To get the binaries of the official Microsoft Azure Event Grid Java SDK as distributed ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found