Laden...

NotSupportedException bei WinForm

Erstellt von JDizzle vor 18 Jahren Letzter Beitrag vor 18 Jahren 2.983 Views
J
JDizzle Themenstarter:in
15 Beiträge seit 2005
vor 18 Jahren
NotSupportedException bei WinForm

Hi,

ich hab einen sehr seltsamen Fehler in meiner Applikation. Wenn ich sie erstelle kommt kein Fehler, aber sobald ich sie starte krieg ich eine NotSupportedException bei meiner Form1.

Der Fehler kommt wenn eine Methode nicht unterstützt wird. Aber wie kanns denn sein, dass so elementare Methoden, wie initializeComponent oder Application.Run auf einmal nicht mehr unterstützt werden??

B
29 Beiträge seit 2005
vor 18 Jahren

Ein bisschen Code wäre sehr hilfreich, und auch der genaue Text der in der Exception steh, sonst werden wir da ned sonderlich weiterhelfen können, und nur auf gut Glück herumraten

J
JDizzle Themenstarter:in
15 Beiträge seit 2005
vor 18 Jahren
public class Form1 : System.Windows.Forms.Form
	{
		public Form1()
		{
			//
			// Erforderlich für die Windows Form-Designerunterstützung
			
				InitializeComponent();
			

			//
			// TODO: Konstruktorcode hinter dem InitializeComponent-Aufruf hinzufügen
			//
		}
		/// <summary>
		/// Verwendete Ressourcen bereinigen.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			base.Dispose( disposing );
		}
		#region Vom Windows Form-Designer generierter Code
		/// <summary>
		/// Erforderliche Methode für die Designerunterstützung. 
		/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
		/// </summary>
		private void InitializeComponent()
		{
			this.mainMenu1 = new System.Windows.Forms.MainMenu();
			this.tabControl1 = new System.Windows.Forms.TabControl();
			this.tabPage1 = new System.Windows.Forms.TabPage();
			this.txtVerdacht = new System.Windows.Forms.TextBox();
			this.txtAdresse = new System.Windows.Forms.TextBox();
			this.btnbestätigen_tab1 = new System.Windows.Forms.Button();
			this.btnalarmieren_tab1 = new System.Windows.Forms.Button();
			this.btnabbrechen_tab1 = new System.Windows.Forms.Button();
			this.label10 = new System.Windows.Forms.Label();
			this.label9 = new System.Windows.Forms.Label();
			this.tabPage5 = new System.Windows.Forms.TabPage();
			this.button1 = new System.Windows.Forms.Button();
			this.Knappschaft = new System.Windows.Forms.CheckBox();
			this.AEV = new System.Windows.Forms.CheckBox();
			this.VdAK = new System.Windows.Forms.CheckBox();
			this.BKK = new System.Windows.Forms.CheckBox();
			this.IKK = new System.Windows.Forms.CheckBox();
			this.LKK = new System.Windows.Forms.CheckBox();
			this.AOK = new System.Windows.Forms.CheckBox();
			this.Versnr = new System.Windows.Forms.TextBox();
			this.label8 = new System.Windows.Forms.Label();
			this.Ort = new System.Windows.Forms.TextBox();
			this.label7 = new System.Windows.Forms.Label();
			this.PLZ = new System.Windows.Forms.TextBox();
			this.label6 = new System.Windows.Forms.Label();
			this.Strasse = new System.Windows.Forms.TextBox();
			this.label5 = new System.Windows.Forms.Label();
			this.Vorname = new System.Windows.Forms.TextBox();
			this.Name = new System.Windows.Forms.TextBox();
			this.label4 = new System.Windows.Forms.Label();
			this.label3 = new System.Windows.Forms.Label();
			this.Geburtsdatum = new System.Windows.Forms.TextBox();
			this.w = new System.Windows.Forms.CheckBox();
			this.m = new System.Windows.Forms.CheckBox();
			this.label2 = new System.Windows.Forms.Label();
			this.label1 = new System.Windows.Forms.Label();
			this.tabPage6 = new System.Windows.Forms.TabPage();
			this.button3 = new System.Windows.Forms.Button();
			this.textBox_KreislaufMaßnahmen = new System.Windows.Forms.TextBox();
			this.groupBox_KreislaufMaßnahmen = new OpenNETCF.Windows.Forms.GroupBox();
			this.rErstdefibrillation = new System.Windows.Forms.RadioButton();
			this.rHerzdruckmassage = new System.Windows.Forms.RadioButton();
			this.rInfusion = new System.Windows.Forms.RadioButton();
			this.rvenoeserZugang = new System.Windows.Forms.RadioButton();
			this.rEKGMonitoring = new System.Windows.Forms.RadioButton();
			this.groupBox_AtmungMaßnahme = new OpenNETCF.Windows.Forms.GroupBox();
			this.rAtemwegefreimachen = new System.Windows.Forms.RadioButton();
			this.rBeatmung = new System.Windows.Forms.RadioButton();
			this.rIntubation = new System.Windows.Forms.RadioButton();
			this.rSauerstoffgabe = new System.Windows.Forms.RadioButton();
			this.groupBox_allgemein = new OpenNETCF.Windows.Forms.GroupBox();
			this.rkeineallgemein = new System.Windows.Forms.RadioButton();
			this.rsonstigeallgemein = new System.Windows.Forms.RadioButton();
			this.rMedikamente = new System.Windows.Forms.RadioButton();
			this.groupBox_Wundversorgung = new OpenNETCF.Windows.Forms.GroupBox();
			this.rWundversorgung = new System.Windows.Forms.RadioButton();
			this.rVakuummatratze = new System.Windows.Forms.RadioButton();
			this.rExtremitaetschienung = new System.Windows.Forms.RadioButton();
			this.rHWSStutzkragen = new System.Windows.Forms.RadioButton();
			this.groupBox_Lagerung = new OpenNETCF.Windows.Forms.GroupBox();
			this.rstabileSeitenlage = new System.Windows.Forms.RadioButton();
			this.rSchocklagerung = new System.Windows.Forms.RadioButton();
			this.rOberkoerperhochlage = new System.Windows.Forms.RadioButton();
			this.rFlachlagerung = new System.Windows.Forms.RadioButton();
			this.tabPage8 = new System.Windows.Forms.TabPage();
			this.groupBox_Uebergabe_tab7 = new OpenNETCF.Windows.Forms.GroupBox();
			this.rTod = new System.Windows.Forms.RadioButton();
			this.rNAabbestellt = new System.Windows.Forms.RadioButton();
			this.rNAnachgefordert = new System.Windows.Forms.RadioButton();
			this.rZverschlechtert = new System.Windows.Forms.RadioButton();
			this.rZunveraendert = new System.Windows.Forms.RadioButton();
			this.rZverbessert = new System.Windows.Forms.RadioButton();
			this.label17 = new System.Windows.Forms.Label();
			this.groupBox_Ersthelferma_tab7 = new OpenNETCF.Windows.Forms.GroupBox();
			this.rkeine_Ersthelferm = new System.Windows.Forms.RadioButton();
			this.rinsuffizient = new System.Windows.Forms.RadioButton();
			this.rsuffizient = new System.Windows.Forms.RadioButton();
			this.tabPage2 = new System.Windows.Forms.TabPage();
			this.btnthw_tab2 = new System.Windows.Forms.Button();
			this.btnpolizei_tab2 = new System.Windows.Forms.Button();
			this.btnffw_tab2 = new System.Windows.Forms.Button();
			this.btnrtw_tab2 = new System.Windows.Forms.Button();
			this.btnnotarzt_tab2 = new System.Windows.Forms.Button();
			this.label11 = new System.Windows.Forms.Label();
			this.tabPage3 = new System.Windows.Forms.TabPage();
			this.tabControl2 = new System.Windows.Forms.TabControl();
			this.tabPage4 = new System.Windows.Forms.TabPage();
			this.groupBox_Schmerzen = new OpenNETCF.Windows.Forms.GroupBox();
			this.rstarkSchmerzen = new System.Windows.Forms.RadioButton();
			this.rmittelSchmerzen = new System.Windows.Forms.RadioButton();
			this.rkeineSchmerzen = new System.Windows.Forms.RadioButton();
			this.groupBox_EKG = new OpenNETCF.Windows.Forms.GroupBox();
			this.rAsystolie = new System.Windows.Forms.RadioButton();
			this.rKammerflimmern = new System.Windows.Forms.RadioButton();
			this.rRhythmusstoerung = new System.Windows.Forms.RadioButton();
			this.rSinusrhythmus = new System.Windows.Forms.RadioButton();
			this.groupBox_Pupillenfunktion = new OpenNETCF.Windows.Forms.GroupBox();
			this.label15 = new System.Windows.Forms.Label();
			this.label14 = new System.Windows.Forms.Label();
			this.label13 = new System.Windows.Forms.Label();
			this.label12 = new System.Windows.Forms.Label();
			this.groupBox_Pupillenfunktion_rechts = new OpenNETCF.Windows.Forms.GroupBox();
			this.r_r_entrund = new System.Windows.Forms.RadioButton();
			this.r_r_weit = new System.Windows.Forms.RadioButton();
			this.r_r_mittel = new System.Windows.Forms.RadioButton();
			this.r_r_eng = new System.Windows.Forms.RadioButton();
			this.groupBox_Pupillenfunktion_links = new OpenNETCF.Windows.Forms.GroupBox();
			this.r_l_entrund = new System.Windows.Forms.RadioButton();
			this.r_l_weit = new System.Windows.Forms.RadioButton();
			this.r_l_mittel = new System.Windows.Forms.RadioButton();
			this.r_l_eng = new System.Windows.Forms.RadioButton();
			this.groupBox_Bewusstseinslage = new OpenNETCF.Windows.Forms.GroupBox();
			this.rbewusstlos = new System.Windows.Forms.RadioButton();
			this.rgetrübt = new System.Windows.Forms.RadioButton();
			this.rorientiert = new System.Windows.Forms.RadioButton();
			this.groupBox_Atmung = new OpenNETCF.Windows.Forms.GroupBox();
			this.rAtemstillstand = new System.Windows.Forms.RadioButton();
			this.rHyperventilation = new System.Windows.Forms.RadioButton();
			this.rAtemnot = new System.Windows.Forms.RadioButton();
			this.rspontan = new System.Windows.Forms.RadioButton();
			this.groupBox_Kreislauf = new OpenNETCF.Windows.Forms.GroupBox();
			this.rPulsunregelm = new System.Windows.Forms.RadioButton();
			this.rPulsregelm = new System.Windows.Forms.RadioButton();
			this.rKreislaufstillstand = new System.Windows.Forms.RadioButton();
			this.rSchock = new System.Windows.Forms.RadioButton();
			this.tabPage10 = new System.Windows.Forms.TabPage();
			this.txtBZ3 = new System.Windows.Forms.TextBox();
			this.txtBZ2 = new System.Windows.Forms.TextBox();
			this.txtBZ1 = new System.Windows.Forms.TextBox();
			this.txtSpO23 = new System.Windows.Forms.TextBox();
			this.txtSpO22 = new System.Windows.Forms.TextBox();
			this.txtSpO21 = new System.Windows.Forms.TextBox();
			this.txtAF3 = new System.Windows.Forms.TextBox();
			this.txtAF2 = new System.Windows.Forms.TextBox();
			this.txtAF1 = new System.Windows.Forms.TextBox();
			this.txtPuls3 = new System.Windows.Forms.TextBox();
			this.txtPuls2 = new System.Windows.Forms.TextBox();
			this.txtPuls1 = new System.Windows.Forms.TextBox();
			this.txtRRdiast3 = new System.Windows.Forms.TextBox();
			this.txtRRdiast2 = new System.Windows.Forms.TextBox();
			this.txtRRdiast1 = new System.Windows.Forms.TextBox();
			this.txtRRsyst3 = new System.Windows.Forms.TextBox();
			this.txtRRsyst2 = new System.Windows.Forms.TextBox();
			this.txtRRsyst1 = new System.Windows.Forms.TextBox();
			this.label25 = new System.Windows.Forms.Label();
			this.label24 = new System.Windows.Forms.Label();
			this.label23 = new System.Windows.Forms.Label();
			this.label22 = new System.Windows.Forms.Label();
			this.label21 = new System.Windows.Forms.Label();
			this.label20 = new System.Windows.Forms.Label();
			this.label19 = new System.Windows.Forms.Label();
			this.label18 = new System.Windows.Forms.Label();
			this.tabPage11 = new System.Windows.Forms.TabPage();
			this.button2 = new System.Windows.Forms.Button();
			this.checksonstige = new System.Windows.Forms.CheckBox();
			this.checkPsychatrie = new System.Windows.Forms.CheckBox();
			this.checkNeurologie = new System.Windows.Forms.CheckBox();
			this.checkPaediatrie = new System.Windows.Forms.CheckBox();
			this.checkGeburtshilfe = new System.Windows.Forms.CheckBox();
			this.checkGynaekologie = new System.Windows.Forms.CheckBox();
			this.checkHypothermie = new System.Windows.Forms.CheckBox();
			this.checkIntoxikation = new System.Windows.Forms.CheckBox();
			this.checkStoffwechsel = new System.Windows.Forms.CheckBox();
			this.checkAbdomen = new System.Windows.Forms.CheckBox();
			this.checkKreislauf = new System.Windows.Forms.CheckBox();
			this.checkAtmung = new System.Windows.Forms.CheckBox();
			this.tabPage7 = new System.Windows.Forms.TabPage();
			this.txtsonstige_Krankenhaus = new System.Windows.Forms.TextBox();
			this.rsonstige_Krankenhaus = new System.Windows.Forms.RadioButton();
			this.rBGLudwigshafen = new System.Windows.Forms.RadioButton();
			this.rKopfklinik = new System.Windows.Forms.RadioButton();
			this.rHeiligGeistHospital = new System.Windows.Forms.RadioButton();
			this.rKreiskrankenhaus = new System.Windows.Forms.RadioButton();
			this.rElisabethenstift = new System.Windows.Forms.RadioButton();
			this.label16 = new System.Windows.Forms.Label();
			this.tabPage9 = new System.Windows.Forms.TabPage();
			this.btnAnkunft_tab8 = new System.Windows.Forms.Button();
			this.label26 = new System.Windows.Forms.Label();
			// 
			// Form1
			// 
			this.Controls.Add(this.tabControl1);
			this.Menu = this.mainMenu1;
			this.MinimizeBox = false;
			this.Text = "ResCom";
			this.Load += new System.EventHandler(this.Form1_Load);

		}
		#endregion

		/// <summary>
		/// Der Haupteinstiegspunkt für die Anwendung.
		/// </summary>

		static void Main() 
		{
			
				Application.Run(new Form1());
			
		}
 

Das ist der Code bis zur zweiten Stelle, wo die Exception geworfen wird.

Die Fehlermeldung lautet: Eine nicht behandelte Ausnahme des Typs 'System.NotSupportedException' ist in SmartDeviceApplication7.exe aufgetreten.

ist halt nicht so wirklich aussagekräftig...

6.862 Beiträge seit 2003
vor 18 Jahren

Glaube der Dateiname deiner Applikation hat mehr gebracht als der ganze Code 🙂
Das Compact Framework unterstützt nicht alle Funktionen des normalen Frameworks, und kann sein das bei dir genau das diese NotSupportedException auslöst. Welche das genau nun ist, müsste man eventuell einfach mitm Debugger raussuchen.

Baka wa shinanakya naoranai.

Mein XING Profil.

1.549 Beiträge seit 2004
vor 18 Jahren

Wenn du fast 2000 Zeilen Code Postest wäre es vielleicht hilfreich 1. Den Code Comilen zu können oder 2. zu wissen in welcher Zeile die NotSupportedException auftritt

Edit ich habe den Code jetzt geschafft zu Compilern aber bei mir tritt kein Fehler auf

Wir Arbeiten eigendlich nicht wir nehmen nur das geld

J
JDizzle Themenstarter:in
15 Beiträge seit 2005
vor 18 Jahren

Sorry wegen dem Code. Wegen der wirren Fehlermeldung, hatte ich keinen Plan was evtl wichtig sein könnte.

der Fehler tritt auf, wenn er versucht die Form mit Application.Run zu starten, dann verweist er auf die geschweifte Klammer, die public Form1() schließt.

Ich hätte gedacht, der Fehler liegt irgendwo im InitializeComponent, aber bis zu dem Code, kommt er beim Debuggen erst gar nicht.

1.549 Beiträge seit 2004
vor 18 Jahren

Aber ich habe die Anwendung schon gestartet und da ist keine Exception was sagt den dein Debugger dazu??

Wir Arbeiten eigendlich nicht wir nehmen nur das geld

J
JDizzle Themenstarter:in
15 Beiträge seit 2005
vor 18 Jahren

ich hab den Code auch mal in eine neue SmartDeviceApplication kopiert und ein paar Sachen rauskommentiert, aber der Fehler kommt trotzdem, beim abschließenden } von public Form1()

1.549 Beiträge seit 2004
vor 18 Jahren

Versuch es doch mal in einer normalen Win Form Anwendung wenn da der Fehler nicht auftritt liegt es am SmartDeviceApplication

Wir Arbeiten eigendlich nicht wir nehmen nur das geld

J
JDizzle Themenstarter:in
15 Beiträge seit 2005
vor 18 Jahren

