Error 2 Internal Compiler Error (0xc0000005 at address 609D0140): likely culprit is 'EMITIL'.
-
An internal error has occurred in the compiler. To work around this problem, try simplifying or changing the program near the locations listed below. Locations at the top of the list are closer to the point at which the internal error occurred. Errors such as this can be reported to Microsoft by using the /errorreport option. NewLimit.Web.DSIS.Data The following code causes this error. Note that in my opinion this code has no errors at all. I'll prove that by also giving the adjusted code that does compile:
if(!l_odtnProductsProductDiscountComponents.TryGetValue(p_intProductID, out l_ocltProductProductDiscountComponents))
lock(l_odtnProductsProductDiscountComponents)
if(!l_odtnProductsProductDiscountComponents.TryGetValue(p_intProductID, out l_ocltProductProductDiscountComponents))
{
l_ocltProductProductDiscountComponents = new Collection<ProductDiscountComponent>();
foreach(ProductDiscountComponent l_oProductDiscountComponent in this)
if(l_oProductDiscountComponent.PriceListID == p_intPriceListID)
if(l_oProductDiscountComponent.ProductID == p_intProductID)
l_ocltProductProductDiscountComponents.Add(l_oProductDiscountComponent);
l_odtnProductsProductDiscountComponents.Add(p_intProductID, l_ocltProductProductDiscountComponents);
}And here the code that does compile:
if(!l_odtnProductsProductDiscountComponents.TryGetValue(p_intProductID, out l_ocltProductProductDiscountComponents))
{ //here is the difference!
lock(l_odtnProductsProductDiscountComponents)
if(!l_odtnProductsProductDiscountComponents.TryGetValue(p_intProductID, out l_ocltProductProductDiscountComponents))
{
l_ocltProductProductDiscountComponents = new Collection<ProductDiscountComponent>();
foreach(ProductDiscountComponent l_oProductDiscountComponent in this)
if(l_oProductDiscountComponent.PriceListID == p_intPriceListID)
if(l_oProductDiscountComponent.ProductID == p_intProductID)
l_ocltProductProductDiscountComponents.Add(l_oProductDiscountComponent);
l_odtnProductsProductDiscountComponents.Add(p_intProductID, l_ocltProductProductDiscountComponents);
}
} //here is the difference!For those you are going to claim that the curly braces need to be there...the following code block compiles just fine:
if(!m_odtnPriceListsProductsProductDiscountComponents.TryGetValue(p_intPriceListID, out l_odtnProductsProductDiscountComponents))
-
An internal error has occurred in the compiler. To work around this problem, try simplifying or changing the program near the locations listed below. Locations at the top of the list are closer to the point at which the internal error occurred. Errors such as this can be reported to Microsoft by using the /errorreport option. NewLimit.Web.DSIS.Data The following code causes this error. Note that in my opinion this code has no errors at all. I'll prove that by also giving the adjusted code that does compile:
if(!l_odtnProductsProductDiscountComponents.TryGetValue(p_intProductID, out l_ocltProductProductDiscountComponents))
lock(l_odtnProductsProductDiscountComponents)
if(!l_odtnProductsProductDiscountComponents.TryGetValue(p_intProductID, out l_ocltProductProductDiscountComponents))
{
l_ocltProductProductDiscountComponents = new Collection<ProductDiscountComponent>();
foreach(ProductDiscountComponent l_oProductDiscountComponent in this)
if(l_oProductDiscountComponent.PriceListID == p_intPriceListID)
if(l_oProductDiscountComponent.ProductID == p_intProductID)
l_ocltProductProductDiscountComponents.Add(l_oProductDiscountComponent);
l_odtnProductsProductDiscountComponents.Add(p_intProductID, l_ocltProductProductDiscountComponents);
}And here the code that does compile:
if(!l_odtnProductsProductDiscountComponents.TryGetValue(p_intProductID, out l_ocltProductProductDiscountComponents))
{ //here is the difference!
lock(l_odtnProductsProductDiscountComponents)
if(!l_odtnProductsProductDiscountComponents.TryGetValue(p_intProductID, out l_ocltProductProductDiscountComponents))
{
l_ocltProductProductDiscountComponents = new Collection<ProductDiscountComponent>();
foreach(ProductDiscountComponent l_oProductDiscountComponent in this)
if(l_oProductDiscountComponent.PriceListID == p_intPriceListID)
if(l_oProductDiscountComponent.ProductID == p_intProductID)
l_ocltProductProductDiscountComponents.Add(l_oProductDiscountComponent);
l_odtnProductsProductDiscountComponents.Add(p_intProductID, l_ocltProductProductDiscountComponents);
}
} //here is the difference!For those you are going to claim that the curly braces need to be there...the following code block compiles just fine:
if(!m_odtnPriceListsProductsProductDiscountComponents.TryGetValue(p_intPriceListID, out l_odtnProductsProductDiscountComponents))
-
An internal error has occurred in the compiler. To work around this problem, try simplifying or changing the program near the locations listed below. Locations at the top of the list are closer to the point at which the internal error occurred. Errors such as this can be reported to Microsoft by using the /errorreport option. NewLimit.Web.DSIS.Data The following code causes this error. Note that in my opinion this code has no errors at all. I'll prove that by also giving the adjusted code that does compile:
if(!l_odtnProductsProductDiscountComponents.TryGetValue(p_intProductID, out l_ocltProductProductDiscountComponents))
lock(l_odtnProductsProductDiscountComponents)
if(!l_odtnProductsProductDiscountComponents.TryGetValue(p_intProductID, out l_ocltProductProductDiscountComponents))
{
l_ocltProductProductDiscountComponents = new Collection<ProductDiscountComponent>();
foreach(ProductDiscountComponent l_oProductDiscountComponent in this)
if(l_oProductDiscountComponent.PriceListID == p_intPriceListID)
if(l_oProductDiscountComponent.ProductID == p_intProductID)
l_ocltProductProductDiscountComponents.Add(l_oProductDiscountComponent);
l_odtnProductsProductDiscountComponents.Add(p_intProductID, l_ocltProductProductDiscountComponents);
}And here the code that does compile:
if(!l_odtnProductsProductDiscountComponents.TryGetValue(p_intProductID, out l_ocltProductProductDiscountComponents))
{ //here is the difference!
lock(l_odtnProductsProductDiscountComponents)
if(!l_odtnProductsProductDiscountComponents.TryGetValue(p_intProductID, out l_ocltProductProductDiscountComponents))
{
l_ocltProductProductDiscountComponents = new Collection<ProductDiscountComponent>();
foreach(ProductDiscountComponent l_oProductDiscountComponent in this)
if(l_oProductDiscountComponent.PriceListID == p_intPriceListID)
if(l_oProductDiscountComponent.ProductID == p_intProductID)
l_ocltProductProductDiscountComponents.Add(l_oProductDiscountComponent);
l_odtnProductsProductDiscountComponents.Add(p_intProductID, l_ocltProductProductDiscountComponents);
}
} //here is the difference!For those you are going to claim that the curly braces need to be there...the following code block compiles just fine:
if(!m_odtnPriceListsProductsProductDiscountComponents.TryGetValue(p_intPriceListID, out l_odtnProductsProductDiscountComponents))
-
Jan C. de Graaf wrote:
lock(m_odtnPriceListsProductsProductDiscountComponents)
How come this statement compiles without a semicolon at the end? Is lock a macro?
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
Your question makes me think you don't know the C# lock statement; http://msdn.microsoft.com/nl-nl/library/c5kehkcz(en-us).aspx
-
Your question makes me think you don't know the C# lock statement; http://msdn.microsoft.com/nl-nl/library/c5kehkcz(en-us).aspx
-
An internal error has occurred in the compiler. To work around this problem, try simplifying or changing the program near the locations listed below. Locations at the top of the list are closer to the point at which the internal error occurred. Errors such as this can be reported to Microsoft by using the /errorreport option. NewLimit.Web.DSIS.Data The following code causes this error. Note that in my opinion this code has no errors at all. I'll prove that by also giving the adjusted code that does compile:
if(!l_odtnProductsProductDiscountComponents.TryGetValue(p_intProductID, out l_ocltProductProductDiscountComponents))
lock(l_odtnProductsProductDiscountComponents)
if(!l_odtnProductsProductDiscountComponents.TryGetValue(p_intProductID, out l_ocltProductProductDiscountComponents))
{
l_ocltProductProductDiscountComponents = new Collection<ProductDiscountComponent>();
foreach(ProductDiscountComponent l_oProductDiscountComponent in this)
if(l_oProductDiscountComponent.PriceListID == p_intPriceListID)
if(l_oProductDiscountComponent.ProductID == p_intProductID)
l_ocltProductProductDiscountComponents.Add(l_oProductDiscountComponent);
l_odtnProductsProductDiscountComponents.Add(p_intProductID, l_ocltProductProductDiscountComponents);
}And here the code that does compile:
if(!l_odtnProductsProductDiscountComponents.TryGetValue(p_intProductID, out l_ocltProductProductDiscountComponents))
{ //here is the difference!
lock(l_odtnProductsProductDiscountComponents)
if(!l_odtnProductsProductDiscountComponents.TryGetValue(p_intProductID, out l_ocltProductProductDiscountComponents))
{
l_ocltProductProductDiscountComponents = new Collection<ProductDiscountComponent>();
foreach(ProductDiscountComponent l_oProductDiscountComponent in this)
if(l_oProductDiscountComponent.PriceListID == p_intPriceListID)
if(l_oProductDiscountComponent.ProductID == p_intProductID)
l_ocltProductProductDiscountComponents.Add(l_oProductDiscountComponent);
l_odtnProductsProductDiscountComponents.Add(p_intProductID, l_ocltProductProductDiscountComponents);
}
} //here is the difference!For those you are going to claim that the curly braces need to be there...the following code block compiles just fine:
if(!m_odtnPriceListsProductsProductDiscountComponents.TryGetValue(p_intPriceListID, out l_odtnProductsProductDiscountComponents))
-
i would assume that the compiler is having trouble deducing the scope of code to lock? does the follow format also work? C would never do this to u :)
if()
lock(object)
{
if()
{
new collection()
foreach()
if()
if()
cond_add()
Add()
}
}>>i would assume that the compiler is having trouble deducing the scope of code to lock? Yeah, probably. Still the 3rd piece of code I posted compiles just fine. In my view that has the same format. I would expect that the C# compiler has no problems with the code/format you gave.
-
An internal error has occurred in the compiler. To work around this problem, try simplifying or changing the program near the locations listed below. Locations at the top of the list are closer to the point at which the internal error occurred. Errors such as this can be reported to Microsoft by using the /errorreport option. NewLimit.Web.DSIS.Data The following code causes this error. Note that in my opinion this code has no errors at all. I'll prove that by also giving the adjusted code that does compile:
if(!l_odtnProductsProductDiscountComponents.TryGetValue(p_intProductID, out l_ocltProductProductDiscountComponents))
lock(l_odtnProductsProductDiscountComponents)
if(!l_odtnProductsProductDiscountComponents.TryGetValue(p_intProductID, out l_ocltProductProductDiscountComponents))
{
l_ocltProductProductDiscountComponents = new Collection<ProductDiscountComponent>();
foreach(ProductDiscountComponent l_oProductDiscountComponent in this)
if(l_oProductDiscountComponent.PriceListID == p_intPriceListID)
if(l_oProductDiscountComponent.ProductID == p_intProductID)
l_ocltProductProductDiscountComponents.Add(l_oProductDiscountComponent);
l_odtnProductsProductDiscountComponents.Add(p_intProductID, l_ocltProductProductDiscountComponents);
}And here the code that does compile:
if(!l_odtnProductsProductDiscountComponents.TryGetValue(p_intProductID, out l_ocltProductProductDiscountComponents))
{ //here is the difference!
lock(l_odtnProductsProductDiscountComponents)
if(!l_odtnProductsProductDiscountComponents.TryGetValue(p_intProductID, out l_ocltProductProductDiscountComponents))
{
l_ocltProductProductDiscountComponents = new Collection<ProductDiscountComponent>();
foreach(ProductDiscountComponent l_oProductDiscountComponent in this)
if(l_oProductDiscountComponent.PriceListID == p_intPriceListID)
if(l_oProductDiscountComponent.ProductID == p_intProductID)
l_ocltProductProductDiscountComponents.Add(l_oProductDiscountComponent);
l_odtnProductsProductDiscountComponents.Add(p_intProductID, l_ocltProductProductDiscountComponents);
}
} //here is the difference!For those you are going to claim that the curly braces need to be there...the following code block compiles just fine:
if(!m_odtnPriceListsProductsProductDiscountComponents.TryGetValue(p_intPriceListID, out l_odtnProductsProductDiscountComponents))
I hit the same advice on "simplifying" a while ago[^] for a much smaller code snippet :)
-
An internal error has occurred in the compiler. To work around this problem, try simplifying or changing the program near the locations listed below. Locations at the top of the list are closer to the point at which the internal error occurred. Errors such as this can be reported to Microsoft by using the /errorreport option. NewLimit.Web.DSIS.Data The following code causes this error. Note that in my opinion this code has no errors at all. I'll prove that by also giving the adjusted code that does compile:
if(!l_odtnProductsProductDiscountComponents.TryGetValue(p_intProductID, out l_ocltProductProductDiscountComponents))
lock(l_odtnProductsProductDiscountComponents)
if(!l_odtnProductsProductDiscountComponents.TryGetValue(p_intProductID, out l_ocltProductProductDiscountComponents))
{
l_ocltProductProductDiscountComponents = new Collection<ProductDiscountComponent>();
foreach(ProductDiscountComponent l_oProductDiscountComponent in this)
if(l_oProductDiscountComponent.PriceListID == p_intPriceListID)
if(l_oProductDiscountComponent.ProductID == p_intProductID)
l_ocltProductProductDiscountComponents.Add(l_oProductDiscountComponent);
l_odtnProductsProductDiscountComponents.Add(p_intProductID, l_ocltProductProductDiscountComponents);
}And here the code that does compile:
if(!l_odtnProductsProductDiscountComponents.TryGetValue(p_intProductID, out l_ocltProductProductDiscountComponents))
{ //here is the difference!
lock(l_odtnProductsProductDiscountComponents)
if(!l_odtnProductsProductDiscountComponents.TryGetValue(p_intProductID, out l_ocltProductProductDiscountComponents))
{
l_ocltProductProductDiscountComponents = new Collection<ProductDiscountComponent>();
foreach(ProductDiscountComponent l_oProductDiscountComponent in this)
if(l_oProductDiscountComponent.PriceListID == p_intPriceListID)
if(l_oProductDiscountComponent.ProductID == p_intProductID)
l_ocltProductProductDiscountComponents.Add(l_oProductDiscountComponent);
l_odtnProductsProductDiscountComponents.Add(p_intProductID, l_ocltProductProductDiscountComponents);
}
} //here is the difference!For those you are going to claim that the curly braces need to be there...the following code block compiles just fine:
if(!m_odtnPriceListsProductsProductDiscountComponents.TryGetValue(p_intPriceListID, out l_odtnProductsProductDiscountComponents))
Does it compile when you change the foreach into a for loop? If that's the case, then I think the compiler barfs on the disposing code that is generated under the hood. "lock(...)" results in:
try { Monitor.Enter(x); }
finally { Monitor.Exit(x); }and "foreach" results in:
var e = X.GetEnumerator();
try { ... }
finally { e.Dispose(); }Disclaimer: I think...
-
An internal error has occurred in the compiler. To work around this problem, try simplifying or changing the program near the locations listed below. Locations at the top of the list are closer to the point at which the internal error occurred. Errors such as this can be reported to Microsoft by using the /errorreport option. NewLimit.Web.DSIS.Data The following code causes this error. Note that in my opinion this code has no errors at all. I'll prove that by also giving the adjusted code that does compile:
if(!l_odtnProductsProductDiscountComponents.TryGetValue(p_intProductID, out l_ocltProductProductDiscountComponents))
lock(l_odtnProductsProductDiscountComponents)
if(!l_odtnProductsProductDiscountComponents.TryGetValue(p_intProductID, out l_ocltProductProductDiscountComponents))
{
l_ocltProductProductDiscountComponents = new Collection<ProductDiscountComponent>();
foreach(ProductDiscountComponent l_oProductDiscountComponent in this)
if(l_oProductDiscountComponent.PriceListID == p_intPriceListID)
if(l_oProductDiscountComponent.ProductID == p_intProductID)
l_ocltProductProductDiscountComponents.Add(l_oProductDiscountComponent);
l_odtnProductsProductDiscountComponents.Add(p_intProductID, l_ocltProductProductDiscountComponents);
}And here the code that does compile:
if(!l_odtnProductsProductDiscountComponents.TryGetValue(p_intProductID, out l_ocltProductProductDiscountComponents))
{ //here is the difference!
lock(l_odtnProductsProductDiscountComponents)
if(!l_odtnProductsProductDiscountComponents.TryGetValue(p_intProductID, out l_ocltProductProductDiscountComponents))
{
l_ocltProductProductDiscountComponents = new Collection<ProductDiscountComponent>();
foreach(ProductDiscountComponent l_oProductDiscountComponent in this)
if(l_oProductDiscountComponent.PriceListID == p_intPriceListID)
if(l_oProductDiscountComponent.ProductID == p_intProductID)
l_ocltProductProductDiscountComponents.Add(l_oProductDiscountComponent);
l_odtnProductsProductDiscountComponents.Add(p_intProductID, l_ocltProductProductDiscountComponents);
}
} //here is the difference!For those you are going to claim that the curly braces need to be there...the following code block compiles just fine:
if(!m_odtnPriceListsProductsProductDiscountComponents.TryGetValue(p_intPriceListID, out l_odtnProductsProductDiscountComponents))
Jan C. de Graaf wrote:
remarks on this?
That is just plain bizarre :suss:
"The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
-
Does it compile when you change the foreach into a for loop? If that's the case, then I think the compiler barfs on the disposing code that is generated under the hood. "lock(...)" results in:
try { Monitor.Enter(x); }
finally { Monitor.Exit(x); }and "foreach" results in:
var e = X.GetEnumerator();
try { ... }
finally { e.Dispose(); }Disclaimer: I think...
I found your answer quite smart so I decided to try:
if(!l_odtnProductsProductDiscountComponents.TryGetValue(p_intProductID, out l_ocltProductProductDiscountComponents))
{ //extra curly brace
lock(l_odtnProductsProductDiscountComponents)
if(!l_odtnProductsProductDiscountComponents.TryGetValue(p_intProductID, out l_ocltProductProductDiscountComponents))
{
l_ocltProductProductDiscountComponents = new Collection<ProductDiscountComponent>();
for(int i=0;i<this.Count;i++) //suggested code
{ //suggested code
ProductDiscountComponent l_oProductDiscountComponent = this.GetItem(i); //suggested code
if(l_oProductDiscountComponent.PriceListID == p_intPriceListID) //suggested code
if(l_oProductDiscountComponent.ProductID == p_intProductID) //suggested code
l_ocltProductProductDiscountComponents.Add(l_oProductDiscountComponent); //suggested code
} //suggested code
//foreach(ProductDiscountComponent l_oProductDiscountComponent in this) //original code
// if(l_oProductDiscountComponent.PriceListID == p_intPriceListID) //original code
// if(l_oProductDiscountComponent.ProductID == p_intProductID) //original code
// l_ocltProductProductDiscountComponents.Add(l_oProductDiscountComponent); //original code
l_odtnProductsProductDiscountComponents.Add(p_intProductID, l_ocltProductProductDiscountComponents);
}
} //extra curly braceOf course it still compiles just fine:) Sadly, when removing the 'extra' curly braces the compiler still encounters the internal error. In the error list just before/above the internal compiler error the compiler reports 2 'normal' errors; Warning as Error: The variable 'i' is declared but never used Warning as Error: The variable 'l_oProductDiscountComponent' is declared but never used In the original situation (foreach version) only the 2nd of the above errors appeared, logically. For clarity I would like to state that the code with the extra curly braces, which compiles fine, also produces the expected results. Thanks, Victor, for your interesting suggestion though. If you'd like me to do any more tests/adjustments, perhaps even scarier stuff like gathering IL or preprocessed source, I'm willing to go on with this for a while. With the more technical stuff I do need proper guidance though.