Skip to content
This repository was archived by the owner on Aug 26, 2026. It is now read-only.

Component debugger - #738

Merged
chsienki merged 9 commits into
dotnet:mainfrom
chsienki:ComponentDebugger
Mar 8, 2021
Merged

chsienki merged 9 commits into
dotnet:mainfrom
chsienki:ComponentDebugger

Conversation

@chsienki

@chsienki chsienki commented Feb 24, 2021

Copy link
Copy Markdown
Member

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
Copy Markdown
Member 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
Copy Markdown
Member Author

@jaredpar @jmarolf for review.

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

Copy link
Copy Markdown

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?

@jmarolf jmarolf left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

:shipit:

Comment thread src/VisualStudio.Roslyn.SDK/ComponentDebugger/DebugProfileProvider.cs Outdated
Comment thread src/VisualStudio.Roslyn.SDK/ComponentDebugger/DebuggerOptionsViewModel.cs Outdated
Comment thread src/VisualStudio.Roslyn.SDK/ComponentDebugger/DebuggerOptionsViewModel.cs Outdated
Comment thread src/VisualStudio.Roslyn.SDK/ComponentDebugger/DebuggerOptionsViewModel.cs Outdated
Comment thread src/VisualStudio.Roslyn.SDK/ComponentDebugger/DebuggerOptionsViewModel.cs Outdated
Comment thread src/VisualStudio.Roslyn.SDK/ComponentDebugger/DebuggerOptionsViewModel.cs Outdated
Comment thread src/VisualStudio.Roslyn.SDK/ComponentDebugger/CommandLineArgumentsDataSource.cs Outdated
private readonly IActiveConfiguredProjectSubscriptionService activeProjectSubscriptionService;

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

Copy link
Copy Markdown
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
Copy Markdown
Member 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
Copy Markdown
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
Copy Markdown
Member 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member 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
Copy Markdown
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
Copy Markdown
Member 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Area-Source Generators SDK support for source generators

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants