Method call skipped in C #?

I have this simple code:

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

However, a repeated sharp cry (without errors indicates only) about:

enter image description here

Method call skipped. The compiler will not generate a method call because the method is conditional, or it is a partial method without implementation

I can not see this line on the output of Trace.

however - other traces - I see.

Why is this?

(p. p. The page (which is in the website project) has trace="true" ).

+6
source share
2 answers

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

enter image description here

UPDATE

Since this is a website project, you can put

 #define TRACE 

at the top of Global.asax.cs to define a trace symbol.

+18
source

To quote the version of the JetBrains wiki (which may * be related to the ReSharper menu in the section β€œWhy ReSharper offers this”):

When coding, you may encounter warnings regarding methods; the compiler does not generate calls. Why is this so? Typical cases are conditional methods that will not be compiled (for example, it is marked [ReSharperInt:Conditional("DEBUG")] and youre in RELEASE ). Another reason a method might be skipped is because at some point, its body was declared partial and no implementation was provided.

Given that this is the Trace method, I would suggest that the first of these typical cases is the one that applies.

* I do not have v7 yet

+2
source

All Articles