ailon's DevBlog: Development related stuff in my life

Debugging Silverlight Out-of-Browser Applications on 64-bit Windows

4/22/2010 3:53:52 PM

Today I had to debug a problem in my Silverlight 3 project that manifested itself exclusively in out of browser mode.

Here’s a concise and to the point guide on debugging Silverlight 3 applications in out of browser (OOB) mode by Jimmy Lewis. Problem is that when you follow it in Visual Studio 2008 running on 64-bit Windows 7 (and as far as I understand Vista too) you get this message box when you try to start debugging:

Warning: A StringBuilder buffer has been overflowed by unmanaged code. The process may become unstable. Insufficent capacity allocated to the StringBuilder before marshaling it.

I’ve tried to search for a solution on the web and all I found was a simple but not very satisfactory workaround: Use VS2010.

Yes, as far as I can tell the only way to debug your Silverlight 3 OOB app on Windows x64 is to open it in Visual Studio 2010. Problem is that first of all you need to have VS2010 and another problem is that it has to convert your project to 2010 format.

Luckily in my case I was able to just copy my VS2008 project to a new location, open it, convert it, quickly find a lame bug (I was assuming in one place that HTML Bridge is always available), implement single line fix and copy it back to my VS2008 project. So it was a small inconvenience in my case but if I ever need to debug something more substantial that could be a big pain.

However it’s quite possible that my googling skills aren’t perfect and I’ve missed a real solution to this problem. If so, please, let me know in the comments below.

Tags: ,

VisualStudio.NET vNext Feature Request: Multi-target IntelliSense

4/8/2010 6:44:04 PM

Visual Studio is great. IntelliSense is great. But here’s one thing that has been slowing me down ever since I started developing for several .NET based platforms.

The Problem

WPF, Silverlight and now Silverlight for Windows Phone 7 are very similar frameworks, but they are far from being identical. Lots of code written for one can be re-used in another, but quite often it requires small modifications and it’s frustrating. It’s especially frustrating when you realize that those modifications wouldn’t be necessary if you’ve used another overload of some method or used another method altogether in the first place.

Take a look at screenshots of the IntelliSense dropdown for the same class in different environments:

Here’s one for WPF 3.5:

wpf_dropdown

And this is on for Silverlight 3:

silverlight_dropdown

Notice that there are lots of methods, properties and events that are not in Silverlight and I guess you can find some that are not in WPF (but that is not the point here). Sometimes you want to use WPF-only stuff for better performance or other very valid reasons but quite often you just use it unconsciously because finding out if something is supported in Silverlight or vice versa takes too much time and effort.

Now I wanted to add a LineSegment to the PathFigure and it has 3 constructor overloads in WPF

wpf_overloads

but only only the default constructor in Silverlight

silverlight_overloads

If I haven’t checked for the difference manually (or knew it by heart) I would end up rewriting this code once I’ve switched to a Silverlight project. So, you get the picture. The fact that I constantly have to recompile for all the platforms and/or manually check for differences takes a significant amount of my development time. I would like this to be addressed somehow and if some third party tool does something good in this area, please, let me know in the comments, but for now I have this idea/feature request for future version of Visual Studio .NET

Multi-target IntelliSense

There are numerous ways how this could be implemented and I’m not the best expert in things like this, but I’ll try to explain my vision of this anyway.

I think a project could have a set of secondary Target Framework settings. When these are set, IntelliSense would somehow highlight members or overloads that are in main target framework but not in the secondary. For example WPF methods that aren’t in Silverlight could be grayed out in the dropdown above. Same goes for method overloads. Plus some text explanation in the tooltip wouldn’t hurt too.

Something like this would be a huge time saver for me and I guess for other developers too. Especially with all the extra framework partitioning related to release of Silverlight for Windows Phone 7 which will be another very close yet not completely identical addition to the current mix of WPF & Silverlight.

I’ve ran this idea by Jesse Liberty at MIX10 and he thought it wasn’t a bad idea at all, so I decided I need to submit it to Microsoft via MS Connect. So if you like this and would like something along these lines implemented in the future version of Visual Studio, please, go there and vote it up.

