• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Evaluaciones
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

99
Vistas
VS 2017 ¿Error o nuevas características?

Después de actualizar a VS 2017, recibí el siguiente error de este código (que siempre ha funcionado perfectamente)

 byte[] HexStringToByteArray(string hex) { if (hex.Length % 2 == 1) throw new Exception("The binary key cannot have an odd number of digits"); byte[] arr = new byte[hex.Length >> 1]; for (int i = 0; i < hex.Length >> 1; ++i) // Error in this line { arr[i] = (byte)((GetHexVal(hex[i << 1]) << 4) + (GetHexVal(hex[(i << 1) + 1]))); } return arr; }

Excepción:

 Error 1: The variable 'i' cannot be used with type arguments Error 2: 'hex' is a variable but is used like a type

la solución fue rodear la expresión entre paréntesis.

 for (int i = 0; i < (hex.Length >> 1); ++i)

Pero eso me hizo preguntarme si esto es un error o una nueva funcionalidad. Gracias.

about 3 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Gracias por informar esto. Esta es una regresión confirmada en la precedencia del análisis. Esta solución se enviará en la primera versión trimestral de VS2017 a más tardar.

Información sobre la corrección: https://github.com/dotnet/roslyn/pull/16834

about 3 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda