Skip to content

Commit

Permalink
Resolve ILLink warnings in Microsoft.VisualBasic.Core (#51725)
Browse files Browse the repository at this point in the history
* Addressing most of the Linker Warnings in Microsoft.VB

* Address COM Linker warnings

* Address remaining warnings

* Update Reference assembly

* Provide better RequiresUnreferencedCode comments

* Fix build

* Address some feedback

* More Feedback
  • Loading branch information
joperezr authored Apr 27, 2021
1 parent 83f622c commit 0ee5cbd
Show file tree
Hide file tree
Showing 27 changed files with 499 additions and 249 deletions.

Large diffs are not rendered by default.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,28 +1,4 @@
Compat issues with assembly Microsoft.VisualBasic:

# Loaded via reflection so needs to be public in the implementation but we don't want to expose them publicly in the ref assembly:
MembersMustExist : Member 'Microsoft.VisualBasic.CompilerServices.Conversions.FallbackUserDefinedConversion(System.Object, System.Type)' does not exist in the reference but it does exist in the implementation.
MembersMustExist : Member 'Microsoft.VisualBasic.CompilerServices.NewLateBinding.FallbackCall(System.Object, System.String, System.Object[], System.String[], System.Boolean)' does not exist in the reference but it does exist in the implementation.
MembersMustExist : Member 'Microsoft.VisualBasic.CompilerServices.NewLateBinding.FallbackGet(System.Object, System.String, System.Object[], System.String[])' does not exist in the reference but it does exist in the implementation.
MembersMustExist : Member 'Microsoft.VisualBasic.CompilerServices.NewLateBinding.FallbackIndexSet(System.Object, System.Object[], System.String[])' does not exist in the reference but it does exist in the implementation.
MembersMustExist : Member 'Microsoft.VisualBasic.CompilerServices.NewLateBinding.FallbackIndexSetComplex(System.Object, System.Object[], System.String[], System.Boolean, System.Boolean)' does not exist in the reference but it does exist in the implementation.
MembersMustExist : Member 'Microsoft.VisualBasic.CompilerServices.NewLateBinding.FallbackInvokeDefault1(System.Object, System.Object[], System.String[], System.Boolean)' does not exist in the reference but it does exist in the implementation.
MembersMustExist : Member 'Microsoft.VisualBasic.CompilerServices.NewLateBinding.FallbackInvokeDefault2(System.Object, System.Object[], System.String[], System.Boolean)' does not exist in the reference but it does exist in the implementation.
MembersMustExist : Member 'Microsoft.VisualBasic.CompilerServices.NewLateBinding.FallbackSet(System.Object, System.String, System.Object[])' does not exist in the reference but it does exist in the implementation.
MembersMustExist : Member 'Microsoft.VisualBasic.CompilerServices.NewLateBinding.FallbackSetComplex(System.Object, System.String, System.Object[], System.Boolean, System.Boolean)' does not exist in the reference but it does exist in the implementation.
MembersMustExist : Member 'Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateCallInvokeDefault(System.Object, System.Object[], System.String[], System.Boolean)' does not exist in the reference but it does exist in the implementation.
MembersMustExist : Member 'Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGetInvokeDefault(System.Object, System.Object[], System.String[], System.Boolean)' does not exist in the reference but it does exist in the implementation.
MembersMustExist : Member 'Microsoft.VisualBasic.CompilerServices.Operators.FallbackInvokeUserDefinedOperator(System.Object, System.Object[])' does not exist in the reference but it does exist in the implementation.
TypesMustExist : Type 'Microsoft.VisualBasic.CompilerServices.SiteDelegate0' does not exist in the reference but it does exist in the implementation.
TypesMustExist : Type 'Microsoft.VisualBasic.CompilerServices.SiteDelegate1' does not exist in the reference but it does exist in the implementation.
TypesMustExist : Type 'Microsoft.VisualBasic.CompilerServices.SiteDelegate2' does not exist in the reference but it does exist in the implementation.
TypesMustExist : Type 'Microsoft.VisualBasic.CompilerServices.SiteDelegate3' does not exist in the reference but it does exist in the implementation.
TypesMustExist : Type 'Microsoft.VisualBasic.CompilerServices.SiteDelegate4' does not exist in the reference but it does exist in the implementation.
TypesMustExist : Type 'Microsoft.VisualBasic.CompilerServices.SiteDelegate5' does not exist in the reference but it does exist in the implementation.
TypesMustExist : Type 'Microsoft.VisualBasic.CompilerServices.SiteDelegate6' does not exist in the reference but it does exist in the implementation.
TypesMustExist : Type 'Microsoft.VisualBasic.CompilerServices.SiteDelegate7' does not exist in the reference but it does exist in the implementation.

# C# doesn't permit setting the parameter name of the setter.
Compat issues with assembly Microsoft.VisualBasic.Core:
ParameterNamesCannotChange : Parameter name on member 'Microsoft.VisualBasic.ComClassAttribute.InterfaceShadows.set(System.Boolean)' is 'value' in the reference but 'AutoPropertyValue' in the implementation.
ParameterNamesCannotChange : Parameter name on member 'Microsoft.VisualBasic.DateAndTime.DateString.set(System.String)' is 'value' in the reference but 'Value' in the implementation.
ParameterNamesCannotChange : Parameter name on member 'Microsoft.VisualBasic.DateAndTime.TimeOfDay.set(System.DateTime)' is 'value' in the reference but 'Value' in the implementation.
Expand All @@ -33,3 +9,4 @@ ParameterNamesCannotChange : Parameter name on member 'Microsoft.VisualBasic.Err
ParameterNamesCannotChange : Parameter name on member 'Microsoft.VisualBasic.ErrObject.HelpFile.set(System.String)' is 'value' in the reference but 'Value' in the implementation.
ParameterNamesCannotChange : Parameter name on member 'Microsoft.VisualBasic.ErrObject.Number.set(System.Int32)' is 'value' in the reference but 'Value' in the implementation.
ParameterNamesCannotChange : Parameter name on member 'Microsoft.VisualBasic.ErrObject.Source.set(System.String)' is 'value' in the reference but 'Value' in the implementation.
Total Issues: 10
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Imports System.Collections.Generic

Imports Microsoft.VisualBasic.CompilerServices.Symbols
Imports Microsoft.VisualBasic.CompilerServices.ConversionResolution.OperatorCaches
Imports System.Diagnostics.CodeAnalysis

Namespace Microsoft.VisualBasic.CompilerServices

Expand Down Expand Up @@ -120,6 +121,8 @@ Namespace Microsoft.VisualBasic.CompilerServices

#If DEBUG Then
<System.Diagnostics.ConditionalAttribute("DEBUG")>
<UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
Justification:="This method only gets called in DEBUG mode.")>
Private Shared Sub VerifyForLoopWidestType()
Const Max As Integer = TypeCode.String

