PC Review


Reply
Thread Tools Rate Thread

[BUG]VS.NET 2003/C# locks up and locks up windows shell when entering breakpoint

 
 
Frans Bouma
Guest
Posts: n/a
 
      10th Jul 2003
Hello,

It seems VS.NET 2003 locks up itself and the complete shell (mouse locks
also) when entering a breakpoint in a special situation.

Below is the code to reproduce this behavior. It contains a line where you
have to set a breakpoint (the first line in the validation event handler).
Compile and run in the debugger in vs.net using F5. When you hit 'enter'
in the textbox, the debugger should break in the validator routine where
you placed your breakpoint. However, it will lock up the shell: mouse will
not move, nothing will work. Your machine is not crashed, telnet to it and
kill the process started by the debugger or use another remote process
killer to kill the process.

This code is a proof of concept. In my actual code I use a similar
approach with the Enter key so a user can hit enter to move to the next
form field, which should then trigger the validation routine. This works
correctly, however in the debugger it locks up vs.net and the shell.

When you remove the code in the keydown routine, the debugger will break
in the validation routine. Also, when you run the code normally,
everything works fine, so it is not the code that is wrong, vs.net somehow
locks up (and the shell).

I use Windows XP pro sp1, VS.NET 2003 entr. arch.

Please fix.

FB

//---------code-------------------
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace VSNetHang
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button1;
private System.ComponentModel.Container components = null;

public Form1()
{
InitializeComponent();
}


#region Windows Form Designer generated code
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point
(114, 36);
this.textBox1.Name = "textBox1";
this.textBox1.TabIndex = 0;
this.textBox1.Text = "";
this.textBox1.KeyDown += new
System.Windows.Forms.KeyEventHandler(this.textBox1_KeyDown);
this.textBox1.Validating += new
System.ComponentModel.CancelEventHandler(this.textBox1_Validating);
//
// button1
//
this.button1.Location = new System.Drawing.Point(180,
117);
this.button1.Name = "button1";
this.button1.TabIndex = 1;
this.button1.Text = "button1";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5,
13);
this.ClientSize = new System.Drawing.Size(358, 254);
this.Controls.Add(this.button1);
this.Controls.Add(this.textBox1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}

private void textBox1_Validating(object sender,
System.ComponentModel.CancelEventArgs e)
{
// place breakpoint on line below this one
if(textBox1.Text.Length<=0)
{
e.Cancel=true;
throw new Exception("Empty!");
}
else
{
e.Cancel=false;
}
}

private void textBox1_KeyDown(object sender,
System.Windows.Forms.KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
SendKeys.Send("{TAB}");
}
}
}
}
//-----end of code--------

--
Solutions Design : http://www.sd.nl
My open source .NET Software : http://www.sd.nl/software
My .NET Blog : http://weblogs.asp.net/FBouma
-------------------------------------------------------------------------
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Locks Cylinders Deadbolt Schlage, Medeco Mul-T-Locks, Baldwin Locks,Kwikset Locks, Mortise Locks, Dexter Locks lifeine Microsoft C# .NET 0 13th Oct 2009 06:46 PM
Re: Vista Locks While Entering Password Jon Windows Vista General Discussion 0 23rd Aug 2009 02:51 PM
after entering control panel it locks up Aexen Windows XP Performance 3 9th Jun 2004 06:44 PM
DOS shell - locks cursor robin Windows XP Performance 0 26th Nov 2003 03:24 PM
IE Locks when entering URL. Doug Windows XP Internet Explorer 0 11th Nov 2003 04:15 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:20 AM.