Repository navigation
Simple mapping for OutputType & OutputTypeEx through BrowseObject and VsLangProj.ProjectProperties - #2221
Conversation
…jectProperties" This reverts commit d057606.
…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
| </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"> |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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"/>. |
There was a problem hiding this comment.
Can you add a summary tag?
|
@tannergooding this will fix the issue you were seeing with Class diagrams. |
…ted OutputType value To Match the old project system behavior, we return '0' if the output type is different from the known values
|
Tagging @MattGertz for approval. |
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.
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
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.