Posts

Showing posts with the label Visual Studio

Visual Studio 2010: Find and Replace using Regular Expressions

Image
Spanish version / Versión en Español This is not something introduced by Visual Studio 2010, but I'm a late bloomer. I'm quite sure that at least 2008 and 2005 also have it. Let's say we have a test class which opens a bunch of files, and that it has a lot of hardcoded relative paths like this: class FactoryImage{ public static IEnumerable ImageTestCases{ get{ //9 bits, Signed, Monochrome1 yield return new TestCaseData(new ImageParameters { FileName = ".\\ImagesTest\\DavidClunie\\MONOCHROME1\\Signed\\9SignedMonochrome1_512x512_LE.pix", //Rawdata, example image FileNameWhite = ".\\ImagesTest\\DavidClunie\\MONOCHROME1\\Signed\\9SignedMonochrome1_512x512_LEWhiteImage.pix", //Rawdata, white example image //More fields... }); //9 bits, Unsigned, Monochrome1 yield return new TestCaseData(new ImageParameters{ FileName = ".\\ImagesTest\\Da...

Visual Studio 2010: Find and Replace con Expresiones Regulares

Image
Versión en inglés / English version Esto lo tienen versiones anteriores al Visual 2010, pero uso la referencia del 2010, así que aclaro por si las moscas. Supongamos que tenemos una clase de test que abre un conjunto de archivos, y que tiene un montón de paths relativos hardcodeados de esta forma: class FactoryImage{ public static IEnumerable ImageTestCases{ get{ //9 bits, Signed, Monochrome1 yield return new TestCaseData(new ImageParameters { FileName = ".\\ImagesTest\\DavidClunie\\MONOCHROME1\\Signed\\9SignedMonochrome1_512x512_LE.pix", //Rawdata, example image FileNameWhite = ".\\ImagesTest\\DavidClunie\\MONOCHROME1\\Signed\\9SignedMonochrome1_512x512_LEWhiteImage.pix", //Rawdata, white example image //Otros atributos... }); //9 bits, Unsigned, Monochrome1 yield return new TestCaseData(new ImageParameters{ FileName = ".\\ImagesTest\\DavidCluni...

C++: Project always out of date when running in Visual Studio

Spanish version / Versión en Español A little while ago, I ran into a weird problem. My application compiled fine in Visual Studio 2010, but when I tried to Debug it, it would ALWAYS say that a certain C++ project (always the same one) was out of date and asked me if I wanted to build it. But if I had just done so! The first thing you'll want to try is to do a full clean and build of your solution. If after that the problem is still there, try this: Enable logging for C++ projects build. Download, unzip and run DebugView from SysInternals. Those people make great tools, check them out! Add a filter to Debug View using the name of your project. If you don't do this, DebugView will drown you in a sea of log messages. Build again. Take a look at DebugView's log messags. In my case, my error was something like this [42216] Project 'YourCrazyProject.vcxproj' not up to date because build input 'YourWackyReference' is missing. Delete or fix th...

C++: Proyecto siempre desactualizado al correr en Visual Studio

Versión en inglés / English version Hace poco me pasó que compilaba mi aplicación exitosamente, pero al correrla el Visual Studio 2010 me decía que cierto proyecto estaba desactualizado y que si quería compilarlo. ¡Pero si acabo de compilarlo, macho! Bueno, la solución es arremangarse y activar los mensajes de log del compilador de C++, algo que los de Mocosoft dejaron bastante oculto. Resumiendo: Probar haciendo un Clean Solution y compilando otra vez. Si eso no resuelve el problema, seguir al paso 2. Activar el logging para la compilación de proyectos C++. Bajar, descomprimir y ejecutar DebugView de, cuándo no, SysInternals. Unos capos. Agregarle un filtro al DebugView con el nombre de nuestro proyecto. Si no hacemos esto, nos ahogaremos en un mar de mensajes. Compilar de nuevo. Buscar un mensaje de este estilo: [42216] Project 'TuProyectoLoco.vcxproj' not up to date because build input 'TuDependenciaColgada' is missing . Borrar o corregir esa ...

Tracking down exceptions in Visual Studio 2008

Spanish version / Versión en Español If you ever looked at Visual Studio's Output window and saw a "first chance exception" message and a weird error which is not even documented in the MSDN, and you were not patient enough to debug step by step until the line popped up in the Output window again, I have a solution for you. It also applies if you want the Visual Studio debugger to break every time an exception is thrown and/or unhandled by your code. The secret is Visual Studio's Debug->Exceptions dialog. Here we can check which exceptions to track down, including .NET, native C++, ATL and stuff. In the particular case of C++ exceptions, for this mechanism to work, certain conditions must be met: When installing Visual Studio, the C++ runtime was installed In the C++ project's general properties, "Use of MFC" is set to "Use MFC in a static library" or "Use Standard Windows Library". In the project's properti...

Rastreando excepciones en Visual Studio 2008

Versión en inglés / English version Si alguna vez miraron el Output del Visual Studio y vieron "first chance exception" y un mensaje raro que no aparecía documentado ni en la MSDN, y no les daba la paciencia para hacer paso a paso con el debugger hasta que apareciera la línea en el Output, ésta es la solución. También si les salta alguna excepción de .NET y el Visual no les pone el breakpoint cuando eso ocurre. El secreto está en el diálogo Debug->Exceptions. Aquí podemos tildar las excepciones que queremos detectar, para que se ponga un breakpoint cuando salten. Pueden ser generadas por .NET, el runtime de C++, ATL y otras yerbas. En el caso particular de las excepciones de C++, para que este mecanismo funcione, debe cumplirse que: Al instalar el Visual, se instaló el runtime de C++ En las propiedades generales del proyecto, "Use of MFC" está seteado en "Use MFC in a static library" o "Use Standard Windows Library". En las...