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

Component debugger #738

Merged
merged 9 commits into from
Mar 8, 2021
Merged

Component debugger #738

merged 9 commits into from
Mar 8, 2021

Conversation

chsienki
Copy link
Contributor

@chsienki chsienki commented Feb 24, 2021

Follows on from #726.

  • Removes the CapabilityProvider and we'll set it through the roslyn targets instead. I'll issue a follow up PR on the roslyn side
  • Reworks the command line arg obtaining path to use dataflow instead
  • Refactors the view model and centralizes the launch profile reading, so relative paths + msbuild tokens work in all places

- add data source to obtain command line args
- use data source in extension method
- extract out shared logic into launchsettingsmanager
- clean up VM code
@chsienki chsienki added the Area-Source Generators SDK support for source generators label Feb 24, 2021
@chsienki chsienki marked this pull request as ready for review February 24, 2021 02:09
@chsienki chsienki requested a review from a team as a code owner February 24, 2021 02:09
@chsienki
Copy link
Contributor Author

@davkean here's the cleaned up implementation based on yesterdays work. It's still using the 'private' rule name, but otherwise I think is ready to go. Would you mind casting your eye over it again to make sure it's still doing things correctly?

@chsienki
Copy link
Contributor Author

@jaredpar @jmarolf for review.

namespace Roslyn.ComponentDebugger
{
[Export(typeof(IDebugProfileLaunchTargetsProvider))]
[AppliesTo(Constants.RoslynComponentCapability)]
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to update the projects in the templates to have this capability?

Copy link
Contributor

@jmarolf jmarolf left a comment

Choose a reason for hiding this comment

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

:shipit:

private readonly IActiveConfiguredProjectSubscriptionService activeProjectSubscriptionService;

[ImportingConstructor]
public CommandLineArgumentsDataSource(IProjectThreadingService projectThreadingService, IActiveConfiguredProjectSubscriptionService activeProjectSubscriptionService)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
public CommandLineArgumentsDataSource(IProjectThreadingService projectThreadingService, IActiveConfiguredProjectSubscriptionService activeProjectSubscriptionService)
public CommandLineArgumentsDataSource(IProjectThreadingServicea? projectThreadingService, IActiveConfiguredProjectSubscriptionService activeProjectSubscriptionService)

Given the projectThreadingService?. below this seems to be the correct annotation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, its not. the ? is just to shut up the analyzer which doesn't seem to be nullable aware :/

I'll explicitly suppress it though, to make it clear.


public const string CommandName = "DebugRoslynComponent";

public const string TargetProjectPropertyName = "targetProject";
Copy link
Member

Choose a reason for hiding this comment

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

Is this an MSBuild property? If so should be Pascal cased

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. Its the name of the property in the json launch settings file, which should be camelCased. I'll try and think of a clearer name.

Copy link
Member

Choose a reason for hiding this comment

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

Ah okay, yeah camelCase is the only answer then.


private async Task<string?> GetCompilerRootAsync(SVsServiceProvider? serviceProvider)
{
await _threadingService.SwitchToUIThread();
Copy link
Member

Choose a reason for hiding this comment

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

Why do we not need a ConfigureAwait here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The explicit point of this is to change the captured context: .ConfigureAwait(true) would be incorrect, .ConfigureAwait(false) would be redundant, so the analyzer doesn't complain about it.


<!-- https://github.com/dotnet/roslyn-sdk/issues/730 : Localization -->
<Label Margin="4,4,3,5">Target Project:</Label>
<ComboBox Grid.Column="1" Margin="5,7,2,6" ItemsSource="{Binding ProjectNames}" SelectedIndex="{Binding SelectedProjectIndex, Mode=TwoWay}" />
Copy link
Member

Choose a reason for hiding this comment

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

Chris is a WPF / XAM expert for the compiler team. That is my take away here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Haha, I used to be paid to write windows phone apps... sooo.

Copy link
Member

Choose a reason for hiding this comment

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

Oh wow, I was joking ... but you are an expert. Now I know who to assign all our WPF bugs too ... ;)

Comment on lines 15 to 16
private readonly UnconfiguredProject owningProject;
private readonly IDebugTokenReplacer tokenReplacer;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
private readonly UnconfiguredProject owningProject;
private readonly IDebugTokenReplacer tokenReplacer;
private readonly UnconfiguredProject _owningProject;
private readonly IDebugTokenReplacer _tokenReplacer;

// check if the args contain the project as an analyzer ref
foreach (var arg in await targetProjectUnconfigured.GetCompilationArgumentsAsync().ConfigureAwait(false))
{
if (arg.StartsWith("/analyzer", StringComparison.OrdinalIgnoreCase)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (arg.StartsWith("/analyzer", StringComparison.OrdinalIgnoreCase)
if (arg.StartsWith("/analyzer:", StringComparison.OrdinalIgnoreCase)

To be consistent with the StartsWith above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Source Generators SDK support for source generators
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants