Hi,
I have a project which currently consists of Form1, Button1, Label1 and Timer1.I can run this code with no problem.vb.net Code:
Imports Microsoft.Win32 Imports System.IO Public Class Form1 Private Sub Form1_Load() Handles MyBase.Load End Sub Private Sub Button1_Click() Handles Button1.Click Me.Close() End Sub
I want to add a PerformanceCounter, when I added one and ran it
The project didn't run, I got an error message.I removed the PerformanceCounter, and ran it again, no problem.System.InvalidOperationException
HResult=0x80131509
Message=An error occurred creating the form. See Exception.InnerException for details. The error is: Failed to initialize because CategoryName is missing.
Source=DiscMonitor
StackTrace:
at DiscMonitor.My.MyProject.MyForms.Create__Instance__[T](T Instance) in :line 190
at DiscMonitor.My.MyProject.MyForms.get_Form1()
at DiscMonitor.My.MyApplication.OnCreateMainForm() in D:\~VB Trials\DiscMonitor\My Project\Application.Designer.vb:line 35
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at DiscMonitor.My.MyApplication.Main(String[] Args) in :line 81
This exception was originally thrown at this call stack:
[External Code]
Inner Exception 1:
InvalidOperationException: Failed to initialize because CategoryName is missing.
I then added a PerformanceCounter again and ran it. Just got the error again.
I don't understand why just adding a control should cause this problem.
Poppa
Windows 10 Home.
Microsoft Visual Studio Community 2019
Version 16.7.2
VisualStudio.16.Release/16.7.2+30413.136
Microsoft .NET Framework
Version 4.8.03752
Installed Version: Community
Azure App Service Tools v3.0.0 16.7.532.28833
Azure App Service Tools v3.0.0
C# Tools 3.7.0-6.20412.3+d3c3a44a4e7ad31cc75c59be0d3df4a19ff33878
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
IntelliCode Extension 1.0
IntelliCode Visual Studio Extension Detailed Info
NuGet Package Manager 5.7.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info
Visual Basic Tools 3.7.0-6.20412.3+d3c3a44a4e7ad31cc75c59be0d3df4a19ff33878
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio