0

I have created some web api for some response specific. Compiled fine and run on visual studio localhost. how ever I just publish it then it's give me error like :

 Warning    15  This label has not been referenced  C:\MSSMS.infisms.co.in\MSSMS.infisms.co.in\App_Code\BulkSMS.cs  578 5   C:\MSSMS.infisms.co.in\MSSMS.infisms.co.in\

and this is my service code :

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
[System.Web.Script.Services.ScriptService]
public class BulkSMS : System.Web.Services.WebService
{
    public BulkSMS()
    {
        //Uncomment the following line if using designed components 
        //InitializeComponent();         
    }

    #region Sendmessage

    public string SendQuickMessage(string C_Name, string MobileNo, string Message, int AccountType, int Sender, int MessageType)
    {
        string Response = " ";// string.Empty;
        try
        {
            int CharCount = CharMsgCount(Message, MessageType);
            string[] Mobilenos = MobileNo.Split(',');

            foreach (string Mobile in Mobilenos)
            {
                AppGlobal.Message message = new AppGlobal.Message();
                message.intUserID = SiteUser.Current().UserID;
                message.strC_Name = C_Name;
                message.strMobileNo = Mobile;
                message.strMessageText = Message;
                message.intAccounttype = AccountType;
                message.intSenderID = Sender;
                message.intMessagetype = MessageType;
                message.dtReceiveTime = DateTime.Now;
                message.intCharCount = CharCount;

                AppGlobal.Messagequeuq.Enqueue(message);

                //Mysql.ExecuteNonQuery("BulkSMS_SendQuickMessage", SiteUser.Current().UserID, C_Name, Mobile, Message, AccountType, Sender, MessageType);
            }
            //Mysql.ExecuteNonQuery("BulkSMS_AddArchiveMessgae", SiteUser.Current().UserID, Message);

            Response = "Success";
        }
        catch (Exception ex)
        {
            Response = "Error in BulkSMS_SendQuickMessage : " + MobileNo + "  " + CommonMethods.GetErrorMessage(ex, "BulkSMS_AddArchiveMessgae");
        }
    **RESPONSE:// this line gives warning message not referenced label**
        if (!string.IsNullOrWhiteSpace(Response))
            AppGlobal.Logger.WriteToErrorLogFile(Response);
        return Response;
    }

please help me out of this guys...

shalin gajjar
  • 646
  • 4
  • 15
  • 44
  • Related post - [Url in code not breaking build](https://stackoverflow.com/q/37202469/465053) – RBT May 11 '21 at 03:56

1 Answers1

2

The reason indicates that "The label has not been referenced". You'll have to use the created label in goto statement as follows

Response: // you have created a label with name "Response".
{
   //your for loop is executed inside your label block.
}
goto Response;

Adding goto Response statement will disable that warning.

ashveli
  • 248
  • 6
  • 28