Skip to content

Simple mapping for OutputType & OutputTypeEx through BrowseObject and VsLangProj.ProjectProperties - #2221

Merged
basoundr merged 14 commits into
dotnet:masterfrom
basoundr:FixOutputType
May 19, 2017
Merged

basoundr merged 14 commits into
dotnet:masterfrom
basoundr:FixOutputType

Conversation

@basoundr

@basoundr basoundr commented May 18, 2017 •

Copy link
Copy Markdown
Contributor

Tagging @dotnet/project-system @RaulPerez1 for review

Customer scenario

Changing the output type in a project from the property pages, persists it as a configuration specific property and writes an extra property called OutputTypeEx.

Over a period of time, OutputType and OutputTypeEx has been enabled through various hacks and workarounds. This change removes the workaround and provides mapping between OutputType & OutputTypeEx and Msbuild's OutputType

There are 2 ways to get OutputType and OutputTypeEx.

  1. via BrowseObject. The values for OutputType and OutputTypeEx through BrowseObject will be provided by Intercepting the gets and sets for these variables using Intercepting Value provider, which maps MSBuild value to the appropriate value for each of the property

  2. via VsLangProj.ProjectProperties. The values for Output and OutputTypeEx is provided by mapping the value of OutputType MSBuild property.

This change also removes some of the workarounds that were placed in the property pages to deal with the absence of the VsLangProj.ProjectProperties. Since we have implemented VsLangProj.ProjectProperties recently, we can remove the workarounds.

Bugs this fixes:

#1300 #1298

Risk

I have tested a bunch of scenarios and this change is safe since it just replaces the existing mechanism with a much simpler mechanism

Performance impact

Low - Working of properties are not modified.

How was the bug found?

This was a pending work that needed to happen.

basoundr added 10 commits May 17, 2017 09:28
…figurationGeneral

Previously, VsLangProj.ProjectProperies's OutputType and OutputTypeEx were backed by IEnumValue, produced by the xaml Rules, which were either dynamically created or Intercepted to provide values that could be cast to the Appropriate Enum types. This change removes all the complications and does a simple mapping between the Msbuild value and VsLangProj properties.
…tTypeEx itself does not need to be a value to be persisted.
This interceptor will make sure the value returned and persisted are mapped to MSBuild OutputType property and VSLangProj.prjOutputType
…eProviderBase

This base class will now be inherited by OutputType and OutputTypeEx value providers for BrowseObject
Revert part of workaround from the commit 4685be6 since we are implementing component to support backward compatibility
@basoundr basoundr changed the title OutputType and OutputTypeEx from BrowseObject is backed by Interceptors Simple mapping for OutputType & OutputTypeEx through BrowseObject and VsLangProj.ProjectProperties May 18, 2017
</StringProperty.DataSource>
</StringProperty>
<!-- This property is used to provide the value of OutputTypeEx through BrowseObject, which is used by Property pages-->
<StringProperty Name="OutputTypeEx" DisplayName="Output Type Ex" Visible="False">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should use an IntProperty here - looks like that'll make it return an int to DTE

var browseObjectProperties = await ProjectProperties.GetConfigurationGeneralBrowseObjectPropertiesAsync().ConfigureAwait(true);
var value = (IEnumValue)(await browseObjectProperties.OutputTypeEx.GetValueAsync().ConfigureAwait(true));
return (prjOutputTypeEx)Convert.ToInt32(value.DisplayName);
var configurationGeneralProperties = await ProjectProperties.GetConfigurationGeneralPropertiesAsync().ConfigureAwait(true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We can just go through the browseobject rule here and if we make than intproperty then it'll be consistent


If Not PropertyControlData.IsSpecialValue(value) Then

Dim uIntValue As UInteger = 0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This was originally because OutputType was returning a string in CPS and when it was empty, the whole page would be broken instead of a single property having wrong value. However if we change outputtype to intproperty we can probably remove this as well if DTE returns an int.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have handled this by making the interceptors to guard against unknown values and return '0', which is old project system behavior. The value here will still be string but it will '0' and so property pages cannot crash

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why will it be a string? Since it's a IntProperty the value will be the integer 0 right?

… by IntProperty OutputType and OutputTypeEx from ConfigurationGeneralBrowseObject
namespace Microsoft.VisualStudio.ProjectSystem.VS.Properties
{
// OutputTypeEx acts as a converter for the OutputType value to VSLangProj110.prjOutputTypeEx.
/// OutputTypeEx acts as a converter for the MSBuild OutputType value expressed as <see cref="VSLangProj110.prjOutputTypeEx"/>.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you add a summary tag?

@srivatsn

Copy link
Copy Markdown
Contributor

@tannergooding this will fix the issue you were seeing with Class diagrams.

basoundr added 2 commits May 19, 2017 00:04
…ted OutputType value

To Match the old project system behavior, we return '0' if the output type is different from the known values
@srivatsn

Copy link
Copy Markdown
Contributor

Tagging @MattGertz for approval.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants