1

In my unity project, I extended System.Net.WebClient class to add timeout property from 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;
    }
}

After I save my file, Visual Studio 2013 gives this error :

Error Image

Even if Visual studio gives that error, program compiled without error and I can use my WebDownload object without problem. I tried to do same thing for an empty project and this time it did not give that error.

Is this a bug in Visual Studio 2013 Unity Tool?

Here is the error stack (in case image is not readable) :

at System.ComponentModel.TypeDescriptor.AddAttributes(Object instance, Attribute[] attributes) at 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 component, String name) at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent(Type componentType, String name) at System.ComponentModel.Design.Serialization.DesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer) at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer) at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration) at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager) at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager) at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host)

Community
  • 1
  • 1
Berke Cagkan Toptas
  • 1,034
  • 3
  • 21
  • 31
  • Nothing say that it's a problem with Unity Tool. Based on what we can see on your screenshot, it seems that your "Downloader.cs" file is considered as a generated Windows Form (or something similar). What is inside ? – ReMinoer May 11 '15 at 16:21
  • @ReMinoer Inside "Downloader.cs" there is only the code I posted in the question. As soon as I copy paste it, the icon of the file is changing from the editor(As I showed with red box in the image). If I delete 'WebClient' extension from the Class definition, it turns into normal. – Berke Cagkan Toptas May 11 '15 at 17:00
  • Look in your project file if you have something like that : ` Form `. If yes, consider to edit it this way : `` – ReMinoer May 11 '15 at 17:40

0 Answers0