ok hab den Fehler gefunden. Das Compact Framework erlaubt nur 50 Radiobuttons. 8o

Und anstatt, dass da eine gescheite Meldung kommt, muss ich mich damit rumquälen.......hach ich liebe das CF einfach 😜

S
8.746 Beiträge seit 2005
vor 18 Jahren

Von einer Limitierung auf 50 Buttons hab ich ja noch nie gehört! Hast du eine Quelle für diese Informationen?

Und btw: Wie bekommst du mehr 50 Buttons auf einem PDA angezeigt? 🙂

1.549 Beiträge seit 2004
vor 18 Jahren

Wenn du dir den Code mal genauer anschaust hat er es so gemacht das die Buttens auf verschiedene Tappags verteilt sind warum machst du den Inhalt der einzelnen Tappags nicht in UserCoontrols und zeigst die dann an dann hast du auf deinem Form nicht mehr als 50 Buttens

Wir Arbeiten eigendlich nicht wir nehmen nur das geld

D
5 Beiträge seit 2005
vor 18 Jahren

Hallo,

ich habe zur Zeit ein ähnliches Problem. In meiner Anwendung (CompactFramework) habe ich jede Menge Steuerelemente drin. Alles funktioniert einwandfrei. Jetzt wollte ich aber noch ein Label hinzufügen. Und da bekomm ich ebenfalls eine NotSupportedException, die in der InitializeComponent() Methode geworfen wird.

Kann es vielleicht doch sein, dass man zu einem Formular nur eine bestimmte Anzahl an Steuerelementen hinzufügen kann?

S
8.746 Beiträge seit 2005
vor 18 Jahren

Hab nun auch mal ein wenig nachgeforscht, und die Ursache des Problems ist noch hahnebüchender als man vermuten kann:

Das CF erlaubt pro Methode maximal 64 KB JIT-Code. Wenn man viele Controls auf ein Form konzentriert, dann wird InitializeComonents() schlicht zu dick. Leider kann man ja InitializeComponents() nicht einfach aufsplitten.... macht einem der Designer wieder zunichte.

Man kann daher nicht genau sagen, dass nur x Controls gehen.

Hier ein Link zur Info-Quelle mit ein paar Tipps zur Umgehung des Problemes:

http://wiki.opennetcf.org/ow.asp?p=CompactFrameworkFAQ/NotSupportedException&revision=1