-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[BUG] Azure.ETagConverter is internal, blocks using System.Text.Json source gen to deserialize objects #35201
Comments
Hi @stephenjust. Thank you for reaching out and we regret that you're experiencing difficulties. Can you provide a bit more context to help me understand the end-to-end scenario for what you're trying to accomplish? |
Hi @stephenjust. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue. |
Hi @stephenjust, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you! |
We want to enable trimming on our dotnet application that works with ARM models. Reflection based serializers are not supported in trimmed applications, so we tried to use a source generator based serializer. However, the system.text.json source generator does not work on these nuget packages because of their use of an internal converter. |
//cc: @annelo-msft, @JoshLove-msft, @christothes, @AlexanderSher, @KrzysztofCwalina, @tg-msft for discussion. |
Thank you for the additional context, @stephenjust. I've looped in some folks for discussion. |
Adding @m-nash, who is working on serialization for .NET Azure SDK libraries. |
Run into the same problem almost 2 years later. Any update on this? |
Library name and version
Azure.Core 1.28.0
Describe the bug
System.Text.Json's source generators attempt to reference Azure.ETagConverter when you use source generators to create a JsonSerializerContext.
Making Azure.ETagConverter public instead of internal should resolve this issue.
Expected behavior
Azure.ETagConverter should be accessible so that Source Generators create valid code.
Actual behavior
Error CS0122 'ETagConverter' is inaccessible due to its protection level FirewallService System.Text.Json.SourceGeneration\System.Text.Json.SourceGeneration.JsonSourceGenerator\NetworkSecurityGroupTemplateSerializerContext.ETag.g.cs 25 Active
Reproduction Steps
Create a source generator class on .net 6.0 with System.Text.Json 6.0.0:
On build, the build will fail due to the reference to Azure.ETagConverter in the generated output.
(This also occurs if you were to include a property of type
SecurityRuleData
inside some other class. that had a JsonSerializerContext created for it.)Environment
.NET SDK:
Version: 7.0.202
Commit: 6c74320bc3
Runtime Environment:
OS Name: Windows
OS Version: 10.0.22624
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\7.0.202\
Host:
Version: 7.0.4
Architecture: x64
Commit: 0a396acafe
.NET SDKs installed:
3.1.426 [C:\Program Files\dotnet\sdk]
5.0.407 [C:\Program Files\dotnet\sdk]
5.0.416 [C:\Program Files\dotnet\sdk]
6.0.202 [C:\Program Files\dotnet\sdk]
6.0.301 [C:\Program Files\dotnet\sdk]
7.0.202 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.15 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
The text was updated successfully, but these errors were encountered: