Initialisierung ist fehlgeschlagen bei OSFullname

  • VB.NET

Es gibt 11 Antworten in diesem Thema. Der letzte Beitrag () ist von SystemUnknow.

    Initialisierung ist fehlgeschlagen bei OSFullname

    Seit ein paar Tagen bekomme ich folgenden Fehler bei folgendem Code.


    Initialisierung ist fehlgeschlagen.

    System.Management.ManagementException wurde nicht behandelt.



    Code:

    VB.NET-Quellcode

    1. Public Class Form2
    2. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    3. 'MessageBox.Show(My.Computer.Info.OSFullName)
    4. Dim ci As Microsoft.VisualBasic.Devices.ComputerInfo = Nothing
    5. ci = New Microsoft.VisualBasic.Devices.ComputerInfo()
    6. MessageBox.Show(ci.OSFullName)
    7. End Sub
    8. End Class
    Das könnte vielleicht die Antwort drauf sein:


    Alle öffentlichen statischen (Shared in Visual Basic) Member dieses Typs sind threadsicher. Bei Instanzmembern ist die Threadsicherheit nicht gewährleistet.


    Quelle: msdn.microsoft.de

    //EDIT: Bezieht sich auf Managemen Exception. Link: msdn.microsoft.com/de-de/libra…mentexception(VS.80).aspx
    "Wenn jemand in einem Betrieb unverzichtbar ist, dann ist dieser Betrieb falsch organisiert." - Roberto Niederer
    Bei MessageBox.Show(ci.OSFullName) kommt der Fehler.


    System.Management.ManagementException wurde nicht behandelt.
    Message="Initialisierung ist fehlgeschlagen. "
    Source="System.Management"
    StackTrace:
    bei System.Management.ThreadDispatch.Start() bei System.Management.ManagementScope.Initialize() bei System.Management.ManagementObjectSearcher.Initialize() bei System.Management.ManagementObjectSearcher.Get() bei Microsoft.VisualBasic.Devices.ComputerInfo.get_OSManagementBaseObject() bei Microsoft.VisualBasic.Devices.ComputerInfo.get_OSFullName() bei ExceptionLibTest.Form2.Button1_Click(Object sender, EventArgs e) in H:\Entwicklung\Neuer Ordner (3)\ExceptionLibTest\ExceptionLibTest\Form2.vb:Zeile 11. bei System.Windows.Forms.Control.OnClick(EventArgs e) bei System.Windows.Forms.Button.OnClick(EventArgs e) bei System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) bei System.Windows.Forms.Control.WndProc(Message& m) bei System.Windows.Forms.ButtonBase.WndProc(Message& m) bei System.Windows.Forms.Button.WndProc(Message& m) bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) bei System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) bei System.Windows.Forms.Application.Run(ApplicationContext context) bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun() bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel() bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine) bei ExceptionLibTest.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:Zeile 81. bei System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() bei System.Threading.ThreadHelper.ThreadStart_Context(Object state) bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) bei System.Threading.ThreadHelper.ThreadStart()
    InnerException: