ILSpy icon indicating copy to clipboard operation
ILSpy copied to clipboard

cannot declare this variable " sender" in this scope

Open zgfflc opened this issue 3 years ago • 9 comments

public virtual void popupMenu_MenuItemClick(object sender, PopupMenu.MenuItemClickEventArgs e) { user_Dialog.SetListView_CheckBox(array2, delegate(object sender, AdapterView.ItemClickEventArgs e) { if (selectOrderByDBName[e.Position] != "") { value = selectOrderByDBName[e.Position]; } } }

The above code cannot declare this variable " sender" in this scope

I want to decompile that way public virtual void popupMenu_MenuItemClick(object sender, PopupMenu.MenuItemClickEventArgs e) { user_Dialog.SetListView_CheckBox(array2, delegate(object sender1, AdapterView.ItemClickEventArgs e1) { if (selectOrderByDBName[e1.Position] != "") { value = selectOrderByDBName[e1.Position]; } } }

zgfflc avatar Jun 23 '21 05:06 zgfflc

check.zip

zgfflc avatar Jun 23 '21 05:06 zgfflc

Duplicate of #1572

siegfriedpammer avatar Jun 23 '21 17:06 siegfriedpammer

I cannot reproduce the problem you are describing. The lambda in Select_Activity_Other.popupMenu_MenuItemClick uses sss as name for the first parameter. Can you tell me the metadata token of the method you are trying to decompile. Thanks!

siegfriedpammer avatar Jun 23 '21 17:06 siegfriedpammer

	public void ComBox_OnClick(object sender, EventArgs e)
	{
		try
		{
			EditText Combox_EditText = (EditText)sender;
			InputMethodManager obj = (InputMethodManager)context_0.GetSystemService("input_method");
			obj.HideSoftInputFromWindow(Combox_EditText.WindowToken, HideSoftInputFlags.None);
			obj.Dispose();
			if (Global_Variables.CommonVariable.System_IsDialogState)
			{
				Global_Variables.CommonVariable.System_IsDialogState = false;
				return;
			}
			Global_Variables.CommonVariable.System_IsDialogState = true;
			string[] Strs = new string[3] { "中", "左", "右" };
			User_Dialog user_Dialog = new User_Dialog(context_0, Resource.Style.MyDialog);
			user_Dialog.SetTitle("请选择<对齐方式>");
			user_Dialog.SetTitleSize(25);

//The following line of code will indicate an error cannot declare this variable " sender" in this scope user_Dialog.SetListView_CheckBox(Strs, delegate(object sender, AdapterView.ItemClickEventArgs e) { try { Combox_EditText.Text = Strs[e.Position].ToString(); } catch { } }); user_Dialog.Show(); } catch { } }

zgfflc avatar Jun 26 '21 06:06 zgfflc

I still cannot reproduce this. Please, if you give an example, please post the full name (i.e., the name of the method and containing type and containing namespace + assembly) of the method or the metadata token number. It is impossible for me to find the code you posted above in the assembly you posted. Also it seems there a lot of references missing. Would it be possible for you to send all the referenced assemblies you have? Thanks!

siegfriedpammer avatar Jun 26 '21 19:06 siegfriedpammer

namespace XH_Android-> public class DataGridView_MultiLine : HorizontalScrollView->public void ComBox_OnClick(object sender, EventArgs e)

zgfflc avatar Jun 27 '21 07:06 zgfflc

You did not send that assembly. There is no namespace XH_Android

image

siegfriedpammer avatar Jun 27 '21 09:06 siegfriedpammer

XH_Android.zip

zgfflc avatar Jun 27 '21 09:06 zgfflc

Thank you! Will take a look soon.

siegfriedpammer avatar Jun 27 '21 09:06 siegfriedpammer