0

How can i find out the reason why a BuiltIn function in c# is returning false.

For example.

I have implemented Execute method in Microsoft.Build.Framework.ITask in one of my child class.This Execute function will return "True" if task i gave to execute success otherwise it returns False.My question is if it returns false how can i find out the reason behind the failure.

mystack
  • 4,910
  • 10
  • 44
  • 75

1 Answers1

1

Follow the example given in this example from MSDN, where you collect a Log of messages that you can later request and analyze to determine what happened.

When the return value is false, you retrieve the Log, and examine it for failure conditions. This could be a class constructed any way you like.

DonBoitnott
  • 10,787
  • 6
  • 49
  • 68
  • Sorry Don if iam asking is wrong,Iam new to c# My need is to find out the exact reason why the Task is failing.When i tried to debug it only returns false with out showing the details.How can i ask the compiler to show the details. – mystack Feb 12 '14 at 13:16
  • The `Execute` method is yours, right? Why can't you know? Keep a log as the example shows, and then ask the log. There is no way to extract more information from `false`...you have to do it yourself. – DonBoitnott Feb 12 '14 at 13:19