-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Exception when navigating to generated code #47782
Comments
I think the issue might be the character count of: C:\Users\yairh\AppData\Local\Temp\VisualStudioSourceGeneratedDocuments\641523fb-d396-4f48-8bc8-096813428ed9\b8cbb0e1-02f7-483c-9c43-433036febd5b_StrongInject.Generator.SourceGenerator_StrongInject.Tests.IntegrationTestInstancePerDependencyHasCorrectScopeContainer.generated.cs is 276 which is greater than the maximum of 260. Perhaps the generated name should just be a random guid to avoid running into this issue? |
Indeed when the generated name is shorter, this works. |
Also, even when goto definition works, peek definition errors. |
Also I'll reach out to the VS platform right now to ask about long path support. 😄 |
Right now when we open a generated file, we make a temporary file on disk to placate parts of the VS API that need a file on disk. (If we had the ability to have our own URI or moniker that'd be fine, but for now we don't have such an ability.) The original plan was to pack in the necessary information we need into the path so we can figure out what file that represents so we can re-open generated files between runs of VS without requiring actual state. In practice, that didn't work yet (if nothing else, because we're packing in a project ID which is random GUID that isn't persisted across process runs). But the bigger problem is this also runs into MAX_PATH issues, if the generator assembly or type names are fairly long. So for now, let's just generate a GUID for the name and store the extra information in a little lookup table. This, and also just renaming the parent directory we put things in, shaves off a fair number of characters, and also means the name of the generator assembly or type name are no longer something being added into the overall path length. The only "controllable" parts of the path that can vary in length is the file name (which must match the hint name from the compiler), and the user's username. Fixes dotnet#47782, or at least as well as we can.
Version Used: VS 16.8 preview 3
Steps to Reproduce:
public object x => _disposed;
_disposed
token.Expected Behavior:
Navigates to the generated source:
Actual Behavior:
Following error:
Note the directory
C:\Users\yairh\AppData\Local\Temp\VisualStudioSourceGeneratedDocuments\641523fb-d396-4f48-8bc8-096813428ed9
is created in this process, but is empty.The text was updated successfully, but these errors were encountered: