Skip to content

Conversation

@heejaechang
Copy link
Contributor

@heejaechang heejaechang commented Jan 29, 2018

this put this (#24120) back into dev15.7.x and added shim to make old interface work until partner teams move out of them.

Customer scenario

This doesn't affect customer experience. this is purely for testing.

Bugs this fixes

https://devdiv.visualstudio.com/DevDiv/_workitems/edit/547597

Workarounds, if any

install our Roslyn.Test.Setup.vsix to machines that want to test our asynchronous features.

Risk

This only affects Testing, so there shouldn't be user facing risk.

Performance impact

There should be no perf impact due to this change to users. only affects testing.

Is this a regression from a previous update?

N/A

Root cause analysis

As all other Roslyn design, we separated out test related component from product component, and used vsix and MEF to inject those when it is needed (test env). it gave us clean separation. but gave us yet one more thing to setup when running test.

it was fine for our own test env, but when it meets with other components in VS and when other team needed to run some of their test with our test hook, it became yet one more point that can fail for test setup.

so, we now put those hooks in Roslyn dlls itself which can be enabled by env variable.

How was the bug found?

during testing.

@heejaechang heejaechang requested a review from a team as a code owner January 29, 2018 08:55
@heejaechang
Copy link
Contributor Author

this is port of #24120 that got merged into dev15.6.x and then reverted due to issue with partner teams which still using old interface.

the first commit of this PR is straight revert of (2aa793e) which reverted the change in dev15.6.x. next commits add shim for old APIs.

@heejaechang
Copy link
Contributor Author

@amcasey @minestarks can you take a look and move to new API once this gets checked into dev15.7.x? @brettfo does F# also use this API?

@heejaechang
Copy link
Contributor Author

@jinujoseph @Pilchie this is #24120 + shim for old APIs. can I get approval for 15.7.x ? thank you

@brettfo
Copy link
Member

brettfo commented Jan 29, 2018

I don't think F# uses any of these APIs

@heejaechang
Copy link
Contributor Author

ping, @Pilchie ?

@minestarks
Copy link

@brettfo you don't use the Apex waiters here? You were the original author, I think so I wanted to double check

@minestarks
Copy link

@heejaechang What is the new API? What is going away? I couldn't tell from the diff, sorry.

[ImportingConstructor]
public NavigateToItemProviderFactory(
[ImportMany] IEnumerable<Lazy<IAsynchronousOperationListener, FeatureMetadata>> asyncListeners)
public NavigateToItemProviderFactory(IAsynchronousOperationListenerProvider listenerProvider)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@minestarks this basically shows how you need to change code.

importing IEnumerable<IAsync, FeatureMetadata> listeners and then creating new AggregateAsync..Operation pattern goes away and changed to

import IAsync..OperationListenerProvider and calling listenerProvider.GetListener(...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@minestarks type/members showing up here - 5d7b8ba - will go away soon. for now I didn't put [Obsolete] but I will do that in next insertion so that we can remove those soon.

@brettfo
Copy link
Member

brettfo commented Jan 29, 2018

@minestarks F# doesn't ever consume that file, I made those change from purely an IDE perspective to expose the waiters for other teams.

@minestarks
Copy link

@heejaechang thanks! Please let me know when the package will be published and what VS branch you're inserting to. This will help us set a timeline for consuming the change and deprecating old types.

@Pilchie
Copy link
Member

Pilchie commented Jan 31, 2018

Approved - sorry for the delay

@heejaechang heejaechang merged commit 6da6115 into dotnet:dev15.7.x Jan 31, 2018
@heejaechang
Copy link
Contributor Author

@minestarks it will insert into d15.7stg

@jasonmalinowski
Copy link
Member

@heejaechang Should we get [Obsolete] attributes on these sooner to help @minestarks understand what does and doesn't need to be removed? Since their build will consume new packages on their schedule, it's OK for us to add them now and that's not a breaking change to the product. We can still insert separately.

Failing that, do we have a bug at least tracking what exactly needs to be deleted again? I think it's just reverting the last two commits in this PR?

@heejaechang
Copy link
Contributor Author

@jasonmalinowski I didn't add Obsolete worrying the Apex code might fail to build which still uses FeatureMetadata. once I check this (https://devdiv.visualstudio.com/DevDiv/_git/VS/pullrequest/101822?_a=overview) in, I will put [Obsolete]

@jasonmalinowski
Copy link
Member

@heejaechang: got it. Are we tracking that somewhere?

@heejaechang
Copy link
Contributor Author

#24574

heejaechang pushed a commit that referenced this pull request Feb 2, 2018
* Remove duplicate lock DocumentState.s_syntaxTreeToIdMapLock

This lock is only being used to protect access to an instance which contains
internal synchronization.

* Better handle surrounding directives when inlining a local variable.

* Add tests.

* Share code between VB and C#.

* Reduce allocations in UnboundLambda

Fixes #23463

* Restore ReturnInferenceCacheKey as the key for _returnInferenceCache

* Update code to more closely follow patterns of the original code

* Cleanup from code review

* basic fix for intellisense in Immediate window

* better comments and cleanup

* Add basic integration tests

* cleanup inproc Immediate window integration test helper

* fix incorrect comment

* address PR feedback

* create Immediate window on ImmediateWindow_InProc.GetText()

* Verify MSBuild version in Developer CMD prompt

Roslyn is designed to have the simplest possible contribution story:
clone then build. Every pre-req needed is either located on the machine
or bootstrapped via NuGet. All the way down to using an xcopy MSBuild if
needed.

The one case which causes a problem is the VS command prompt. In this
case MSBuild is pre-installed on the machine and may or may not be
suitable for building Roslyn.

Previously when building from a VS command prompt we just used whatever
MSBuild was provided. The assumption being a developer command prompt
was an explicit statement of whath MSBuild you wanted to use. Based on
all of our customer reports though this does not seem to be the
assumption that consumers of our repo have. The build gave them no
explicit errors about the provided toolset and hence when the build
failed they assigned flakiness to our repo.

Going forward we are applying the same version validation to MSBuild
when provided via a developer command prompt. If it doesn't match we
will refuse to build asking the user to upgrade VS or build from a
normal command prompt.

* Remove unneeded debugging line

* Comment about pre-release

* Added minimum version

* Add Omit If Default style option

* Add space to be like test without the omit

* Add/Remove without needing a property

* Reformat

* PR feedback

* Fix VB diagnostic based on feedback

* Handle case of NotApplicable modifier and field declaration list

* Fix tests

* PR feedback

* PR feedback

* PreviewCodeAction was overriding ComputeOperations but returning a post-processed operation from original action. This results in another PostProcess being called on the codeaction. If postprocess was overriden in originalaction that'll be ignored the second time (#23920)

* Support negative null-check when we are suggesting to inline type checks

Fixes #21097
Fixes #24286

* fix a case where persistent storage registration fails and some clean… (#24458)

* fix a case where persistent storage registration fails and some clean up code around it.

* added readonly

* address PR feedback

* removed comments no longer relevant

* renamed lock name

* moved waiter from diagnostics.dll to features.dll where all interfaces are defined. (#24512)

* put listener change back in (#24120)

* leave old types in legacy folder until partner teams move to new interface

* added legacy waiter to support partner teams

* Remove methods indirecting access to _metadataFileNameToConvertedProjectReference

This field is documented as being written and read from any thread,
but in practice all uses are guarded by an AssertIsForeground(). Thus
we can get rid of the helper methods that are trying to "help" by
locking before accessing the fields, making it really hard to track all
the real uses of it.

* Make method static that doesn't need state

* add a comment to address PR feedback

* Fix up tests of P2P to metadata reference conversion

It turns out we had some tests, but the tests were disabled. This was
because the tests weren't working properly anyways: they were calling
into UpdateProjectBinPath which only updated some (but not all) of
the project state. That was an internal helper method that shouldn't
be used by tests. Updating the tests to use
SetBinOutputPathAndRelatedData works better.

* Delete debug-only reference validation

This was some legacy code that tried to verify that the references
we have from the project system match up to what DTE and other sources
say. This was debug-only, and the actual asserts were commented out.
This is deadweight at this point, so delete it.

* added and cleaned up logs around build and live diagnostics. (#24551)

also added RoslynActivityLogger that can be enabled through project-system-tool

* Avoid closure allocations on the BindSyntaxTreeToId fast path

* CS1628 error text mentions in parameters; fixes #24584

* Small cleanup of completion logic.

* Move to xunit.console for CoreClr tests

Previously we were using xunit.console for desktop tests and dotnet-xunit for our
CoreClr tests. This change unifies us on top of xunit.console (now that it has a
netcoreapp2.0 version available).

* Move unix builds to xunit.runner.console as well

* Get actual directory name, not file

* Fix dir name issue

* fixed build break
heejaechang pushed a commit that referenced this pull request Feb 7, 2018
* Remove duplicate lock DocumentState.s_syntaxTreeToIdMapLock

This lock is only being used to protect access to an instance which contains
internal synchronization.

* Better handle surrounding directives when inlining a local variable.

* Add tests.

* Share code between VB and C#.

* Reduce allocations in UnboundLambda

Fixes #23463

* Restore ReturnInferenceCacheKey as the key for _returnInferenceCache

* Update code to more closely follow patterns of the original code

* Cleanup from code review

* Verify MSBuild version in Developer CMD prompt

Roslyn is designed to have the simplest possible contribution story:
clone then build. Every pre-req needed is either located on the machine
or bootstrapped via NuGet. All the way down to using an xcopy MSBuild if
needed.

The one case which causes a problem is the VS command prompt. In this
case MSBuild is pre-installed on the machine and may or may not be
suitable for building Roslyn.

Previously when building from a VS command prompt we just used whatever
MSBuild was provided. The assumption being a developer command prompt
was an explicit statement of whath MSBuild you wanted to use. Based on
all of our customer reports though this does not seem to be the
assumption that consumers of our repo have. The build gave them no
explicit errors about the provided toolset and hence when the build
failed they assigned flakiness to our repo.

Going forward we are applying the same version validation to MSBuild
when provided via a developer command prompt. If it doesn't match we
will refuse to build asking the user to upgrade VS or build from a
normal command prompt.

* Remove unneeded debugging line

* Comment about pre-release

* Added minimum version

* Add Omit If Default style option

* Add space to be like test without the omit

* Add/Remove without needing a property

* Reformat

* PR feedback

* Fix VB diagnostic based on feedback

* Handle case of NotApplicable modifier and field declaration list

* Fix tests

* PR feedback

* PR feedback

* Support negative null-check when we are suggesting to inline type checks

Fixes #21097
Fixes #24286

* fix a case where persistent storage registration fails and some clean… (#24458)

* fix a case where persistent storage registration fails and some clean up code around it.

* added readonly

* address PR feedback

* removed comments no longer relevant

* renamed lock name

* moved waiter from diagnostics.dll to features.dll where all interfaces are defined. (#24512)

* put listener change back in (#24120)

* leave old types in legacy folder until partner teams move to new interface

* added legacy waiter to support partner teams

* Remove methods indirecting access to _metadataFileNameToConvertedProjectReference

This field is documented as being written and read from any thread,
but in practice all uses are guarded by an AssertIsForeground(). Thus
we can get rid of the helper methods that are trying to "help" by
locking before accessing the fields, making it really hard to track all
the real uses of it.

* Make method static that doesn't need state

* Fix up tests of P2P to metadata reference conversion

It turns out we had some tests, but the tests were disabled. This was
because the tests weren't working properly anyways: they were calling
into UpdateProjectBinPath which only updated some (but not all) of
the project state. That was an internal helper method that shouldn't
be used by tests. Updating the tests to use
SetBinOutputPathAndRelatedData works better.

* Delete debug-only reference validation

This was some legacy code that tried to verify that the references
we have from the project system match up to what DTE and other sources
say. This was debug-only, and the actual asserts were commented out.
This is deadweight at this point, so delete it.

* added and cleaned up logs around build and live diagnostics. (#24551)

also added RoslynActivityLogger that can be enabled through project-system-tool

* Avoid closure allocations on the BindSyntaxTreeToId fast path

* CS1628 error text mentions in parameters; fixes #24584

* Update optimization data to 2.7.0-beta3-62526-01...

* Small cleanup of completion logic.

* Locate implementations for reference assemblies using the process binding path

* Use GlobalAssemblyCache helper to locate assemblies directly in the GAC

* Update InteractiveEditorFeatures to account for a second definition of GlobalAssemblyCache

* Move to xunit.console for CoreClr tests

Previously we were using xunit.console for desktop tests and dotnet-xunit for our
CoreClr tests. This change unifies us on top of xunit.console (now that it has a
netcoreapp2.0 version available).

* Move unix builds to xunit.runner.console as well

* Fixes 559223

Fix and re-enable test that would catch this error

* Update LanguageServices training data again...

* Get actual directory name, not file

* Fix dir name issue

* Cleanup based on code review feedback

* Check fully-qualified names for SuppressIldasmAttribute and ReferenceAssemblyAttribute
* Use correct reference location, or fail decompilation if it's not available

* Fix typo...

* Don't use inferred member name if that creates duplicates (#24632)

* Fixes #23983

* Added test for unique IDEDiagnosticIDs

* Fixed capitalization on local variable

* Fix `is` and pattern-matching behavior in presence of implicit UD conversion (#24547)

* Fix `is` and pattern-matching behavior in presence of implicit UD conversion
and also an explicit reference conversion. User-defined conversions should
never be considered for `is` and pattern-matching.
Fixes #24522
@heejaechang
Copy link
Contributor Author

@amcasey @minestarks VS side changes are checked into 15.7stg
https://devdiv.visualstudio.com/DevDiv/_git/VS/pullrequest/104684?_a=files

there are 2 things you guys need to do.

  1. is moving to new API as I said here (moved waiter from diagnostics.dll to features.dll where all interfaces are defined. #24512 (review))

  2. is moving away from Microsoft.VisualStudio.IntegrationTest.Setup.vsix and use environment variable. you guys don't need to install this (Microsoft.VisualStudio.IntegrationTest.Setup.vsix) anymore. and you need to set environment variable (RoslynWaiterEnabled=1) to enable listener/waiter.

if you are using VisualStudioHostTest (Apex) for integration testing, then you can do this to set the variable.

protected override VisualStudioHostConfiguration GetVisualStudioHostConfiguration()
{
var config = base.GetVisualStudioHostConfiguration();
config.Environment.Add("RoslynWaiterEnabled", "1");
return config;
}

let me know if you need more info.

@heejaechang
Copy link
Contributor Author

[Obsolete] is added to Shim. after that is in, I will have another PR which will actually remove those legacy API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants