managed extensions - some code is more better than others

  • Thread starter Thread starter Dennis
  • Start date Start date
D

Dennis

I have an ASP.NET Web Service C++ project using managed extensions. It
starts out working, but adding the last line in this sample code
causes everything to stop working.

// Initialize Win32 C++ dll
...

// Create one of our collection classes (defined in the dll)
CVOCollection coll(CMetaSet( _T("$\\cgActivities") ));

// Execute the query
coll.Select();

// Some simple tests
int count = coll.GetCount(); // this works
int count2 = coll.Current().GetFieldCount(); // this works

// With this line in, the simple tests above fail, but
// comment out this line and they work. That is not logical.
//CField* pField = coll.Current().GetField("Activity");

Help! Thanks.
 
Here's another thing we've learned. By constructing the parameter
argument to the CMetaSet ctor first we were able to get it to work,
but ONLY if it's constructed as a local and not transient. In other
words this causes the GetField call in the original code I posted to
work:

// Create one of our collection classes (defined in the dll)
CUID uid(_T("$\\cgActivities"));
CVOCollection coll( CMetaSet( uid ) );

but this doesn't:

// Create one of our collection classes (defined in the dll)
CVOCollection coll( CMetaSet( CUID(_T("$\\cgActivities")) ) );

There may be some kind of subtle problem hidden in the CUID class. But
that still doesn't explain why merely commenting in/out the GetField
call would affect the success/failure of the operations preceeding it.

Dennis
 
Hi Dennis,

Can you reproduce the problem with a simple console application?
If so, you may send the reproduce sample to us, so that we can do further
troubleshooting.

Thank you for your efforts

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
We're able to work around it as I discussed above. Nobody seems to
want to take the time to put together a sample console app that may
not exhibit the same problem. If that changes I'll revisit this
thread. Thanks for the offer nonetheless!

Dennis
 
Hi Dennis,

If you still have other concern,please feel free to post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top