Using directives in Generic handlers erroneously marked as "safe to remove"

Consider the following extremely simple generic handler:

<%@ WebHandler Language="C#" Class="HelloWorld" %>

using System;
using System.Web;

public class HelloWorld : IHttpHandler {
    
    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "text/plain";
        context.Response.Write("Hello World");
    }

    public bool IsReusable {
        get {
            return true;
        }
    }

}

Resharper 5 will mark the "using System" and "using System.Web" directives as not needed and safe to remove.

Of course, needless to say, if you remove these directives, the handler won't work.

0

Please sign in to leave a comment.