I've a web method that has been called up using page methods. Assert function is not working in it although condition fails.

I want to test at what condition my code fails and debug it as in Assert menthod.

How should i debug that web menthod. Please suggest.

JavaScript Code

function sendingRqstForDealerCard(Argument) {

PageMethods.DealerTurn(OnSuccess);
function OnSuccess(response) {

    Sys.Debug.assert(response!="", "respone is blanck in DealerTurn Function");
}

javascript assert is working but i have to check code in code behind.

Code Behind

 [WebMethod]
 public static string DealerTurn()
 {    
 string previousRowHandTotal = BLHand.GetHandTotalField(hand, Convert.ToUInt16(dealerSpotID));

   System.Diagnostics.Debug.Assert(previousRowHandTotal != string.Empty,"previousRowHandTotal is empty in dealerTurn function."); 
}    

Is there other way to debug WebMethod?

有帮助吗?

解决方案

You will need to provide the code for a fuller answer, however keep in mind that if you are using Debug.Assert and not running in Debug mode, then the Assert is not even compiled into the code. That could be the reason your assert is not triggering.

Here is a MSDN article on how to run in debug mode. Typically, if you are running from visual studio, then this should prompt you to change the settings, though

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top