I get this error: Use of the local variable not assigned enumerator
Code that gives error:
private void offertoro_Load(object sender, EventArgs e)
{
List<JToken> list = JObject.Parse(System.IO.File.ReadAllText("offerids_offertoro.json")).Children().ToList<JToken>();
List<JToken>.Enumerator enumerator1;
try
{
enumerator1 = list.GetEnumerator();
while (enumerator1.MoveNext())
{
JProperty source = (JProperty) enumerator1.Current;
source.CreateReader();
IEnumerator<JToken> enumerator2;
if (Operators.CompareString(source.Name, "offers", false) == 0)
{
try
{
enumerator2 = source.Values().GetEnumerator();
while (enumerator2.MoveNext())
this.TextBox1.Text = this.TextBox1.Text + ((JObject) enumerator2.Current)["oid"].ToString() + "\r\n";
}
finally
{
// EL ENUMERATOR 2 TAMBIEN ME DA ERROR
if (enumerator2 != null)
enumerator2.Dispose();
}
}
}
}
finally
{
// me da error AQUI <------------------------
enumerator1.Dispose();
}
this.WebBrowser2.Document.Cookie = "1";
this.c_url = "1";
this.finallink = "1";
this.LabelProces.Text = this.LabelProces_OpeningOT;
this.LabelCompleted.Text = this.LabelCompletedd;
if (MyProject.Forms.Form4.GroupBoxSpeedAverage.Checked)
this.CompleteOffer.Interval = 7000;
else if (MyProject.Forms.Form4.GroupBoxSpeedSlow.Checked)
this.CompleteOffer.Interval = 9000;
else if (MyProject.Forms.Form4.GroupBoxSpeedFast.Checked)
this.CompleteOffer.Interval = 5000;
this.GetAvailableOffers.Start();
}
Another mistake very often, is a new virtual member in a sealed class
Código:
internal virtual Label LabelCompanyName
{
[DebuggerNonUserCode] get
{
return this._LabelCompanyName;
}
[DebuggerNonUserCode, MethodImpl(MethodImplOptions.Synchronized)] set
{
this._LabelCompanyName = value;
}
}
It's the get mainly.
One last mistake I get is this: The name of type 'RemoveNamespaceAttributesClosure' does not exist in the type 'InternalXmlHelper'
Code:
return (IEnumerable) obj.Cast<object>().Select<object, object>(new Func<object, object>(new InternalXmlHelper.RemoveNamespaceAttributesClosure(inScopePrefixes, inScopeNs, attributes).ProcessObject));
The List<token>
can not be null, how do I solve it?