Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VB UWP No ConstructorArguments for ITypeSymbol Attributes #18092

Closed
karann-msft opened this issue Mar 23, 2017 · 1 comment
Closed

VB UWP No ConstructorArguments for ITypeSymbol Attributes #18092

karann-msft opened this issue Mar 23, 2017 · 1 comment
Assignees
Milestone

Comments

@karann-msft
Copy link

Affected Branch:
Affected Build: 15.1
Affected Product Language: VB only

Steps to reproduce:

  1. Launch VS version 15.1
  2. Create a UWP VB project, set platform target version to RS2
  3. Open MainPage.xaml
  4. Add inside the root Grid

Expected:
You get a min target version incompatible warning
image

Actual:
For VB project, you don't see this warning. This scenario works fine on C# and C++ UWP projects.

The root cause is we get the ContractVersionAttribute from a ITypeSymbol, and then get the apiContract name and version from the attributeData's ConstructorArguments. This works as expected for C# and C++ projects, but for VB, the ConstructorArguments are always empty.

This bug is blocking a new XAML feature for RS2 - warn about types and properties not available in the target platform minimum version supported by the project.

@AlekseyTs
Copy link
Contributor

It appears the problem is in Private Function PEModuleSymbol.GetWellKnownType(type As WellKnownType, Optional careAboutAmbiguity As Boolean = True) As NamedTypeSymbol

The following code doesn't take into account the fact that currResult could be the same type as referencedAssemblyResult if the type was forwarded. Interestingly, C# compiler handles this properly in private NamedTypeSymbol PEModuleSymbol.GetTypeSymbolForWellKnownType(WellKnownType type)

                Dim currResult As NamedTypeSymbol = assembly.LookupTopLevelMetadataType(emittedName, digThroughForwardedTypes:=True)
                If IsAcceptableSystemTypeSymbol(currResult) Then
                    If referencedAssemblyResult Is Nothing Then
                        referencedAssemblyResult = currResult
                    Else
                        ' CONSIDER: setting result to null will result in a MissingMetadataTypeSymbol 
                        ' being returned.  Do we want to differentiate between no result and ambiguous
                        ' results?  There doesn't seem to be an existing error code for "duplicate well-
                        ' known type".
                        If (careAboutAmbiguity) Then
                            referencedAssemblyResult = Nothing
                        End If
                        Exit For
                    End If
                End If

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

No branches or pull requests

3 participants