From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 1172 occurred at Error creating instance of PerformanceCounter

We have an issue with a LabVIEW VI that runs correctly on a development PC, but is encountering an "Error 1172" when we run the same VI on a lab PC. The enclosed fragment, taken from this (performance-monitor) VI, is sufficient to expose the issue. We attempt to create an instance of a .NET "Performance Counter" using the constant string inputs shown. When executed on the develpment PC, this code finishes without errors (though admittedly doesn't do anything useful). When executed on the lab PC, however, the following error message appears in a popup:

 

Error 1172 occurred at Error creating instance of Performance Counter in assembly System.Diagnostics.PerformanceCounter, System, Version = 2.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089, (System.FormatException: Input string was not in a correct format.)

 

Both machines are running LabVIEW 2012 SP1 under Windows 7. The development PC is running the LabVIEW "Professional Development System", while the lab PC is running the "Debug Deployment". Both machines have the Microsoft .NET framework version 4.5.2 installed.

 

The input strings seem to be too simple to be "not in a correct format", and indeed they work correctly on the development machine. So it seems like we must be dealing with a PC configuration issue? Any suggestions as to how we might track this down would be greatly appreciated!

 

Barry Wealand

 

0 Kudos
Message 1 of 9
(5,309 Views)

One thing to try - from the error LabVIEW is trying to load a component from the CLR 2 stack (up to and including .NET Framework 3.5). This is expected - 2012 only supports up to CLR 2 without manually configuring which CLR to host via config file. So the fact that .NET Framework 4.5.2 is installed doesn't help. Does the target machine have .NET framework 3.5 installed?

0 Kudos
Message 2 of 9
(5,302 Views)

Thank you for this very promising suggestion. I checked the .NET configuration of the development PC (where the code fragment works correctly) and found that, in addition to 4.5.2, it also had Compact Framework 2.0 SP2 and Compact Framework 3.5 installed. The lab PC only had 4.5.2 installed, so I downloaded and installed these earlier packages as well. Unfortunately, this did not seem to have any effect on the problem.

 

The development PC also has ".NET Framework 4 Multi-Targeting Pack" installed, which is not on the lab PC. Since this appears to be a version-4-related product, I've assumed that this should not be relevant to the problem at hand.

 

Any further suggestions? Thanks again.

 

0 Kudos
Message 3 of 9
(5,272 Views)

I'm able to get to the stack_overflow page OK, but the link to the solution that seems to be most promising appears to be broken. It seems as if it may involve some kind of a rebuild? If this would require tools like Visual Studio, these are not installed on the lab PC anyway.

 

Thanks again!

 

--Barry

0 Kudos
Message 5 of 9
(5,228 Views)

I found another source that covers rebuilding the Performance Counters. Give that a try.

 

http://blogs.technet.com/b/yongrhee/archive/2009/10/06/how-to-rebuild-performance-counters-on-window...

 

 

There were a couple more resources I found in Microsoft's support pages. I read through them and it doesn't sound like they are tailored to the specific error you're seeing, but I included them anyway if you want to glance at them. Maybe if rebuilding the performance counters with the first method doesn't work, you can find something else useful in these.

 

https://support.microsoft.com/en-us/kb/300956

https://support.microsoft.com/en-us/kb/2554336

 

Hope this helps!

 

-Will

Message 6 of 9
(5,218 Views)

Yes, this was the ticket. Problem solved! Thanks again!

0 Kudos
Message 7 of 9
(5,195 Views)

Yes thank you this worked as mentioned in the link above:

Click on Start, CMD (as an Administrator)
Type “C:” without the quotation marks and Enter.
Type “CD\windows\system32” without the quotation marks and Enter.
Type “LodCtr.exe /S:Backup_Original.INI” without the quotation marks and Enter.
Note: This let’s you backup the performance counters before we rebuild.
Type “LodCtr.exe /R:PerfStringBackup.INI” without the quotation marks and Enter.
Open up Perfmon and check to see if your counters are showing up properly.

For me what worked was "LodCtr.exe /R" as including the ini file specification caused error 1006 when running  LodCtr.  

Message 8 of 9
(4,492 Views)

Had this same problem on a fresh installation of Win10.

The registry keys mentioned earlier were all empty.

Running LodCtr.exe /R fixed the issue.

Message 9 of 9
(4,235 Views)