fix the using issue in dotnet examples#8664
Merged
weidongxu-microsoft merged 2 commits intoAzure:mainfrom Jul 19, 2024
Merged
Conversation
ArcturusZhang
commented
Jul 19, 2024
weidongxu-microsoft
approved these changes
Jul 19, 2024
WhitShake
pushed a commit
to WhitShake/azure-sdk-tools
that referenced
this pull request
Jul 24, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Because of a change in dotnet generator, now the dotnet generated code will not include using statements for those namespaces that are parent of the current namespace.
For example, if our current namespace is
Azure.ResourceManager.Compute.Samples:the
using Azure;,using Azure.ResourceManager;,using Azure.ResourceManager.Compute;statements will not be generated into the sample file, even if members from those namespaces are used below.This is fine when we are building the sample projects, but it is not fine if we extract the sample code into a standalone program which is under a different namespace.
This PR fixes this by adding the namespace trimming the
.Samplessuffix, and always add the namespace ofAzureandAzure.ResourceManagerbecause they are so common that every sample program should need them.