473,395 Members | 1,681 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

ComVisible object won't terminate if PerformanceCounter created internally

Hi all,

I'm hoping someone can help me with this bizarre problem. If I create a
new PerformanceCounter object in a ComVisible class and invoke it from
wscript, it never seems to terminate. When debugging, Visual Studio
never leaves the (running) state when the Go function exits (even
clicking the 'Stop Debugging' button fails). When not debugging, the
cscript / wscript.exe process never leaves memory.

I've tried this same code in a console app and a simple form based app
and they both terminate correctly. I've tried manually calling
counter.Close() but that didn't help either. Does anyone know what
causes this behaviour?

The only similar issue I was able to find can be found here:
http://www.dotnet247.com/247referenc...24/121316.aspx
I have all the latest framework service packs however so this doesn't
appear to be relevant.

using System.Diagnostics;
using System.Runtime.InteropServices;

namespace CounterTest
{
[ClassInterface(ClassInterfaceType.AutoDispatch)]
[GuidAttribute("652B14C2-0221-4bff-A4AB-98DF2DB312E6")]
[ProgId("CounterTest.ThisWillHang")]
[ComVisible(true)]
public class ThisWillHang
{
public void Go()
{
PerformanceCounter counter = new
PerformanceCounter("Processor", "% Processor Time", "_Total");
}
}
}

Aug 3 '06 #1
0 1213

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

28
by: Daniel | last post by:
Hello =) I have an object which contains a method that should execute every x ms. I can use setInterval inside the object construct like this - self.setInterval('ObjectName.methodName()',...
1
by: W1ld0ne74 | last post by:
I am implimenting Performance counters into a web application. I use the following code to create the counters during setup: private void SetupPerfCntrs() {...
1
by: Chris | last post by:
I'm trying to do something really easy: just get the % CPU load. However, I just get mostly 0's sprinkled with an occasional 100. I poked around on the web for info, but all the stuff I found (I...
2
by: R. Nachtsturm | last post by:
Hi, i have the problem that when i create a low priority background thread, start it, and wait for it to finish that it does not seem to terminate even after it is finished.. if i use...
0
by: ThisBytes5 | last post by:
We are developing a comvisible object that will be called from an asp page. This object in turn will load other .net assemblies, E.G. Entlib, other in house items, WSE3.0 imp, etc... Most if not...
3
by: Geoff McElhanon | last post by:
I have been struggling with a security issue that occurs under .NET 2.0, but does not occur under .NET 1.1. Essentially I am trying to open up a performance counter on a remote server and monitor...
3
by: Adam Clauss | last post by:
I am working on modifying an existing library to expose portions through COM. Is it possible to return a generic object (say, List<string>) via this? So far I have not had much luck. When...
28
by: ensemble | last post by:
I'm trying to utilized a more object-oriented approach to managing window events in javascript. Thus, I am creating a "controller" object to handle events and interact with the server. However, I...
11
by: =?Utf-8?B?U2FsYW1FbGlhcw==?= | last post by:
Has anybody worked with performancecounter object to access counters on remote machine? I managed to write code that retrieves counters categories froma remote machine, when I try another remote...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.