This is huge code part to answer at once.Enclose OnClick implementation in try catch.But there are some lines you should comment or change.
public override void OnClick()
{
// i will reuse cursor false-> true
IFeatureCursor feature1Cursor = pflayer1.FeatureClass.GetFeatures(idList, true);
while (featureA != null)
{
// queryin again with same params makes forever loop
// using only first feature from an array
feature1Cursor = pflayer1.FeatureClass.GetFeatures(idList, true);
featureA = feature1Cursor.NextFeature();
}
//At this point it stops and leaves
// because your code is not in try catch block and exception occured
string elenco = String.Empty;
public string FeaturesEqual(IFeature pFeatureA, IFeature pFeatureB)
{
// if value is null you have exception use Convert.ToSring(pFeatureA.get_Value(i));
string valore1 = pFeatureA.get_Value(i).ToString();
// I intend to use System.Object.Equals didn't use ESRI's object before
bool equal = ESRI.ArcGIS.Geodatabase.Object.Equals(pFeatureA.get_Value(i), pFeatureB.get_Value(i));
}
For now I don't have idea what else is wrong