Repository navigation
Handle file-scoped namespaces in Logging Source Generator - #57894
maryamariyan merged 2 commits into
Conversation
Handle namespace not being emitted when file-scoped namespaces are used for a log class. Relates to dotnet#57880.
|
Tagging subscribers to this area: @maryamariyan Issue DetailsHandle namespace not being emitted when file-scoped namespaces are used for a log class. Relates to #57880.
|
|
Now that #57088 has been merged into |
@chsienki is there a more general way we could use to find the namespace (via the semantic model) rather than using |
|
Also note we should test (and possibly fix) the System.Text.Json source generator for the same scenario. |
|
Anything more I need to do with this PR for merge? |
|
confirmed with @sharwell offline that using |
|
@martincostello would you be interested in taking a look at the Json source generator side as well for file-scoped namespaces either in this or in a separate PR? |
|
Does this need porting? Would we otherwise be broken as soon as someone enables "automatic usings"? |
Sure, I'll take a look at some point this weekend. |
Yeah I think it would make sense to port this to the 6.0 branch, if someone with permissions could do the honours? |
|
@maryamariyan Just created a quick console app to check out the JSON stuff with file-scoped namespaces and seems fine using version
|
|
The reason Json works is because it is using runtime/src/libraries/System.Text.Json/gen/Reflection/TypeWrapper.cs Lines 175 to 178 in 0becd27 Maybe we should consider doing something similar in the Logging generator? |
will take a look |
Handle namespace not being emitted when file-scoped namespaces are used for a log class. Relates to dotnet#57880.
|
Does JSON need a test to protect this scenario? |
Handle namespace not being emitted when file-scoped namespaces are used for a log class.
Relates to #57880.