Вместо элементов управления, нарисованных на экране, рисуется один или несколько «красных X», за которыми следует исключение. Строка исходного кода находится в конструкторе форм или в функции InitializeComponent (которые создаются Visual Studio, а не написаны программистом). Мы «можем» усилить приложение, чтобы вызвать эту ошибку, если мы будем перемещаться по меню намного быстрее, чем это сделал бы любой пользователь. Но это происходит - насколько мы можем (или не можем) идентифицировать - случайным образом. Ниже мы приводим несколько примеров возникших исключений, включая дату и время возникновения. Вы заметите, что root причиной исключения всегда является конструктор формы и инициализация компонента.
ОКРУЖЕНИЕ: Windows Приложение Forms. C#. Visual Studio 2017. Net Framework 4.8. Windows 10.
namespace _TESOUREIROAPP.Views.Base
{
partial class FrmBaseAPP
{
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.timerHorario = new System.Windows.Forms.Timer(this.components);
this.picGear = new System.Windows.Forms.PictureBox();
this.lblUsuario = new System.Windows.Forms.Label();
this.lblDataHora = new System.Windows.Forms.Label();
this.lblClienteEData = new System.Windows.Forms.Label();
this.lblAtmVersion = new System.Windows.Forms.Label();
this.picBarrinha = new System.Windows.Forms.PictureBox();
this.lblInstrucao = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.picGear)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picBarrinha)).BeginInit();
this.SuspendLayout();
this.timerHorario.Enabled = true;
this.timerHorario.Interval = 30000;
this.timerHorario.Tick += new System.EventHandler(this.timerHorario_Tick);
this.picGear.BackColor = System.Drawing.Color.Transparent;
this.picGear.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.picGear.Image = global::_TESOUREIROAPP.Properties.Resources.blue_loading_gif_transparent;
this.picGear.Location = new System.Drawing.Point(496, 368);
this.picGear.Name = "picGear";
this.picGear.Size = new System.Drawing.Size(31, 31);
this.picGear.TabIndex = 84;
this.picGear.TabStop = false;
this.picGear.Visible = false;
this.lblUsuario.BackColor = System.Drawing.Color.Transparent;
this.lblUsuario.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblUsuario.ForeColor = System.Drawing.Color.Transparent;
this.lblUsuario.Location = new System.Drawing.Point(842, 735);
this.lblUsuario.Name = "lblUsuario";
this.lblUsuario.Size = new System.Drawing.Size(170, 23);
this.lblUsuario.TabIndex = 73;
this.lblUsuario.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.lblDataHora.BackColor = System.Drawing.Color.White;
this.lblDataHora.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblDataHora.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(95)))), ((int)(((byte)(179)))));
this.lblDataHora.Location = new System.Drawing.Point(917, 21);
this.lblDataHora.Name = "lblDataHora";
this.lblDataHora.Size = new System.Drawing.Size(95, 45);
this.lblDataHora.TabIndex = 19;
this.lblDataHora.Text = "HH:MM:SS";
this.lblDataHora.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
this.lblClienteEData.BackColor = System.Drawing.Color.White;
this.lblClienteEData.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblClienteEData.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(110)))), ((int)(((byte)(110)))), ((int)(((byte)(110)))));
this.lblClienteEData.Location = new System.Drawing.Point(376, 14);
this.lblClienteEData.Name = "lblClienteEData";
this.lblClienteEData.Size = new System.Drawing.Size(524, 28);
this.lblClienteEData.TabIndex = 85;
this.lblClienteEData.Text = "Nome do Cliente, Dia da semana, dia do mês ano.";
this.lblClienteEData.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblAtmVersion.BackColor = System.Drawing.Color.Transparent;
this.lblAtmVersion.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblAtmVersion.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(110)))), ((int)(((byte)(110)))), ((int)(((byte)(110)))));
this.lblAtmVersion.Location = new System.Drawing.Point(376, 48);
this.lblAtmVersion.Name = "lblAtmVersion";
this.lblAtmVersion.Size = new System.Drawing.Size(524, 23);
this.lblAtmVersion.TabIndex = 86;
this.lblAtmVersion.Text = "Equipamento XXXX VERSÃO x.x.x.x.xx";
this.lblAtmVersion.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.picBarrinha.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(95)))), ((int)(((byte)(179)))));
this.picBarrinha.Location = new System.Drawing.Point(908, 21);
this.picBarrinha.Name = "picBarrinha";
this.picBarrinha.Size = new System.Drawing.Size(2, 50);
this.picBarrinha.TabIndex = 88;
this.picBarrinha.TabStop = false;
this.lblInstrucao.AutoSize = true;
this.lblInstrucao.Location = new System.Drawing.Point(374, 115);
this.lblInstrucao.Name = "lblInstrucao";
this.lblInstrucao.Size = new System.Drawing.Size(177, 13);
this.lblInstrucao.TabIndex = 89;
this.lblInstrucao.Text = "label que vai substituir o lblInstrucao";
this.lblInstrucao.Visible = false;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.BackgroundImage = global::_TESOUREIROAPP.Properties.Resources.Perto_Cash_21;
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.ClientSize = new System.Drawing.Size(1024, 768);
this.Controls.Add(this.lblInstrucao);
this.Controls.Add(this.lblClienteEData);
this.Controls.Add(this.picBarrinha);
this.Controls.Add(this.lblAtmVersion);
this.Controls.Add(this.lblDataHora);
this.Controls.Add(this.picGear);
this.Controls.Add(this.lblUsuario);
this.DoubleBuffered = true;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "FrmBaseAPP";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "frmBaseOp";
this.TopMost = true;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmBaseOp_FormClosing);
this.Load += new System.EventHandler(this.FrmBaseAPP_Load);
this.Shown += new System.EventHandler(this.frmBaseOp_Shown);
this.Click += new System.EventHandler(this.FrmBaseAPP_Click);
((System.ComponentModel.ISupportInitialize)(this.picGear)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picBarrinha)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
private System.Windows.Forms.Timer timerHorario;
private System.Windows.Forms.Label lblUsuario;
public System.Windows.Forms.PictureBox picGear;
private System.Windows.Forms.Label lblDataHora;
private System.Windows.Forms.Label lblClienteEData;
private System.Windows.Forms.Label lblAtmVersion;
private System.Windows.Forms.PictureBox picBarrinha;
protected System.Windows.Forms.Label lblInstrucao;
}
}