Problem in comment in function that use class array

SyntaxEditor .NET Languages Add-on for Windows Forms Forum

Posted 12 years ago by BenjaminL
Version: 4.0.0249
Environment: Windows XP (32-bit)
Avatar
When a function use an array of class, the comment doesn't display in the syntax editor.
It was tested in your own test application, ".Net Language Reflection". The summary of the class a is correctly display but not the function summary.

Here is the exact code :

namespace Cpt.Wrappers
{
    using System;

    public class Test
    {
        /// <summary>
        /// 1
        /// </summary>
        public class a
        {

        }
        /// <summary>
        /// 2
        /// </summary>
        /// <param name="valPtr">3</param>
        /// <returns>4</returns>
        public static int b(a[] valPtr)
        {
            return 0;
        }
    }
}
But the comments work when you replace

public static int b(a[] valPtr)
by

public static int b(int[] valPtr)
I will mail you all the project of this exemple DLL.

Best regards,

Benjamin LAFFONT

[Modified at 05/11/2007 05:04 AM]

[Modified at 05/11/2007 05:05 AM]

Comments (3)

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Benjamin,

Hmm... I'm debugging this and am a bit stuck on what to do. The problem here is that the reflection info that Type returns (Microsoft code) seems wrong.

For a[], you have an array of a nested class. Here is what Type reflection says:
DeclaringType = null
FullName = Cpt.Wrappers.Test+a[]
IsArray = true
IsNested = false
Name = a[]
Namespace = Cpt.Wrappers
ReflectedType = null

Whereas here is what we get from Type for regular "a" (not array):
DeclaringType = Cpt.Wrappers.Test
FullName = Cpt.Wrappers.Test+a
IsArray = false
IsNested = true
Name = a
Namespace = Cpt.Wrappers
ReflectedType = Cpt.Wrappers.Test

The problem is this, we don't store the FullName from reflection. Rather we store the "parts" like namespace, declaring type, name, etc. and reconstruct it as needed from that. This saves on memory.

But in the case of the array, reflection is not flagging it as a nested type (no declaring type), so the "Test" is left out when reconstructing the full name. And therefore, the full type name is constructed as "Cpt.Wrappers.a[]", instead of "Cpt.Wrappers.Test+a[]".

Any ideas on how best to handle this? I'd recommend debugging your code and looking at the Type for "a" and "a[]" and see if you can see anything that would help.


Actipro Software Support

Posted 12 years ago by BenjaminL
Avatar
Hi Actipro Software Support,

We can consider that Microsoft type class is wrong or that a[] is type of "System.Array" (that is not nested) but you can retreive if a type is nested by two other ways.

First of our idea is that you can store all nested type in a "Resolver" class and when you found an array, you search it in the "Resolver".

Second idea is that you can analyse the fullname of the Microsoft type for seeing if it contains a '+'. (For example, "Cpt.Wrappers.Test+a[]" show us that "a" is contained in "Cpt.Wrappers.Test"

I hope the two ideas will help.

Regards, Benjamin LAFFONT
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Ok, we implemented a workaround for this for the next maintenance release.


Actipro Software Support

The latest build of this product (v2018.1 build 0341) was released 6 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.