Bug de C#

20/09/2007 - 10:46 por Alhambra Eidos Kiquenet | Informe spam
Hola señores,

existe alguna solución a este bug de C# ??

http://geeks.ms/blogs/elbruno/archi...con-c.aspx

Null Exemption caused by JIt optimisation around String.IsNullOrEmpty

1 static void Main(string[] args)
2 {
3 Console.WriteLine("starting");
4 test(null);
5 Console.WriteLine("finished");
6 Console.ReadLine();
7 }
8 static void test(string x)
9 {
10 for (int j = 0; j < 10; j++)
11 {
12 if (String.IsNullOrEmpty(x))
13 {
14 //TODO:
15 }
16 }
17 }

Saludos
http://www.alhambra-eidos.es/web2005/index.html
www.kiquenet.net
 

Leer las respuestas

#1 Alberto Poblacion
20/09/2007 - 11:45 | Informe spam
"Alhambra Eidos Kiquenet"
wrote in message news:
existe alguna solución a este bug de C# ??



La respuesta "oficial" está en Microsoft Connect:
https://connect.microsoft.com/Visua...FeedbackID3102&wa=wsignin1.0

y dicen que no se arreglará el bug hasta Orcas (Visual Studio 2008). Hay
varios "workarounds", como por ejemplo crear tu propia función asi:

[MethodImpl(MethodImplOptions.NoInlining)]
public static bool IsNullOrEmpty(string value)
{
if (value != null) {
return value.Length==0;
}
return true;
}

Preguntas similares