Component debugger - #738
Conversation
- add data source to obtain command line args - use data source in extension method - extract out shared logic into launchsettingsmanager - clean up VM code
|
@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? |
| namespace Roslyn.ComponentDebugger | ||
| { | ||
| [Export(typeof(IDebugProfileLaunchTargetsProvider))] | ||
| [AppliesTo(Constants.RoslynComponentCapability)] |
There was a problem hiding this comment.
Do we want to update the projects in the templates to have this capability?
| private readonly IActiveConfiguredProjectSubscriptionService activeProjectSubscriptionService; | ||
|
|
||
| [ImportingConstructor] | ||
| public CommandLineArgumentsDataSource(IProjectThreadingService projectThreadingService, IActiveConfiguredProjectSubscriptionService activeProjectSubscriptionService) |
There was a problem hiding this comment.
| public CommandLineArgumentsDataSource(IProjectThreadingService projectThreadingService, IActiveConfiguredProjectSubscriptionService activeProjectSubscriptionService) | |
| public CommandLineArgumentsDataSource(IProjectThreadingServicea? projectThreadingService, IActiveConfiguredProjectSubscriptionService activeProjectSubscriptionService) |
Given the projectThreadingService?. below this seems to be the correct annotation
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
Is this an MSBuild property? If so should be Pascal cased
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Ah okay, yeah camelCase is the only answer then.
|
|
||
| private async Task<string?> GetCompilerRootAsync(SVsServiceProvider? serviceProvider) | ||
| { | ||
| await _threadingService.SwitchToUIThread(); |
There was a problem hiding this comment.
Why do we not need a ConfigureAwait here?
There was a problem hiding this comment.
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}" /> |
There was a problem hiding this comment.
Chris is a WPF / XAM expert for the compiler team. That is my take away here.
There was a problem hiding this comment.
Haha, I used to be paid to write windows phone apps... sooo.
There was a problem hiding this comment.
Oh wow, I was joking ... but you are an expert. Now I know who to assign all our WPF bugs too ... ;)
| private readonly UnconfiguredProject owningProject; | ||
| private readonly IDebugTokenReplacer tokenReplacer; |
There was a problem hiding this comment.
| 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) |
There was a problem hiding this comment.
| if (arg.StartsWith("/analyzer", StringComparison.OrdinalIgnoreCase) | |
| if (arg.StartsWith("/analyzer:", StringComparison.OrdinalIgnoreCase) |
To be consistent with the StartsWith above.
Follows on from #726.
CapabilityProviderand we'll set it through the roslyn targets instead. I'll issue a follow up PR on the roslyn side