Teething problems with .NET - Part 2 - Strange Error

Debugging a VB .NET component which is being called from an ASP page

The VB method is of the form

    Function Test(ByVal sStr As String, ByVal ParamArray s() As String) As String
also tried
    Function Test(ByVal sStr As String, ByVal ParamArray s() As Object) As String

The ParamArray causes the error "Invalid procedure call or argument: 'cn.Test'"

I can and do invoke other methods on the same class before this, they work fine. When I make the second parameter an optional instead, it works fine. Only paramarray stops it working.

Here's the calling line on the ASP page

      sTest = cn.Test("string1", "hello")

I've been stuck on this for hours.


LVL 8
plqAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
DabasConnect With a Mentor Commented:
plq:
I do not think it will come back again.
Good luck!

Dabas
0
 
plqAuthor Commented:
Strangest thing about this, is that the problem started happening seemingly for no reason. It was all working fine and I got through the paramarray code 4 times. Then something happened and now it fails every time. ugh
0
 
DabasCommented:
Hi plq:
Maybe the error is not in the declaration of Test but in the code within it, which may have changed after it worked correctly.
Would you mind posting it here too?

Dabas
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
plqAuthor Commented:
Hi Dabas

It doesn't get that far. The asp debugger doesn't let me step into test when its got a paramarray parameter, which indicates that the error is raised within ASP, not within the DLL. When I change it to a string parameter it does let me step in. Here's the code anyway

Option Strict Off
Option Explicit On
Option Compare Text

Public Interface iResponse
    Function Test(ByRef sStr As String, ByVal ParamArray s() As Object) As String
End Interface

<System.Runtime.InteropServices.ProgId("myClass.Response")> Public Class Response
    Implements iResponse

    Public Function Test(ByRef sStr As String, ByVal ParamArray s() As Object) As String Implements iResponse.Test
        Return "hello"
    End Function
...
0
 
plqAuthor Commented:
I removed .net 2002 and installed .net 2003, reconverted the vb6 and that fixed it. Now I'm just praying that it doesn't come back again

But thanks for your help
0
 
plqAuthor Commented:
Ahh it did come back again. I decided to rewrite it so it didnt need a paramarray, by changing it to take 30 optional parameters. - yuk

I am getting soooo many problems, I think we're going back to vb6
0
All Courses

From novice to tech pro — start learning today.