Expand Down Expand Up @@ -173,6 +176,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
Debug.Assert(TypeCode.String = 18, "wrong value!")
End Sub

<RequiresUnreferencedCode("Calls ClassifyUserDefinedConversion")>
Friend Shared Function ClassifyConversion(ByVal targetType As System.Type, ByVal sourceType As System.Type, ByRef operatorMethod As Method) As ConversionClass
'This function classifies the nature of the conversion from the source type to the target
'type. If such a conversion requires a user-defined conversion, it will be supplied as an
Expand Down Expand Up @@ -514,6 +518,7 @@ Namespace Microsoft.VisualBasic.CompilerServices

End Function

<RequiresUnreferencedCode("Calls Operators.CollectOperators")>
Private Shared Function CollectConversionOperators(
ByVal targetType As System.Type,
ByVal sourceType As System.Type,
Expand Down Expand Up @@ -855,6 +860,7 @@ Namespace Microsoft.VisualBasic.CompilerServices

End Function

<RequiresUnreferencedCode("Calls DoClassifyUserDefinedConversion")>
Friend Shared Function ClassifyUserDefinedConversion(
ByVal targetType As System.Type,
ByVal sourceType As System.Type,
Expand Down Expand Up @@ -909,6 +915,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
Return result
End Function

<RequiresUnreferencedCode("Calls CollectConversionOperators")>
Private Shared Function DoClassifyUserDefinedConversion(
ByVal targetType As System.Type,
ByVal sourceType As System.Type,
Expand Down
Loading

0 comments on commit 0ee5cbd

Please sign in to comment.