Skip to content
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

Try to fix the analyzer path when loading in OOP #55425

Merged
merged 2 commits into from
Aug 6, 2021

Conversation

genlu
Copy link
Member

@genlu genlu commented Aug 5, 2021

This fixed the error described in #46687

@genlu genlu requested a review from a team as a code owner August 5, 2021 00:38
@genlu genlu marked this pull request as draft August 5, 2021 00:39
This is a hack to temporarily unblock further investigations
@genlu genlu marked this pull request as ready for review August 6, 2021 20:01
protected override Assembly LoadImpl(string fullPath)
=> base.LoadImpl(FixPath(fullPath));

public RemoteAnalyzerAssemblyLoader(string? baseDirectory)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

when is baseDirectory null?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't. I was mulling over whether to set it to null when not targeting .netcore (to avoid these file path operations)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

var assemblyName = Path.GetFileName(fullPath);
var fixedPath = Path.GetFullPath(Path.Combine(_baseDirectory, assemblyName));

if (!PathUtilities.PathsEqual(fixedPath, Path.GetFullPath(fullPath)) && File.Exists(fixedPath))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!PathUtilities.PathsEqual(fixedPath, Path.GetFullPath(fullPath))

Why compare equality? If they are equal then it doesn't matter which one is returned, right?

Copy link
Member Author

@genlu genlu Aug 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this is just to short circuit the FileExists call. Probabaly doesn't matter at all, I can remove it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the assembly is gonna be read from disk anyways I don't think avoiding File.Exists has any benefit

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Copy link
Member

@tmat tmat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@genlu genlu enabled auto-merge August 6, 2021 21:46
@genlu genlu merged commit cbbcf5c into dotnet:main-vs-deps Aug 6, 2021
@ghost ghost added this to the Next milestone Aug 6, 2021
@tmat
Copy link
Member

tmat commented Aug 6, 2021

@genlu Just noticed - why main-vs-deps and not main?

@genlu
Copy link
Member Author

genlu commented Aug 6, 2021

@tmat All the core host related stuff is still not merged back in main yet (we missed the preview 2 cut). While this would work just fine in main, I thought it'd be better to target this with other related changes.

@genlu genlu deleted the RemoteAnalyzerLoader branch August 6, 2021 22:44
@dibarbet dibarbet modified the milestones: Next, 17.0.P4 Aug 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants