R
Richard Gohs
We've got a VB.Net Pocket PC application calling an unmanged C DLL.
One function in particular is giving us problems. This function takes
an XML string as input and attempts to locate a value and return this
value out. This function is declared as ...
HRESULT GetSessionIDW (/*[in]*/ LPCWSTR pszXML, /*[in, out]*/ LPWSTR
pszSessionID, /*[in]*/ int nMaxSessionIDChars);
in the C code, and declared as ...
Private Declare Function GetSessionID Lib "DSCORE.DLL" Alias
"GetSessionIDW" (ByVal pszXML As String, ByVal pszSessionID As
System.Text.StringBuilder, ByVal nMaxSessionIDChars As Int32) As
Integer
in the VB code.
About 98-99% of the time, this code runs just fine. Within the C
code, if the XML tag cannot be found, it generates a logfile which
includes the XML string that it has and returns an error. Also, in
the VB code, if it sees an error returned from the call, it will log
the string that it passed in. Now for the strange part, every now and
then, the XML string that the C code logs is different from the XML
string that the VB code logs - and this has me completely baffled. We
have seen the following cases:
1. The string within the C code is "part of" the string that the VB
code had (the one I recall was the last 100 or so characters of
approximately 1000 characters)
2. The string within the C code is some string that appears within
the VB code somewhere, but is not in the string at all.
3. The string within the C code appears to be non-printable
characters.
I have not done any testing yet to see if this happens on the full
..Net framework.
Any thoughts?
Thanks,
Richard
Any thoughts on where the problem might lie?
One function in particular is giving us problems. This function takes
an XML string as input and attempts to locate a value and return this
value out. This function is declared as ...
HRESULT GetSessionIDW (/*[in]*/ LPCWSTR pszXML, /*[in, out]*/ LPWSTR
pszSessionID, /*[in]*/ int nMaxSessionIDChars);
in the C code, and declared as ...
Private Declare Function GetSessionID Lib "DSCORE.DLL" Alias
"GetSessionIDW" (ByVal pszXML As String, ByVal pszSessionID As
System.Text.StringBuilder, ByVal nMaxSessionIDChars As Int32) As
Integer
in the VB code.
About 98-99% of the time, this code runs just fine. Within the C
code, if the XML tag cannot be found, it generates a logfile which
includes the XML string that it has and returns an error. Also, in
the VB code, if it sees an error returned from the call, it will log
the string that it passed in. Now for the strange part, every now and
then, the XML string that the C code logs is different from the XML
string that the VB code logs - and this has me completely baffled. We
have seen the following cases:
1. The string within the C code is "part of" the string that the VB
code had (the one I recall was the last 100 or so characters of
approximately 1000 characters)
2. The string within the C code is some string that appears within
the VB code somewhere, but is not in the string at all.
3. The string within the C code appears to be non-printable
characters.
I have not done any testing yet to see if this happens on the full
..Net framework.
Any thoughts?
Thanks,
Richard
Any thoughts on where the problem might lie?