I am currently experiencing a slight oddity with a com component that I am using with my C# MVC3 project.
The COM component (named YVPCUST) contains the following vb6 routine:
Public Function GetDocument(ByVal a_sCode As Variant, ByRef a_sLocation As Variant, ByRef a_sDestination As Variant, ByRef a_sSuffix As Variant) As Integer
Dim oSystem As System
Set oSystem = CreateObject("qtcsl32.System")
GetDocument = oSystem.GetDocumentByRef(a_sCode, a_sLocation, a_sDestination, a_sSuffix)
Set oSystem = Nothing
End Function
The C# MVC3 project is built using a COM component layer which directly references the component named YVPCUST:
qtcsl32.YVPCUST yvpCust = new qtcsl32.YVPCUST();
object code = (object)"RAAG";
object minimumAge = 0;
object maximumAge = 0;
object suffix = (object)string.Empty; //not to be used
int returnCode;
returnCode = yvpCust.GetDocument(code, minimumAge, maximumAge, suffix);
The GetDocument() routine should get the max and min ages for the provided code. However, when i run the application in compiled or debug mode and step over the last line, the minimumAge and maximumAge values are not set correctly, they are set to default values of 0 (regardless of the number of times I re-execute this line).
However, (in debug mode) if I break the code on this last line and instead run the line using QuickWatch, when I return to the code from the QuickWatch window, the values are set to the correct minimum and maximum ages when I hover the mouse over them.
Does anyone have any ideas as to why this may happen?
This COM component is used in various other places in the application (but not this rountine) with no problem.
I realised that the C# wrapper for the COM component had the following declaration:
I then realised that code line should have been written (including ref’s):
This doesn’t explain why it worked using the QuickWatch window but I have managed to get the required result.