c#断点击中调试器
本文关键字:调试器 断点 | 更新日期: 2023-09-27 18:07:33
我刚刚用c#完成了我的第一个项目之一,但随后我运行了这个:
Live Event: Breakpoint Hit: Timer1_tick, form调试器碰到一个断点或跟踪点
我真的找不到我的代码有什么问题,所以我真的不知道如何解决这个问题。以下是我一直在尝试的代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
webBrowser1.Navigate("mywebsite.com");
webBrowser1.ScriptErrorsSuppressed = true;
}
private int failed = 0;
string startbet = "250";
string bet2 = "150000";
string bet3 = "300000";
string bet4 = "600000";
string bet5 = "1200000";
string bet6 = "2400000";
string bet7 = "4800000";
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("brukernavn")[0].SetAttribute("value", textBox1.Text);
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("passord")[0].SetAttribute("value", textBox2.Text);
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("login_buton")[0].InvokeMember("click");
timer1.Enabled = true;
}
private void timer1_Tick(object sender, EventArgs e)
{
webBrowser1.Navigate("mywebsite.com/gamblingsite.php");
webBrowser1.DocumentCompleted += Krigside;
timer1.Enabled = false;
}
private void Krigside(object sender, WebBrowserDocumentCompletedEventArgs e)
{
webBrowser1.DocumentCompleted -= Krigside;
timer2.Enabled = true;
timer2.Interval = 1000;
}
private void timer2_Tick(object sender, EventArgs e)
{
if (webBrowser1.DocumentText.Contains("bokstavene"))
{
MessageBox.Show("Anti-bot! du har 60 sekunder på og fullføre!");
timer2.Enabled = true;
timer2.Interval = 60000; //60 sekunder før den sjekker anti-bot igjen.
}
else
{
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("bet")[0].SetAttribute("value", startbet);
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("start")[0].InvokeMember("click");
timer2.Enabled = false;
webBrowser1.DocumentCompleted += SjekkVinnFeil;
}
}
private void SjekkVinnFeil(object sender, WebBrowserDocumentCompletedEventArgs e)
{
MessageBox.Show("KRIG SIDEN ER KLAR!");
webBrowser1.DocumentCompleted -= SjekkVinnFeil;
if (webBrowser1.DocumentText.Contains("taper"))
{
failed += 1;
}
else
{
failed = 0;
}
timer3.Enabled = true;
}
private void timer3_Tick(object sender, EventArgs e)
{
if (webBrowser1.DocumentText.Contains("bokstavene"))
{
MessageBox.Show("Anti-bot! du har 60 sekunder på og fullføre!");
timer3.Enabled = true;
timer3.Interval = 60000; //60 sekunder før den sjekker anti-bot igjen.
}
else if (failed == 3)
{
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("bet")[0].SetAttribute("value", bet2);
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("start")[0].InvokeMember("click");
timer3.Enabled = false;
webBrowser1.DocumentCompleted += SjekkVinnFeil;
}
else if (failed == 4)
{
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("bet")[0].SetAttribute("value", bet3);
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("start")[0].InvokeMember("click");
timer3.Enabled = false;
webBrowser1.DocumentCompleted += SjekkVinnFeil;
}
else if (failed == 5)
{
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("bet")[0].SetAttribute("value", bet4);
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("start")[0].InvokeMember("click");
timer3.Enabled = false;
webBrowser1.DocumentCompleted += SjekkVinnFeil;
}
else if (failed == 6)
{
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("bet")[0].SetAttribute("value", bet5);
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("start")[0].InvokeMember("click");
timer3.Enabled = false;
webBrowser1.DocumentCompleted += SjekkVinnFeil;
}
else if (failed == 7)
{
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("bet")[0].SetAttribute("value", bet6);
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("start")[0].InvokeMember("click");
timer3.Enabled = false;
webBrowser1.DocumentCompleted += SjekkVinnFeil;
}
else if (failed == 8)
{
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("bet")[0].SetAttribute("value", bet7);
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("start")[0].InvokeMember("click");
timer3.Enabled = false;
webBrowser1.DocumentCompleted += SjekkVinnFeil;
}
else
{
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("bet")[0].SetAttribute("value", startbet);
webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("start")[0].InvokeMember("click");
timer3.Enabled = false;
webBrowser1.DocumentCompleted += SjekkVinnFeil;
}
}
private void button2_Click(object sender, EventArgs e)
{
timer1.Enabled = false;
timer2.Enabled = false;
timer3.Enabled = false;
MessageBox.Show("Stoppet!");
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
}
}
}
和我已经看了我的代码几次了,现在不知道是什么错了。我是c#新手。接下来我可以尝试什么?
所以你唯一的问题是为什么断点击中?如果是,那么这是因为您在某个时候为调试目的设置了断点。如果您不再需要它们,那么您可以考虑通过选择debug
菜单选项并选择delete all breakpoint
或disable all breakpoint
来删除断点。
您不妨考虑使用start without dedbugging
选项在Release
模式下运行应用程序。(OR)在web.config
/app.config
中设置以下行
<Compilation debug="false" />