
Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Peter,
Thanks for the quick response. I have tried all your suggestions and none of
them worked in my case.
In your best knowledge, is this is an issue of using queued component in
.NET? If this is an issue, is there any fix or workaround available?
> Hi,
>
> Based on my knowledge, the KB article is just applied to .net framework
> 1.0, and will not applied to 1.1.
Just try to clarify it. Are you saying that such issue has been fixed in the
.NET 1.1 ?
> For your problem, is it specifed to the queued components, if you did not
> enable the queued component feature, did the problem persists?
If I used Marshal.BindToMoniker("new:XXX") to create the object, then I got
the same issue as I used it as queued component. However, if I used "new" to
create object then call Dispose when the process finished, the "Objects" and
"Activated" will remain 0 (The COM+ application will be activated, but all
counts in MMC remain 0)
> Also what did you do you in agent.xxx(), you may try to simplify it, e.g.
> just call debug.writeline.
I comments out all the code in the method, and there was no change for the
behavior
> Is there any other application is using the queued component?
The answer is no.
> You may try to test with one application to call the queued component,
> also you may try to call code below after set the agent to null in the
[quoted text clipped - 4 lines]
> GC.Collect()
> GC.WaitForPendingFinalizers()
I did see this solution as a workaround from several newsgroup threads. I
tried it, surprisingly, it DID NOT work either
> you may have a try and let me know the result.
>
[quoted text clipped - 5 lines]
> Get Secure! - www.microsoft.com/security
> This posting is provided "AS IS" with no warranties, and confers no rights.
"Peter Huang" - 01 Sep 2004 03:55 GMT
Hi,
I will keep researching the issue and update you with new information ASAP.
Best regards,
Peter Huang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
"Peter Huang" - 02 Sep 2004 08:25 GMT
Hi,
I have comfirm with our senior engineer that KB's bug will not apply here.
About the QC issue, you are probably not overriding Dispose in that
IAsyncAgent i/f (I assume that is your interface?).
e.g.
[Server]
using System.Reflection;
using System.EnterpriseServices;
using System;
[assembly: ApplicationName("QCDemoSvr")]
[assembly: ApplicationActivation(ActivationOption.Server)]
[assembly: ApplicationQueuing(Enabled=true, QueueListenerEnabled=true)]
namespace QCDemo
{
public interface IQComponent
{
void DisplayMessage(string msg);
void Dispose();
}
[InterfaceQueuing(Interface = "IQComponent"),EventTrackingEnabled(true)]
public class QComponent : ServicedComponent, IQComponent
{
public void DisplayMessage(string msg)
{
System.Diagnostics.Debug.WriteLine(msg+ "Processing message");
}
}
}
[client]
private void button1_Click(object sender, System.EventArgs e)
{
IQComponent iQc = null;
try
{
iQc = (IQComponent)Marshal.BindToMoniker("queue:/new:QCDemo.QComponent");
}
catch
{
MessageBox.Show("Cannot create Queued Component");
}
Debug.WriteLine("Send Message");
iQc.DisplayMessage (this.textBox1.Text);
iQc.Dispose(); //Call Dispose here
Marshal.ReleaseComObject(iQc);
}
Best regards,
Peter Huang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Invalidlastname - 02 Sep 2004 23:19 GMT
Peter,
Thanks for helps and you have resolved my issue =)
Now the "Objects" and "Activated" counts go back to 0 when the calls
completed.
I think the trick part is to know the correct order of methods, which
release the references of the objects, should be called.
Originally I have my interface inherit the IDisposable and I got
"QueryInterface for interface System.IDisposable failed." and I didn't come
up the ideal to explicitly define the Dispose() method in the interface, so
the client program can call the dispose method before the
Marshal.ReleaseComObject()
Anyway, I cannot thank you more for the helps you provided. It would be very
helpful to see MSDN documents cover such valuable information, such as <
call Dispose() here =)
Rgds,
ILN
> Hi,
>
[quoted text clipped - 54 lines]
> Get Secure! - www.microsoft.com/security
> This posting is provided "AS IS" with no warranties, and confers no rights.
"Peter Huang" - 03 Sep 2004 02:28 GMT
Hi,
I am glad that the problem has been resolved.
Cheers!
Best regards,
Peter Huang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Invalidlastname - 03 Sep 2004 20:51 GMT
Peter,
one last question. I am just curious why I got the following exception if I make the interface inherit the IDisposable instead of having Dispose() explicitly defined in the interface ?
System.InvalidCastException: QueryInterface for interface System.IDisposable failed.
at System.IDisposable.Dispose()
// Code Snippets ===========================
// Interface
public interface IAsyncAgent : IDisposable
{
...
//void Dispose(); // remove this line since the interface itself inherits the IDisposable
}
//client
Agents.IAsyncAgent agent = null;
agent.Dispose(); //<<<error occurred. System.InvalidCastException: QueryInterface for interface System.IDisposable failed.
while(Marshal.ReleaseComObject(agent) > 0) {}
agent = null;
> Hi,
>
[quoted text clipped - 9 lines]
> Get Secure! - www.microsoft.com/security
> This posting is provided "AS IS" with no warranties, and confers no rights.
"Peter Huang" - 06 Sep 2004 09:43 GMT
Hi,
From the TLB file generated by the QC, IAsyncAgent is derived from
IDispatch not from IDispose, the QI will failed.
Best regards,
Peter Huang
Microsoft Online Partner Support

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