ReSharper Postfix Templates plugin

Developers: ever notice how you often, when typing some piece of code, most often a variable or other class reference, have to track back your keystrokes to surround it or prefix it with something else? The Postfix Templates extension for ReSharper by Alexander Shvedov (@ControlFlow) minimizes the times you have to backtrack what you typed, by enabling you to continue typing and selecting what you actually wanted from intellitype as if it were a virtual extension method, after which the templating engine completes your code including prefixing and surrounding where needed. That may sound difficult as I describe it perhaps, but pictures paint a thousand words: check out the small demonstration videos on the github site, it explains much better than I can. Using it for a couple of days it has already saved me a lot of backspacing and cursor-left presses and it just… feels more intuitive what you are doing.

Lees meer over dit bericht

Advertenties

Update to SQL server tooling for Visual Studio

MS recently released the “March 2014” update to the SQL Server tooling for Visual Studio 2013, which was named SQL Server Data Tools for previous Visual Studio versions. Among the most notable new features are support for SQL Server 2014 and several productivity updates that simplify development and testing, also on SQL Azure. Read more about it on the SQL Server Data Tools team blog here.

Worth noting for some of us, is that Visual Studio 2010 is no longer supported with new features and updates for SSDT, although the dacpac’s and other projects remain fully compatible throughout 2010/2012/2013. The update to SSDT that was released at the time VS2013 came out, was the last one. Personally, I am only keeping my VS2010 around for its Installer support, so I am ok with that.

(Add. 10-04)

Today I noticed that the order of installation of updates is important. On another machine, I upgraded SSDT first, but was then unable to install the 1.3 update to the Microsoft Office Developer Tools (12.0.30225.00, to be precise). The latter’s Web Installer the complains about missing requirements and refuses to continue:

ssdt_required

SQL Server Data Tools not installed?

SQL Server Data Tools is installed, obviously, but not recognized, probably because of newer version numbers. I don’t really mind much since I don’t actively develop using the Office Developer Tools, so I’ll just wait for the next update. But if you do use both, I recommend you should install the ODT update first, and then SSDT!

Downloading UTF-8 filenames from an FTP-server that does not support them, with System.Net.FtpWebRequest

I have written a windows service in .Net that monitors an FTP location for new files, which it then downloads to a local folder for processing. To be precise, the tool first renames the file before downloading it. It uses the .Net standard FtpWebRequest class from System.Net. Every once in a while, a file could not be downloaded, and the FtpResponse would be 550 – Action not taken, file unavailable. This happened especially if the file name had “special characters” in it, one example being a file named ANDRÉ.XML. The workaround was simple: I’d launch an FTP application, rename the file to ANDRE.XML, and it would quickly be picked up by my tool again.

It bothered me that somehow the FTP application was able to rename the file, while FtpWebRequest was not. (It also bothered me that every once in a while I had to fix a stuck file like this, but let’s not go down that road here.) So I attached a trace log to see what was going on.
Lees meer over dit bericht

The case of the blank Visual Studio properties window — part 2

Earlier this year I suffered from a case of a Visual Studio properties window that appeared to get “stuck” in the middle of developing an application. It would show up blank and the only way to get it to work was to fix the project and restart Visual Studio (not just close and reopen the solution). For more details, please read the first article.

Blank Properties window in Visual Studio

Although I haven’t written about it, after applying the solution from the first article, my problems weren’t entirely over. Every once in a while, the properties window would get stuck again, and after tweaking the .xsd file a little or reverting it to a previous revision, I could get it to work again. But I never got the feeling that I really understood what I was doing. It would just work sometimes, or not. I even got hesitant to make any changes to the dataset, unless absolutely necessary. But it only happened on that single solution.

Until last week. In an entirely different solution, all of a sudden the properties window was blank again. It’s subtle, you don’t always notice immediately and because of that I could not simply undo the last the thing I did. This solution contained a dataset file too, so after cursing a little (I admit) the first thing I did was revert that and reapply the changes one by one. But this time, that didn’t work. I reverted the dataset to points way before the property editor got broken but still nothing. It was starting to look like the dataset file being the solution was not a generic one, but just the solution for that first project. This time, it was something else. Lees meer over dit bericht

Error when compiling .resx file – Attempt to load a program with an invalid structure

I have seen this before and fixed it, but ran into it again today and could not remember what is was. When compiling a WinForms application in Visual Studio 2010, I got an error message stating “Kan bestand of assembly (…) of een van de afhankelijkheden hiervan niet laden. Poging om een programma te laden met een onjuiste indeling. ” (Roughly translated, “Can not load assembly (…) or one of its dependencies. Attempt to load a program with an invalid structure.”).

When double-clicking the error, it points to a base64-encoded piece of a resx-file, in this case an image stream for an image list.

This is a bug in Visual Studio 2010 that has not yet been fixed. See here on Microsoft Connect.

The workaround suggested by Pellet21 works for me in the mean time. I’ll copy it here to save myself from Googling for it next time:

Workaround
1.    Open Form in Designer and make needed GUI changes. Close designer and save
2.    Compile project and receive RESX compile error (only forms with Imagelist should have this problem)
3.    Double-click resx compile error to open resx file.
4.    Scroll to top of imagestream.
5.    Edit the top line of the Image stream:
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
TO
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
6.    Close and save resx file and recompile.
**NOTE: the only difference are the characters at end “j00LjAuMC4w’ to “j0yLjAuMC4w”

This needs to be done EVERY TIME you open the form in Designer mode.

Initializing a combobox to a blank value might be harder than you think

Combobox troubles again today. No matter how hard I tried to have Comboboxes in my dialog form to initially display blank (SelectedIndex = -1), as soon as the dialog was displayed, the combos would always show the first item in the List that populated it. Despite being set to -1 explicitly. It was driving me nuts.

When created at runtime using a List as DataSource, getting this (empty combos) might be harder than you think

The situation: I had a dialog form that should have a variable number of comboboxes on it, determined at runtime. So the form had an Init method where I dynamically added the comboboxes, and set its DataSource to a List of items (directly, no BindingSource). The form also has a LoadData method, that sets the SelectedIndex of each combo to the actual value from the data, or to -1 of it was unknown or uninitialized at that time. This was to be able to make the combo appear blank instead of preselecting the first item, which was undesired. The caller of the dialog executes Init(), LoadData() and finally ShowDialog().

I was expecting a blank combobox, but it showed the first item in the list preselected. I triple checked that the SelectedIndex was correctly set to -1 at the end of LoadData(), but as soon as the form was displayed, it was 0. What the *** happened there in between and “who” was secretly setting my property!? Lees meer over dit bericht

SP1 for SQL server 2008R2 brings back Intellisense to SMSS

Yay! Installed Service Pack 1 for SQL Server 2008 R2 today. Among other fixes, it brought back IntelliSense support in SQL Server Management Studio, which had been broken since I installed SP1 for Visual Studio 2010 on that machine.

SSMS Intellisense is back!

So those of you that were bothered by the same issue, are advised to install the service pack as soon as you can.