Search This Blog

Tuesday, June 26, 2018

MSDN general guidelines for debugging with Visual Studio

Taken from https://referencesource.microsoft.com/setup.html

         You can configure Visual Studio to automatically step over system, framework, and other non-user calls and collapse those calls in the call stack window. The feature that enables or disables this behavior is called Just My Code. This topic describes how to use Just My Code in C#, Visual Basic, C++, and JavaScript projects.
          To debug .NET Framework source, you must have access to debugging symbols for the code. You also need to enable stepping into .NET Framework source.

          You can enable .NET Framework stepping and symbol downloading in the Options dialog box. When you enable symbol downloading, you can choose to download symbols immediately or just enable the option for later downloading. If you do not download the symbols immediately, symbols will be downloaded the next time that you start debugging your application. You also can do a manual download from the Modules window or the Call Stack window.

  • Require Source Files to Exactly Match The Original Version

Monday, June 25, 2018

Which C# version is my app using ?

Determining the version of the C# language an application uses is a function of 3 parameters: .NET framework being targeted, the C# version chosen from the available ones (project properties | build | advanced | language version), and visual studio version installed.

Here you find the table listing the available combinations, as of today, June 25th, 2018.

Unexpected results with no exceptions being thrown - apparently

If you are facing undesired results or strange behaviors, but are not spotting any exception in run time - make sure you checked all the Common Language Runtime Exceptions in Debug -> Exception Settings.

I was facing an InvalidOperationException due to unsafe cross thread access.
But it was only when I instructed VS to break on all exceptions from the CLR, then I finally got the hint of where/who was raising the exception.

Sunday, June 17, 2018

Are you merging your project DLLs and getting a Could not load file or assembly or one of its dependencies?

If you are facing the endeared "Could not load file or assembly or one of its dependencies" error, and you know your project merges its assemblies using ILMerge or alikes, make sure the dlls that is raising the exception was not accidentally left out the merge.

This is what happened in my case.
All I had to do was to add it to the merging, marking it with the <Ilmerge>True</Ilmerge> in the .csproj, like the others.

Monday, June 11, 2018

Devexpress Project Converter, Clickonce PreRequisite dependencies, GAC and the ensuing hours you have wasted...

We have run DeveExpress Project Converter in Visual Studio to upgrade our clickonce from 17.1.5 to 18.1.3. Problem was that after the conversion 2 dlls, DevExpress.Images and DevExpress.RichEdit.Export were added to the Application Files (Publish tab) list with Publish Status as PreRequisites. The impact of this is that deploying the app showed an error message stating dll ***** was required to exist in the Windows GAC folder.

The solution, therefore, was to change the Publish Status of these PreRequisite dlls (in our case, to Exclude, because we deploy all devexpress from an external zip, in an external process - but usually you will set this to Include). After that, publishing will generate a manifest that does not show these dlls with PreRequisite dependencies, and hence you are rid of the deployment installation GAC message.