Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with Array and Reflection
Message
From
10/12/2006 18:33:50
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01176405
Message ID:
01176425
Views:
12
>Are there different overloads for this method? If so Reflection requires some additional code to ensure you get the right signature of rhte method you are calling.

The signature is somewhat generic. I have a table Task.dbf which contains, among other fields, a class and a method fields. Then, the robot uses this method to do the call:
    ' expO1 Data provider
    Private Function ProcessTaskQuery(ByVal toDataProvider As Framework.Framework.Data) As Boolean
        Dim lcClass As String = ""
        Dim lcMethod As String = ""
        Dim lnCounter As Integer = 0
        Dim loClass As Type = Nothing
        Dim loClassMethodInfo As System.Reflection.MethodInfo = Nothing
        Dim loClassObject As Object = Nothing
        Dim loClassType As Type = Nothing
        Dim loParameterClass(1) As Object
        Dim loParameterMethod(0) As Object
        Dim loRow As DataRow
        loParameterClass(0) = oApp
        loParameterClass(1) = Me
        loParameterMethod(0) = False
        For lnCounter = 0 To toDataProvider.nCount - 1
            loRow = toDataProvider.oDataSet.Tables("Temp").Rows(lnCounter)
            Status.Text = "Processing " + Trim(loRow("Title")) + "..."
            lcClass = Trim(loRow("Class"))
            lcMethod = Trim(loRow("Method"))
            Try
                loClass = Type.GetType("Robot." + lcClass)
                loClassObject = Activator.CreateInstance(loClass, loParameterClass)
                loClassType = loClassObject.GetType()
                loClassMethodInfo = loClassType.GetMethod(lcMethod)
                loClassMethodInfo.Invoke(loClassObject, loParameterMethod)
            Catch loError As Exception
                oApp.ErrorSetup(loError)
                Return False
            End Try
        Next
        Return True
    End Function
So, instantiating the class and calling the method like this might explain why I was never able to get the proper error message but a generic one. See the below response in the other paragraph for the details.

>You might want to check the actual error message fired by the reflection method call.

That is one problem. Whenever I have an error occuring under the reflection hierarchy, I cannot get the proper error message but a generic error message which is always the same. This goes back to a thread I started several months ago. I never received a follow up on it by anyone so I didn't resolve that issue since then. So, when this is happening, it is really difficult to find the real place of the error and takes longer to debug.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform