InvalidOperationException

  • VB.NET

Es gibt 3 Antworten in diesem Thema. Der letzte Beitrag () ist von AliveDevil.

    InvalidOperationException

    Seit dem ich die SQLite DLL hinzugefügt habe, bekomme ich folgendes Problem beim Laden meiner Form

    Quellcode

    1. System.InvalidOperationException was unhandled
    2. Message=Fehler beim Erstellen des Formulars. Weitere Informationen finden Sie in Exception.InnerException. Fehler: Die Assembly im gemischten Modus wurde während Version v2.0.50727 der Laufzeit erstellt und kann nicht während der 4.0-Laufzeit ohne zusätzliche Konfigurationsinformationen geladen werden..
    3. Source=School Management
    4. StackTrace:
    5. bei School_Management.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:Zeile 190.
    6. bei School_Management.My.MyProject.MyForms.get_frmLogin()
    7. bei School_Management.FrmFirstUse.btnContinue_Click(Object sender, EventArgs e) in C:\Users\Haze\Documents\Visual Studio 2010\Projects\School Management\School Management\frmFirstUse.vb:Zeile 17.
    8. bei System.Windows.Forms.Control.OnClick(EventArgs e)
    9. bei Telerik.WinControls.RadControl.OnClick(EventArgs e)
    10. bei Telerik.WinControls.UI.RadButton.ButtonElement_Click(Object sender, EventArgs e)
    11. bei Telerik.WinControls.RadItem.OnClick(EventArgs e)
    12. bei Telerik.WinControls.UI.RadButtonItem.OnClick(EventArgs e)
    13. bei Telerik.WinControls.RadItem.DoClick(EventArgs e)
    14. bei Telerik.WinControls.RadItem.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)
    15. bei Telerik.WinControls.RadElement.RaiseRoutedEvent(RadElement sender, RoutedEventArgs args)
    16. bei Telerik.WinControls.RadItem.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)
    17. bei Telerik.WinControls.RadElement.RaiseRoutedEvent(RadElement sender, RoutedEventArgs args)
    18. bei Telerik.WinControls.RadElement.DoMouseUp(MouseEventArgs e)
    19. bei Telerik.WinControls.RadElement.CallDoMouseUp(MouseEventArgs e)
    20. bei Telerik.WinControls.ComponentInputBehavior.OnMouseUp(MouseEventArgs e)
    21. bei Telerik.WinControls.RadControl.OnMouseUp(MouseEventArgs e)
    22. bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
    23. bei System.Windows.Forms.Control.WndProc(Message& m)
    24. bei System.Windows.Forms.ScrollableControl.WndProc(Message& m)
    25. bei Telerik.WinControls.RadControl.WndProc(Message& m)
    26. bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
    27. bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
    28. bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    29. bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
    30. bei System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
    31. bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
    32. bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
    33. bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
    34. bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
    35. bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
    36. bei School_Management.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:Zeile 81.
    37. bei System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
    38. bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
    39. bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
    40. bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
    41. bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
    42. bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    43. bei System.Threading.ThreadHelper.ThreadStart()
    44. InnerException: System.IO.FileLoadException
    45. Message=Die Assembly im gemischten Modus wurde während Version v2.0.50727 der Laufzeit erstellt und kann nicht während der 4.0-Laufzeit ohne zusätzliche Konfigurationsinformationen geladen werden.
    46. Source=School Management
    47. StackTrace:
    48. bei School_Management.ManageSchool..ctor(String BaseURL)
    49. bei School_Management.frmLogin..ctor() in C:\Users\Haze\Documents\Visual Studio 2010\Projects\School Management\School Management\frmLogin.vb:Zeile 8.
    50. InnerException:


    Die Zeile in der der Fehler auftritt:

    VB.NET-Quellcode

    1. frmLogin.Show()


    ManageSchool-Klasse

    pastebin.com/z5ANKY1q

    Hat jemand eine Ahnung wie ich das fixxen könnte :|?

    VB.NET-Quellcode

    1. 'avoid threadovertaking actions
    2. Control.CheckForIllegalCrossThreadCalls = False
    3. 'get the username and add it to the label
    4. headerWelcome.Caption = String.Format("Willkommen {0}", GetUserName)
    5. 'disable all controls
    6. EnableControls(False)
    7. 'fill in the data from the registry, if it is saved
    8. txtLoginPassword.Text = PW
    9. txtLoginUsername.Text = ID
    10. rddClass.Text = [Class]
    11. rddKind.Text = Kind
    12. 'check/uncheck the checboxes, look it up in the registry
    13. cbRememberPassword.Checked = CBool(GetSetting(Application.ProductName, "Settings", "Remember Password", "False"))
    14. cbRememberUsername.Checked = CBool(GetSetting(Application.ProductName, "Settings", "Remember Username", "False"))
    15. 'start a multithread to get classes and schools
    16. Dim mt_ClassesAndSchools As New Threading.Thread(AddressOf GetClassesAndSchools)
    17. mt_ClassesAndSchools.Start()
    18. Me.Height = 350


    VB.NET-Quellcode

    1. Private Sub GetClassesAndSchools()
    2. 'get a list of current classes
    3. CurrentClasses = SMS.RetreiveClasses
    4. 'get a list of current schools
    5. CurrentSchools = SMS.RetreiveSchools
    6. 'make sure there is no item in the list
    7. rddClass.Items.Clear()
    8. 'if there are any class registered
    9. If CurrentClasses.Count <> 0 Then
    10. 'loop through each class
    11. For i = 0 To CurrentClasses.Count - 1
    12. With CurrentClasses(i)
    13. 'add the class to the list of classes(login form)
    14. rddClass.Items.Add(.Classname)
    15. rddStudentClass.Items.Add(.Classname)
    16. End With
    17. Next
    18. End If
    19. 'make sure there is no item in the list
    20. rddClassSchool.Items.Clear()
    21. 'if there are any schools registered
    22. If CurrentSchools.Count <> 0 Then
    23. 'loop through each school
    24. For i = 0 To CurrentSchools.Count - 1
    25. With CurrentSchools(i)
    26. 'add the school to the list of schools(register class)
    27. rddClassSchool.Items.Add(.Name)
    28. rddTeacherSchool.Items.Add(.Name)
    29. rddStudentSchool.Items.Add(.Name)
    30. End With
    31. Next
    32. End If
    33. rddClass.Text = [Class]
    34. 'enable the controls again
    35. EnableControls(True)
    36. If SMS.IsUpdateAvailable Then
    37. If RadMessageBox.Show("Eine Aktualisierung ist verfügbar. Möchten Sie diese jetzt herunterladen?") = Windows.Forms.DialogResult.OK Then
    38. If IO.File.Exists("Update SMS.exe") Then
    39. Dim CurrentVersion As String = Application.ProductVersion
    40. Process.Start(String.Concat(Application.StartupPath, String.Format("\Update SMS.exe {0} {1} {2}", UpdateURL, CurrentVersion, NewestVersion)))
    41. End If
    42. End If
    43. End If
    44. End Sub


    Ohne die ganze SQLite Sachen, geht das.
    hahaha....du liest dir die fehlermeldung nicht mal durch -.- da steht: Message=Die Assembly im gemischten Modus wurde während Version v2.0.50727 der Laufzeit erstellt und kann nicht während der 4.0-Laufzeit ohne zusätzliche Konfigurationsinformationen geladen werden.
    Bedeutet: SQLite .Net 2 und deine Anwendung .Net 4
    Was tust du: .Net Framework auf 3 oder 3.5 runterschrauben