PrepAway - Latest Free Exam Questions & Answers

Which code should you insert at line 28?

You have the following code (line numbers are included for reference only):

You need to ensure that if an exception occurs, the exception will be logged.
Which code should you insert at line 28?

PrepAway - Latest Free Exam Questions & Answers

A.
Option A

B.
Option B

C.
Option C

D.
Option D

Explanation:
* XmlWriterTraceListener
Directs tracing or debugging output as XML-encoded data to a TextWriter or to a Stream,
such as a FileStream.
* TraceListener.TraceEvent Method (TraceEventCache, String, TraceEventType, Int32)
Writes trace and event information to the listener specific output.
Syntax:

[ComVisibleAttribute(false)]
public virtual void TraceEvent(
TraceEventCache eventCache,
string source,
TraceEventType eventType,
int id
)

11 Comments on “Which code should you insert at line 28?

  1. Marina says:

    OMG, sorry for the previous, parser killed my xml.
    C writes:
    SubType Name=”Error”
    Source Name=”Execution is too long > Delay(10) > 12982.3068″
    B writes:
    SubType Name=”Information”
    Source Name=”Trace”




    1



    0
  2. ivannathan says:

    Though code from B and C works, i think C is wrong, because
    there is warning for TraceEvent in documentation:

    “This method is not intended to be called directly by application code but by members of the Debug, Trace, and TraceSource classes to write trace data to …”

    https://docs.microsoft.com/ru-ru/dotnet/api/system.diagnostics.tracelistener.traceevent?view=netframework-4.8#System_Diagnostics_TraceListener_TraceEvent_System_Diagnostics_TraceEventCache_System_String_System_Diagnostics_TraceEventType_System_Int32_

    So< the correct answer for me is B only.




    0



    0

Leave a Reply