在我的Unity项目中,我扩展了System.Net.WebClient类,以便从this question添加超时属性。
class WebDownload : WebClient
{
public int Timeout { get; set; }
public WebDownload() : this(60000) { }
public WebDownload(int timeout)
{
this.Timeout = timeout;
}
protected override WebRequest GetWebRequest(Uri address)
{
var request = base.GetWebRequest(address);
if (request != null)
{
request.Timeout = this.Timeout;
}
return request;
}
}
保存文件后,Visual Studio 2013会出现此错误:
即使Visual Studio提供了该错误,程序编译时也没有错误,我可以毫无问题地使用我的WebDownload
对象。我试图为一个空项目做同样的事情,这次它没有给出错误。
这是Visual Studio 2013 Unity Tool中的错误吗?
这是错误堆栈(如果图像不可读):
在System.ComponentModel.TypeDescriptor.AddAttributes(对象实例, 属性[]属性)在 Microsoft.VisualStudio.Design.VSDesignSurface.CreateDesigner(IComponent的 component,Boolean rootDesigner)at System.ComponentModel.Design.DesignerHost.AddToContainerPostProcess(IComponent的 component,String name,IContainer containerToAddTo)at System.ComponentModel.Design.DesignerHost.PerformAdd(IComponent的 组件,字符串名称)at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent(类型 componentType,String name)at System.ComponentModel.Design.Serialization.DesignerSerializationManager.CreateInstance(类型 type,ICollection arguments,String name,Boolean addToContainer)at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.CreateInstance(类型 type,ICollection arguments,String name,Boolean addToContainer)at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager 经理,CodeTypeDeclaration declaration) System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager 经理) Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost 主机)