Question

I have this simple code :

 void Application_BeginRequest(object sender, EventArgs e) 
    {
        Trace.Write("Exception Handling", "......");
    }

However re-sharper scream (no-error only suggest) about :

enter image description here

Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is a partial method without implementation

I'm not able to see this line in the Trace output.

however - other traces - I do see.

Why is that ?

(p.s. The page (which is under web Site project) has trace="true").

Was it helpful?

Solution

Be sure that the TRACE constant is defined in your project settings for your current build configuration.

enter image description here

UPDATE

Since it's a website project, you could put

#define TRACE

at the top of Global.asax.cs so that the trace symbol is defined.

OTHER TIPS

To quote the JetBrains wiki (which may* be linked to from the ReSharper menu under 'Why is ReSharper suggesting this'):

While coding, you may encounter warnings regarding methods whose invocations will not be generated by the compiler. Why would that be? Typical cases are conditional methods that will not be compiled (e.g., it’s marked with [ReSharperInt:Conditional("DEBUG")] and you’re in RELEASE mode). Another reason why a method may be skipped is that, at some point, its body has been declared as partial and the implementation wasn’t provided.

Given that this is on a method of Trace, I'd suggest the first of these typical cases is the one that applies.

* I haven't got v7 yet

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top