I have an application written in VS2015 (FrameWork 4.0). It works fine on Windows 7, 10 but on XP SP3 it crashes.
I found that the problematic code is related to the splash screen.
Commenting out the following line does not cause the crashing anymore:
this.SplashScreen = new SplashScreen();
The entire 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
}
This is the SplashScreen Form:
public partial class SplashScreen : Form
{
#region Constructors
public SplashScreen()
{
InitializeComponent();
}
#endregion
}
And the 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:
As per @Spender suggestion, following is the Application Event log:
Framework Version: v4.0.30319 Description: The process was terminated due to an internal error in the .NET Runtime at IP 79480C78 (79140000) with exit code 80131506.