Teething problems with .NET - Part 2 - Strange Error

Posted on 2004-05-01
Last Modified: 2010-04-17
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.

Question by:plq
  • 4
  • 2

Author Comment

ID: 10969361
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
LVL 27

Expert Comment

ID: 10969814
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?


Author Comment

ID: 10970504
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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.


Author Comment

ID: 10971115
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
LVL 27

Accepted Solution

Dabas earned 500 total points
ID: 10971120
I do not think it will come back again.
Good luck!


Author Comment

ID: 10971422
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

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show, step by step, how to integrate R code into a R Sweave document
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question