Ich habe eine Anwendung in VS2015 (FrameWork 4.0) geschrieben. Es funktioniert gut unter Windows 7, 10, aber auf XP SP3 stürzt es ab.Splash-Screen verursacht einen Absturz unter Windows XP
fand ich, dass der problematische Code zu dem Splash-Screen verwandt ist.
die folgende Zeile nicht kommentiert aus nicht dazu führen, dem Absturz mehr:
this.SplashScreen = new SplashScreen();
Der gesamte Code:
using Microsoft.VisualBasic.ApplicationServices; // requires Microsoft.VisualBasic.dll to be added as reference
static class Program
{
[STAThread]
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
new POManagementApplication().Run(args);
}
}
class POManagementApplication : WindowsFormsApplicationBase
{
#region Methods
protected override void OnCreateSplashScreen()
{
this.SplashScreen = new SplashScreen(); // commenting solve the crash issue
}
protected override void OnCreateMainForm()
{
this.MainForm = new PrintPOForm();
}
#endregion
}
Dies ist die Splashscreen-Form:
public partial class SplashScreen : Form
{
#region Constructors
public SplashScreen()
{
InitializeComponent();
}
#endregion
}
Und der Designer :
partial class SplashScreen
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// SplashScreen
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackgroundImage = global::POManagement.Net.Properties.Resources.Pic1;
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.ClientSize = new System.Drawing.Size(839, 516);
this.ControlBox = false;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(839, 516);
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(839, 516);
this.Name = "SplashScreen";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.ResumeLayout(false);
}
#endregion
}
Update:
Per @Spender Vorschlag, finden Sie das Anwendungsereignisprotokoll:
Framework Version: v4.0.30319 Beschreibung: Der Prozess aufgrund eines internen Fehlers beendet in dem .NET-Runtime auf IP 79480C78 (79.140.000) mit Exit-Code 80131506.
Wenn Sie dies setzen.SplashScreen = new SplashScreen(); in einem Versuch zu fangen, was ist die Ausnahme Nachricht? – GuidoG
Kompilieren und laufen Sie auf dem XP-Computer oder kompilieren Sie auf Ihrem Nicht-XP-Entwicklungscomputer, kopieren die Binärdateien und laufen auf XP? –
Ist Ihre XP-Maschine 32-Bit? – LordWilmore