Menu

#269 Reflected function contains only pieces of default values

v1.3-beta
closed-fixed
5
2004-04-29
2004-04-28
No

Reflection of the my dll (that function hasn't been
documented yet) of the following function

Public Function System_IsUserAuthorizedForApp(ByVal
SecurityObjectName As String, Optional ByVal
ServerName As String = "", Optional ByVal
AllowSecurityCache_Read As Boolean = False, Optional
ByVal AllowSecurityCache_Write As Boolean = False) As
Boolean

has leaded to following output in the created
documentation:

[Visual Basic]
Public Function System_IsUserAuthorizedForApp( _
ByVal SecurityObjectName As String, _
Optional ByVal ServerName As String = , _
Optional ByVal AllowSecurityCache_Read As Boolean =
False, _
Optional ByVal AllowSecurityCache_Write As Boolean =
False _
) As Boolean

[C#]
public bool System_IsUserAuthorizedForApp(
string SecurityObjectName,
string ServerName,
bool AllowSecurityCache_Read,
bool AllowSecurityCache_Write
);

As you can see,
1. the parameter Optional ByVal ServerName As String
= , _ is missing the empty string ""
2. the C# statement hasn't got any information about
default values yet.

Thanks
Jochen

Discussion

  • Kevin Downs

    Kevin Downs - 2004-04-28

    Logged In: YES
    user_id=919791

    1. Default string values were not being enquoted, so the
    empty string was not visible...

    Fix for MSDN and VS.NET documenters has been committed
    to CVS.

    2. C# does not support optional parms or default values.

     
  • Kevin Downs

    Kevin Downs - 2004-04-28
    • assigned_to: nobody --> kdowns
    • status: open --> closed-fixed
     
  • Jochen Wezel

    Jochen Wezel - 2004-04-29

    Logged In: YES
    user_id=1028390

    Hi Kevin!

    Your 2nd statement is not 100% correct: regarding MS C#
    you may be right, regarding Mono C# those declarations are
    possible and already used.

    Here a short example from namespace
    Microsoft.VisualBasic.Strings programmed in Mono C#:

    ...
    [MonoTODO("Needs testing")]
    public static string[] Filter(object[] Source,
    string Match,
    [Optional]
    [DefaultValue(true)]
    bool Include,
    [OptionCompare] [Optional]
    [DefaultValue(CompareMethod.Binary)]
    CompareMethod Compare)
    {

    if (Source == null)
    ...

    Regards
    Jochen

     
  • Jochen Wezel

    Jochen Wezel - 2004-04-29
    • status: closed-fixed --> open-remind
     
  • Kevin Downs

    Kevin Downs - 2004-04-29
    • status: open-remind --> closed-fixed
     
  • Kevin Downs

    Kevin Downs - 2004-04-29

    Logged In: YES
    user_id=919791

    Mmmm, very interesting..

    I ran a few experiments on this using MS C# and it turns out
    that the compiler does use those attributes to create the
    appropriate metadata.

    So, C# can *create* methods that have optional parameters
    and default values, even if it cannot use them :-)

    NDoc 1.3 does not document parameter level attributes. I will
    create an RFE for the next release, as it will require a
    substantial amount of work; it's not just a simple bug fix

     

Log in to post a comment.