InstallUtil, PerformanceCounterInstaller interactions

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi...

I've got some perf counters that I install with a
PerformanceCounterInstaller. I've got new code I want to test and legacy
code installed on the same system. I *thought* that the
PerformanceCounterInstaller would fail if the counter category was already
installed. It appears, however, that InstallUtil just installs over the old
copy (so my legacy code starts freaking out).

It this the case? Is there any way to have InstallUtil at least warn if the
counters are already there and not do it?

I made my new code backward compatible but the legacy code won't work with
the new counters.

Thanks
Mark
 
Hi Mark,

Currently the PerformanceCounterInstaller will indeed overwrite the
existing category and counter information in registry by default. If you
use Reflector (http://www.aisto.com/roeder/dotnet/) to view the source of
PerformanceCounterInstaller (in
%windir%\Microsoft.NET\Framework\v2.0.50727\system.configuration.install.dll
), you will see it delegates call to PerformanceCounterCategory.Create() to
add the category and counter.

To workaround this, I think you could create a custom class to inherit from
PerformanceCounterInstaller and override the Install method, and call into
PerformanceCounterCategory.Exists() before call base.Install(). According
to your requirement, you could prompt the user if the category already
exists.

Please feel free to let me know there's anything unclear.


Sincerely,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi Walter...

Thank you very much; that's a great suggestion.

On a related point, the assembly I was using InstallUtil on creates both a
set of perf counters and an event log source. When the new dll installs over
the old, I notice some odd behavior. I don't gac my assemblies; they're all
deployed in the directory where the other consuming assemblies live, so they
should all resolve to using the ones in their directory. But after running
InstallUtil on the new dll in one directory, I noticed it breaking a number
of things in the other running app in the different directory. It seemed
that installing perfcounters and an event log source changed how assembly
paths got resolved and which ones got pulled in. I could tell because the
old app suddenly started to log messages (using log4net) using properties
defined in the new code.

When I check the registry, a framework dll, netfxperf.dll, is listed as the
maintainer of those perf counters and EventLogMessages.dll is listed as the
message definition source for my event log source. I understand the new
Installers whacked over my definitions with the new ones, but I don't see the
trail of assembly linkages that overrode local-dir resolution.

Does netfxperf.dll load the assemblies that contain the counter definitions
or something?

Thanks
-Mark
 
Hi Mark,

I'm not very sure about your question about how the log4net will use new
properties when the event log source gets updated. Do you mean that you're
using the .NET's event log source installer to create a new event log
source but you're using log4net to write to event log? Is your old
application an .NET 1.1 application?

Basically the EventLogMessages.dll is a resource only dll with a
messagetable that has 65535 simple strings all have values "%1". You can
use Resource Hacker (http://www.angusj.com/resourcehacker/) to open it
(%windir%\Microsoft.NET\Framework\v2.0.50727\EventLogMessages.dll or
%windir%\Microsoft.NET\Framework\v1.1.4322\EventLogMessages.dll). This
seems strange at first, it's because messages written to event log file are
only a ReplacementStrings array, a complete event log message will be
composed by three parts:

* EventID
* the ReplacementStrings array
* a template string in the message resource file

In this case, the template here in .NET will be always "%1", which means
the whole message written to event log file will be simply returned as it
is.

Given that the .NET 1.1 EventLogMessages.dll is similar to .NET 2.0, I
don't think updating the message resource file of the event log source will
change the messages shown in event log.

Anyway, would you please elaborate more on the details of the issue? Thanks.

Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi Mark,

I am interested in this issue. Would you mind letting me know the result of
the suggestions? If you need further assistance, feel free to let me know.
I will be more than happy to be of assistance.

Have a great day!


Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top