Shout it

Tags: , , ,

VS2008 Purchasing Part 3: Great Success... not really

7/29/2008 10:47:03 AM

I have 9 days left on my Visual Studio 2008 trial and suddenly "Upgrade..." button no longer leads to "Content not found" page. It was still "not found" a week ago or so, but now it looked promising. Unfortunately digital registration is only an option for customers in USA and Canada. So we (the rest of the world) are still out of luck.

So I assume I'll have to go the old-fashioned way and it sucks.

See also:

Tags: ,

Visual Studio Trial Upgrade: 24 days later

6/2/2008 10:57:28 AM

vs_trial_66days

I wanted to wait a month before checking back on this issue but recent post by ScottGu (more on this later in this post) changed my plans.

So, it's been 24 days since that post. Thanks to DotNetKicks, Dzone and, obviously, Google that post was viewed more than 1100 times directly (not counting views through RSS, as part of the whole blog, etc.). I'm pretty confident that someone from Microsoft directly responsible for these things or at least someone who knows someone who is in some way related to this has seen it.

Today I tried to repeat the quest and failed exactly the same way as almost a month earlier. The only difference was that MSDN's header design has changed and "Content Not Found" page looks prettier now.

Now back to the a/m ScottGu's post. Only things why I wanted to upgrade to VS2008 right now were to play with Silverlight and ASP.NET MVC. Sure I'd like to use VS2008 with other things but for now I work on 2.0 projects and there's no immediate need for 2008. And from that post it appears that I can do my playing from VWD Express 2008 meaning that I can delay upgrade to VS2008 for as long as I want (if ever). This is no way a solution for the actual non-upgradeability problem but it's not my fault that Microsoft doesn't want my money.

kick it on DotNetKicks.com

Tags: ,

Why is it so F#...ing Difficult to Buy Visual Studio!?

5/8/2008 5:59:04 PM

I remember going through something like this with Visual Studio 2005 but back then I've swallowed my pride and called my local "pusher" and got the VS2005 old fashioned way. Now, 3 years later, I want to buy Visual Studio 2008. Let's see how this goes...

Note: I live outside of USA and any other "major market" for that matter

Upgrading through the Trial

I've download and installed Visual Studio 2008 Professional 90-day Trial. Now I go to Help->About and see the "Upgrade..." button. Hooray!

vs2008about

When I click it my browser opens a page saying  "Content not found".

ms-content_not_found

How crazy is that!? This is a current product by a MAJOR corporation so how could something like this happen?

Other ways

OK, let's swallow some pride again and go through the product page. Closest to the words "buy" or "purchase" is Pricing - let's go there. First link there is Worldwide Purchase Information. Hooray again. When I go there I see information about buying an MSDN Subscription but I only want a standalone VS2008 Standard or Professional. OK, there's a section:

Additional Purchasing Options

[Skeptical] hooray. So now we get to this page. Looks promising. I click "Buy or upgrade now" and get to Windows Marketplace page where all of the online merchants listed ship to USA and Canada only. And I would actually prefer a simple license key (which must be an option (see below)). Dead end again.

Now I remember that there was something about upgrading from Trial on the Trial download page. Here it is:

Upgrading from Trial Editions

When you are ready to upgrade from an installed trial edition of Visual Studio or Team Foundation Server (or the Workgroup Edition of Team Foundation Server), you don't have to completely uninstall and reinstall those products. For more information, see How to: Upgrade from Visual Studio Trial Edition (a Visual Studio 2005 topic, but still accurate).

The "how to" page has the following:

To obtain a product key
  • Purchase a copy of Visual Studio 2005 Professional Edition at a retail location. The product key is listed on the sleeve of the DVD or CD.

    —or—

    Order a Visual Studio 2005 Professional Edition product key online at http://msdn.microsoft.com/vstudio/howtobuy/. The product key is sent to you in an e-mail message.

