C# 如何调试无止境运行的变量?

C# 如何调试无止境运行的变量?,c#,C#,我试图为我的程序编写一个自动更新程序。 我已经摆脱了stackOverflow之类的程序,但是现在我的程序在遇到一个变量时似乎运行无止境。什么也不做 我试图用cw获取信息,并检查它挂在哪里,但我什么也没得到,也找不到它 我的主播 { 更新程序=新更新程序(此); updater.DoUpdate(); } 公共字符串应用程序名{ 获取{返回“MyProgram”;} } 公共字符串应用程序ID{ 获取{返回“MyProgramID”;} } 公共程序集应用程序程序程序集{ get{return

我试图为我的程序编写一个自动更新程序。 我已经摆脱了stackOverflow之类的程序,但是现在我的程序在遇到一个变量时似乎运行无止境。什么也不做

我试图用cw获取信息,并检查它挂在哪里,但我什么也没得到,也找不到它

我的主播

{
更新程序=新更新程序(此);
updater.DoUpdate();
}
公共字符串应用程序名{
获取{返回“MyProgram”;}
}
公共字符串应用程序ID{
获取{返回“MyProgramID”;}
}
公共程序集应用程序程序程序集{
get{return System.Reflection.Assembly.GetExecutionGassembly();}
}
公共图标应用{
获取{返回此.Icon;}
}
公共Uri UpdateXmlLocation{
获取{返回新Uri(“UrlToXml”);}
}
公共形式语境{
获取{返回此;}
}
在我的XML类中

public类UpdateXml
{
私人版本;
公共Uri;
私有字符串文件名;
私有字符串md5;
私有字符串描述;
私有字符串启动参数;
内部版本{
获取{返回此.Version;}
}
内部Uri{
获取{返回this.Uri;}
}
内部字符串文件名{
获取{返回this.fileName;}
}
内部字符串MD5{
获取{返回this.md5;}
}
内部字符串描述{
获取{返回this.description;}
}
内部字符串启动参数{
获取{返回this.launchArgs;}
}
过了一段时间(代码运行正常,然后出现崩溃部分)

private void DwnloadUpdate(UpdateXml更新)
{            
updateDownloadForm=新的updateDownloadForm(update.Uri,this.applicationInfo.applicationion);
在这段代码之后,我希望我的dl窗口打开,dl启动,程序得到更新

我的更新程序类

使用系统;
使用系统组件模型;
使用系统诊断;
使用System.IO;
使用System.Windows.Forms;
名称空间更新程序
{
公共类更新程序
{
私人Iupdater应用程序信息;
私人背景工作者;
公共更新程序(Iupdater应用程序信息)
{
this.applicationInfo=applicationInfo;
this.bgWorker=新的BackgroundWorker();
this.bgWorker.DoWork+=新的DoWorkEventHandler(bgWorker\u DoWork);
this.bgWorker.RunWorkerCompleted+=新的RunWorkerCompletedEventHandler(bgWorker\u RunWorkerCompleted);
}
公共无效数据更新()
{
如果(!this.bgWorker.IsBusy)
this.bgWorker.RunWorkerAsync(this.applicationInfo);
}
私有void bgWorker\u DoWork(对象发送方,DoWorkEventArgs e)
{
Iupdater application=(Iupdater)e.参数;
如果(!UpdateXml.ExistOnServer(application.UpdateXmlLocation))
{
e、 取消=真;
}
其他的
{
UpdateXml ux=UpdateXml.Parse(application.UpdateXml位置,application.ApplicationID);
if(ux==null)
{
e、 取消=真;
}
其他的
{
e、 结果=ux;
}
}
}
void bgWorker\u RunWorkerCompleted(对象发送方,RunWorkerCompletedEventArgs e)
{
如果(!e.取消)
{
UpdateXml update=(UpdateXml)e.Result;
如果(更新==null)
{
Console.WriteLine(“更新空”);
}
Console.WriteLine(“test3.1”);
Console.WriteLine(此.applicationInfo.ApplicationAssembly.GetName().Version);
if(this.applicationInfo.ApplicationAssembly.GetName().Version!=null)
{
控制台。WriteLine(“是的!”);
}否则
{
控制台。WriteLine(“不!”);
}
Console.WriteLine(“test3.2”);
if(update!=null&&update.IsNewerThan(this.applicationInfo.ApplicationAssembly.GetName().Version))
{
控制台写入线(“test4”);
if(新建更新信息(applicationInfo,update).ShowDialog(this.applicationInfo.Context)==DialogResult.Yes)
此.DwnloadUpdate(更新);
}                
}
}
私有void DwnloadUpdate(UpdateXml更新)
{
Console.WriteLine(update.Uri);
如果(update.Uri==null)
控制台。写入线(“空”);
updateDownloadForm=新的updateDownloadForm(update.Uri,this.applicationInfo.applicationion);
主控台。书面语(“我不知道该怎么写”);
DialogResult=form.ShowDialog(this.applicationInfo.Context);
if(result==DialogResult.OK)
{
字符串currentPath=this.applicationInfo.ApplicationAssembly.Location;
字符串newPath=Path.GetDirectoryName(currentPath)+“\\”+update.FileName;
UpdateApplication(form.TempFilePath、currentPath、newPath、update.LaunchArgs);
Application.Exit();
}
else if(result==DialogResult.Abort)
{
MessageBox.Show(“更新下载已取消。\n此程序尚未修改。”,“更新下载已取消”,MessageBoxButtons.OK,MessageBoxIcon.Information);
}
其他的
{
MessageBox.Show(“下载更新时出现问题。\n
/// THIS PROPERTY TRIES TO RETURN ITSELF!!
internal Version Version {
  get {
    return this.Version; // you wanted to return 'this.version'
  }
}
// No more private fields
public class UpdateXml
{
  public Version Version { get; set; }
  public string FileName { get; } // Only expose a getter, can be set in the ctor
  public Uri Uri { get; set; }

  // add more properties here...

  public UpdateXml(string filename)
  {
    FileName = filename;
  }
}
public class UpdateXml
{
  private Version _version;
  private string _fileName;
  private Uri _uri;

  public Version Version => _version;
  public string FileName => _filename;
  public Uri Uri {
    get => _uri;
    set => _uri = value;
  }

  // add more properties here...

  // use the ctor to set some field values
  public UpdateXml(string filename)
  {
    _filename = filename;
  }

  // fields allow setting values later on
  public void SetLatestVersion(Version v)
  {
    if (_version == null || v > _version)
      _version = v;
  }
}