Click on the http://msdn.microsoft.com/vstudio/howtobuy/ - "Content Not Found"

Our local Microsoft website has a list of "old-school" companies who can order you a hard copy from the warehouse and you'll get it in couple of weeks or months (which was what I tried to avoid and was supposed to succeed).

I hope that someone at Microsoft reads this and at least fixes all the "not found" issues and specifies accurate information. At the very least tell me that there's no way for me to buy this online but don't make me waste half a day trying to find a correct way to navigate your website! Theoretically I wasted more time (equals money) looking for a way to make a simple transaction than the transaction is worth. Very frustrating.

kick it on DotNetKicks.com

Tags: ,

Using Symlinks to Ease Development with Visual Studio Express

11/21/2007 8:01:16 PM

As you probably know, since Visual Web Developer Express and Visual C# Express (or VB for that matter) are separate products and you can't create DLLs in VWD or build web sites in VCS it is painful to develop ASP .NET controls using the Express editions of Visual Studio.

There are several ways to workaround this limitation. Personally I prefer the one where you develop your control in App_Code directory of a test web site in VWD and then when you are ready you copy the .cs files to a project in Visual C# Express and build your DLL(s) from there.

vwd_spaw2

The problem with this approach is that you have 2 copies of your files and as it often happens sometimes you edit the files in one place then in the other dir and you have a mess.

Fortunately this problem can be solved using symbolic links - feature well known to *nix guys and now available in Windows Vista using mklink. As far as I understand you can get the same effect using linkd command in Windows Resource Kit for Windows 2000 and newer but mklink comes with Vista out of the box.

So, what I do is make a symbolic link in my Visual C# project directory which points to a subdirectory in my Visual Web Developer web site:

cmd_mklink

The syntax for mklink in our case is this:

mklink /D new_dir_path original_dir_path

Now we just need to include our newly created "fake" directory into Visual C# Express project and we are all set

vcs_spaw2

This approach can be used in many different scenarios. Currently I work on a couple of related web sites with a colleague. All of the sites originate from one "base" web site. The class files of this base web site are still under development (we update them from time to time). It's too early to compile them and include in our "inherited" web sites as DLLs, so we use the same technique to "include" these common files in our "child" projects.

kick it on DotNetKicks.com

Tags: , , ,

File Encoding in Visual Studio

11/5/2007 3:43:02 PM

It appears that there's no way to set default file encoding for new files created in Visual Studio 2005 through "Options" and it will save your files in UTF only if it encounters characters it can't save in your systems default non-unicode locale.

What does it mean? It means that if you develop a simple web site in a language of your system (Lithuanian in my case) and you hardcode some local text in your .aspx it will save in non-unicode encoding (Windows-1257 in my case) and when you move it to the server (or other computer) with other default non-unicode encoding all your localized text will be ruined.

What can be done about it? It looks like we have 3 options:

  1. manually save or re-save your files using "Save with Encoding";
  2. change your system language to "English" in control panel (this is kind of wrong);
  3. re-save Visual Studio templates (in Common 7\IDE\ItemTemplates) in UTF-8 with signature

Only the last option somewhat solves the problem but you'll have to go through all of the templates you ever plan to use and hope that this doesn't break anything.

Hopefully this issue will be addressed in VS2008. I had no time to play with the betas yet, so I have no idea if there are any changes in this area. Can anybody confirm this?

Tags: , , ,

Consolas

10/8/2007 8:10:08 PM

consolas I'm very slow on customizing my environment. I can do things the hard way for months before I force myself to make a small tweak that makes life much easier. No wonder I used Visual Studio (and PSPad for that matter) with default "Courier New" font and didn't even know that Vista comes with a special monospace, ClearType fine-tuned font family called Consolas. You can download it for XP, too.

Hopefully this will make the long development hours ahead a little bit easier on my eyes.

You can find samples and download links for other popular "developer fonts" through this article.

Tags: , , ,

Copyright © 2003 - 2017 Alan Mendelevich
Powered by BlogEngine.NET 2.5.0.6