Scott Hanselman

They WILL take your photos and they WILL use them and you WILL like it.

June 19, '13 Comments [39] Posted in Musings
Sponsored By

This is hardly a tragic story and it's not even a good photo, but it's interesting because it happens a few times a year. Perhaps it's happened to you! (Share in the comments)

A buddy noticed a story in Business Insider Australia that was picked up off Reuters called "Microsoft says they've disrupted a global cybercrime ring responsible for $500 Million Theft." It was syndicated to OZ by Business Insider US who pulled it from Reuters, and it seems they each pick their own illustrative picture.

And apparently they did it in my damn office. That's my big head, my three monitors and I am, in fact, hacking on CoffeeScript in this picture, not fighting cybercrime. How do I know? Because I was there when this photo was taken by Rob Conery. We used it for my Speaking Hacks educational video.

image

Rob Conery and I made a video called Speaking Hacks...here's a screen capture.

image

It got used on a post a CoderWall.com where I describe my system setup. I love that they crop the pictures they so carefully Google Image Search for.

I try to use search.creativecommons.org for my image searches on this blog. Raphael Rivera turned me on to this and reminded me of the importance of respecting image copyright. Just googling for a picture and slapping it on your blog isn't cool.

Usually when this kind of thing happens I'll just email a kind note to the owner of the site and mention it and it gets handled. (I've just emailed Business Insider now) Most people are very nice. Folks at Gizmodo and LifeHacker almost always have a real human behind their stories with a real Twitter account and they've always been accommodating about little things.

Ah, but sometimes it's not just a nameless-faceless newspaper but it's a nameless-faceless newspaper article originally published by Reuters on "put on the wire" which means it can spread literally everywhere, and fast.

Do I care? Not really, but it's the principle of the thing. I mention it because it's a teachable moment for us all.

When you put an image on the Internet, it's on the Internet.

It can be used for anything, anytime, by anyone. You can assert copyright, but usually depending on how big the site is (or how obtuse their Contact Us page is) you'll be lucky to find a human, much less a nice one.

image

At least I have my hair. So far.

Think about signing that Photo Release

It matters to me when it's big and public and involves my kids. Some friends were driving down the freeway recently and noticed something. They called and said "Is that your son on a billboard off I-5?"

This was my reaction: O_o

image

Turns out that years ago in our school's day care we signed a photo release. I assume we thought it was for their blog, or a pamphlet, but in retrospect even that was a bad idea. We never thought my kid would end up on a 30 foot paper billboard advertisement, with little recourse. Fortunately in the billboard case, the head of the school wasn't aware either! Their marketing folks were just pulling the photos from a shared folder, treating them as stock images. In the end, the school was extremely accommodating and apologetic and it's since been handled. Still, a wake up call to us, and I hope, to you, Dear Reader.

Happy Resolution

This email showed up literally as I was/am writing this post.

Hi Scott

Thanks for getting in touch. I’m the editor at Business Insider Australia.

I’ve removed that image, which was syndicated from the US edition. I’ve also alerted them to your complaint.

http://au.businessinsider.com/microsoft-cybercrime-500-million-theft-2013-6

Hope this addresses the matter for you.

Best wishes,

Paul

Awesome. And sometimes your kind letter reaches a kind human and gets handled. Thanks Paul, much respect!

Now, about this NEW picture...;)

image 

(Yes, I realize the thick irony of me blogging it, and thereby putting the image "back out there" but it's for educational purposes.)

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Exclusive Sneak Peek: The AGENT Smart Watch Emulator and managed .NET code on my wrist!

June 18, '13 Comments [30] Posted in Micro Framework | Tools
Sponsored By

The AGENT Smart Watch

I'm totally geeked out about Smart Watches. I always have been, from the original Microsoft SPOT watch (from 10 years ago!) to the Pebble, and now the AGENT Smart Watch from Secret Labs. Secret Labs are the folks that brought us the Netduino open source electronics platform that uses the .NET Micro Framework. It's pretty awesome that you can write C# and run it in 64k or in 64gigs, from the wrist to the cloud.

Upcoming Conference: If you're in or around Chicago in July 2013, consider joining Chris Walker from SecretLabs and I at the MonkeySpace conference! We'll be speaking about developing for embedded systems and the AGENT Watch with C#. What are the power considerations? How low-level is this kind of coding? Can one kind of app cause battery drain while another keeps the watch going for a week? What about notifications and bluetooth? We'll cover all this and lots more, join us.

The AGENT Smart Watch will talk to your phoneThe AGENT Smart Watch was trying to raise $100k to build a watch and as of the time of this writing they are within spitting distance of a MILLION dollars! There's just hours to go to get in on this cool Kickstarter. (Remember, Kickstarter is an investment, not a store.)

Not only is this a .NET Microframework Device, but we can start writing apps now using the AGENT Watch Emulator. From their Kickstarter site:

Traditional smartwatches run apps in an unrestricted environment.  AGENT's OS includes a managed runtime, optimized for our low-power architecture.  It is called the .NET Micro Framework and it makes watch apps trustable.

This feature-rich managed runtime also offers developers modern features they crave: event-based programming; multi-threading; garbage collection; lambda expressions; exception handling; automatic power management; and much more.

You can install VS2012 and the .NET Micro Framework 4.3 and write an app for your wrist! I alluded to this a little in my Xamarin talk "How C# Saved My Marriage." You can write .NET apps for embedded systems, a watch, tablets, desktops, web sites, large cloud systems and more.

Full disclosure: I have no financial stake or business relationship with SecretLabs, but we are friends and I'm a fan. I helped Chris with some copy writing on the Kickstarter page, its text and reviewing the video as a favor. I have received no money from SecretLabs and I backed the Kickstarter with my own money.

imageI got a preview of the AGENT Smart Watch emulator, and some code from Kickstarter backer Esben Bast who created a binary clock face. I loaded up VS2012 and the binary clock emulator. This initial code is just about 100 lines. You can see the references in Solution Explorer here. SPOT means "Smart Personal Object Technlogy."

The fact that there is an emulator is huge. No worries about breaking a watch or even having a watch! The Agent Watch SDK puts a reference to the AGENT Emulator in my registry, so it shows up directly in Visual Studio:

image

Then I can debug my watch app without a watch, just as if I were writing a Phone App or Web Site. It's a first class experience inside of VS. This makes me feel particularly empowered as a .NET developer because it means I already know how to write apps for this watch and I've never even seen it before..

The code is pretty straightforward, if appropriately low-level. This IS a small device we're talking about!

You've got total control over the screen and what can be displayed. You could create any watch face that you could imagine (that would fit on the screen) because you have a Bitmap to draw to.

The .NET Micro Framework has no fonts loaded by default, but I can include them as resources. There's some "tinyfnt" files in C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Fonts or I could download or make some myself. Even better I can use the TinyFontTool from Miloush.

I can load a font from a resource like this:

font = Resources.GetFont(Resources.FontResources.small);

and then later in my UpdateTime() method, Draw the time on my binary clock screen.

_bitmap.DrawText(DateTime.Now.ToString("HH:mm:ss"), font, Color.White, 45, 15);

Run my emulator again and I have the time printed as well!

Now my AGENT Smart Watch has the time printed above the Binary Clock

The only real "microframework-ism" in the code is that the watch face doesn't want to use a lot of power, so you should "go to sleep." It's the same as if you were writing a console app. If your main() function ends, then your app will end! But, since this is a watch face, we want it to run all the time, so, we start a 1 second timer, then sleep the main() forever. Everything interesting happens as an event on a background thread. (The watch can control the lifetime and tombstone or kill the watch face if you're doing other things.)

public static void Main()
{
_bitmap = new Bitmap(Bitmap.MaxWidth, Bitmap.MaxHeight);
_font = Resources.GetFont(Resources.FontResources.small);

// display the time immediately
UpdateTime(null);

// set up timer to refresh time every minute
DateTime currentTime = DateTime.Now;
TimeSpan dueTime = new TimeSpan(0); // beginning of next minute
TimeSpan period = new TimeSpan(0, 0, 0, 1, 0); // update time every minute
_updateClockTimer = new Timer(UpdateTime, null, dueTime, period); // start our minute timer

_button = new InterruptPort(HardwareProvider.HwProvider.GetButtonPins(Button.VK_SELECT),
false,
Port.ResistorMode.PullDown,
Port.InterruptMode.InterruptEdgeBoth);
_button.OnInterrupt += _button_OnInterrupt;
// go to sleep; time updates will happen automatically every minute
Thread.Sleep(Timeout.Infinite);
}

That last part is interesting. You've got two event handlers here, the one to UpdateTime every second and then one to watch for the Button getting pressed. You want the watch app to be event-driven...it needs to do as little as possible NOTHING until it's time to do something. This InterruptPort is watching for the the middle button (the VK_SELECT button). ResisterMode.PullDown means the button will show "1" or true when it's pressed. InterruptEdgeBoth means I get events when the button is pressed AND when it goes up.

Go make Watch Apps!

Here's another cool watch face from Dylan Mazurek next to the Big Digits example:

PixelFace example Watch for AGENT Smart Watch BigDigits example Watch for AGENT Smart Watch

And finally, here's an animated concept for a World Time face that Steve Bulgin made for Pete Brown as well as another Steve concept below:

The next step will be more than watch faces, it will be watch utilities and apps. Maybe an app for my FitBit, or an app to manage Blood Sugar? Perhaps a Nest app to control my thermostat?

The AGENT Watch Emulator emulator will be available to download this Thursday at www.agentwatches.com. You can get ready by installing the .NET Micro Framework today.

Steve Bulgin watch face for the AGENT smart watchWatch apps can be written in C# using Microsoft Visual Studio 2012 (including the free Express edition). Deploy your apps over Bluetooth and debug them interactively.

Download Visual Studio Express 2012
Download .NET Micro Framework SDK v4.3

Developers can also use AGENT as a secondary display, interacting with it remotely via Bluetooth from their Objective-C, C#, or Java smartphone app.

Even though the watch ships in December, I'm going to start writing apps now so I'm ready for the Watch App Store (coming soon)!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Stop Doing Internet Wrong.

June 14, '13 Comments [151] Posted in Mobile | Musings
Sponsored By

Some days...some days it's frustrating to be on the web. We're compiling C++ into JavaScript and running Unreal in the browser but at the same time, here in 2013, we're still making the same mistakes. And by we, I mean, the set of web developers who aren't us, right Dear Reader? Because surely you're not doing any of these things. ;)

All of these are solvable problems. They aren't technically hard, or even technically interesting. I consider these "will-required" problems. You need the knowledge that it's wrong and the will to fix it. As users - and web developers - we need to complain to the right people and help fix it.

Redirecting a deep desktop link to a mobile home page

Google has decided that the practice of taking perfectly good deep links like foo.com/something/deep, detecting a mobile device, then redirecting to m.foo.com is user-hostile. In fact, the GoogleBot is going to declare these "faulty redirects" and ding sites in the search result ranking. Stated simply:

Avoiding irrelevant redirects is very easy: Simply redirect smartphone users from a desktop page to its equivalent smartphone-optimized page. If the content doesn't exist in a smartphone-friendly format, showing the desktop content is better than redirecting to an irrelevant page.

For example, if I want to go to the http://www.mcmenamins.com/Pubs page, but I do it on mobile, they ALWAYS redirect me to /mobile. Always. Even though I have a quad-processor pocket supercomputer with gigs of space I've still surfing a second-class internet.

image image

I don't want your crappy app

That means you Quora. I am in my browser, unless I'm going to the App Store, let's assume if I'm in the browser, I want to be on the web.

You suck Quora

Giant Interstitial Ads

I'm looking at you, Forbes.com. I GET IT. YOU HAVE ADS.

Interstitial Ads are Evil

Stay classy.

Labels for Input Forms

I hate seeing a checkbox and only being able to click on that exact checkbox.

<p>Which fruit would you like for lunch?</p>
<form>
<input type="radio" name="fruit" id="banana" />
<label for="banana">Banana</label>
<input type="radio" name="fruit" id="None" />
<label for="none">None</label>
</form>

It's so easy to just associate a label with an input. Please do  it, then we can all have something larger to click on.

Breaking Hyperlinks

We're still doing this. Haven't we learned that Cool URIs Don't Change? It was true in 1998 when that was written and it's true now. The web as we know it was created in 1990 and made truly open in 1993 and the link to the First Web Page (yes, Capital Letters) is still http://info.cern.ch/hypertext/WWW/TheProject.html. I love that they've done the work to keep that link alive.

There's just no excuse for this. With .htaccess files and web.config files, maintain a list of redirects and do your best to test them. Maintaining deep and complex links can be complex, but if you're companyname.com/about link dies because you switch from PHP to Rails, there's just no excuse for that. I'm your User and I have always typed /about. Don't' give me a To Do like "Update your bookmarks!" I didn't come here for a To-Do, I came her for your damn about page. YOU figure it out.

image

Click the Flag that represents your Language

I've often been asked to "select my language" from a list of country flags, and ended up clicking on the Union Jack to represent "English." I'm sure the actual English don't appreciate an American declaring they speak English. ;)

Nothing says pick a language like all the United Nations Flags

but I know I'm not the only one who realizes that a Flag is a lousy representation of a language, especially since your browser is announcing what languages you speak with every web request.

Accept:text/html
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8

There can be a whole list of languages in the Accept-Language header, in the order the user prefers them!  Use that data, it's there for you to use.

You know my Zip Code, why am I entering my State?

For folks living in the states, we're always asked to enter our postal code (ZIP code) and our city and state, even though there are dozens of great APIs and Databases that can give you that information.

Don't make me enter my state

The meta-point is this: If you can reliably determine something from the user (language, location, country, preference) without invading their privacy, do it! Save them a little time!

Resizing Giant Images with width and height attributes

Perhaps take a moment and remind your boss that the 6 megapixel photo that he or she took with their new Canon EOS is not a good background image for your corporate site...especially if it's a 4 megabyte JPGs.

Oh, that's OK, we can just <img src="bigassfile.jpg" width="100" height="100"> and that will make it smaller. No, that just downloads the giant file and then makes your browser do the work to resize it on the client.

Big ass picture

Resize first, and squish often. Also run all your PNGs through PNGGauntlet or PNGOut.

Serving pages from both www. and naked domains

If you've got example.com/something AND www.example.com/something both serving up the same content, consider "canonicalizing" your URLs. You can do this with rel="canonical" in your META tags, but that only hides the problems and makes the Googlebot happy. Instead, why not PICK ONE and serve a 301 redirect to the other? Did you know that there are rules built into IIS7 that will set this up for you? You can even remove your .aspx extension if that makes you happy. You can do it!

image

The same is true if you do the same thing for / and /default.html. Pick one if you can, and redirect the other.

<system.webServer>
<rewrite>
<rules>
<rule name="CanonicalHostNameRule1" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" matchType="Pattern" pattern="^hanselman\.com$" ignoreCase="true" negate="false" />
</conditions>
<action type="Redirect" url="http://www.hanselman.com/{R:1}" redirectType="Found" />
</rule>
<match url="blog/default.aspx" />
<action type="Redirect" url="blog/" redirectType="Found" />
</rule>
<rules>
<rewrite>
<system.webServer>

Others?

What are some great examples that you think Break The Internet...but that are easily fixed if we have the will?


Sponsor: Big thanks to RedGate for sponsoring the feed this week! Check out Deployment Manager – app deployment without the stress. Deploy .NET code & SQL Server databases in one simple processfrom a web-based UI. Works with local, remote and cloud servers. Try it free.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

The Importance of Closed Captioning - How To and Why Subtitle

June 12, '13 Comments [15] Posted in Musings | Tools
Sponsored By
Photo used by Creative Commons from http://www.flickr.com/photos/34547181@N00/6023268510/

If you can hear well, you may have never thought about Closed Captioning or Subtitles. Perhaps you've used it once or twice to catch a missed word in a movie, or perhaps you've only read subtitles in foreign movies. But if you're one of the nearly 10M hard of hearing folks in the US or one of as many (estimates vary widely) 70M profoundly deaf people in the world, it's not the subtitles you're concerned with...it's the lack of subtitles.

Automatic transcriptions are a start, but they are about as useful as automatic translation services. If you speak more than one language you'll agree that computer translation just isn't quite here yet. It's awesome that YouTube can attempt to auto-transcript English and it's an amazing piece of tech, but the results are sometimes ridiculous for any video content that isn't a news reader. Ultimately, today, automatic transcriptions are NOT a good answer.

animus fountains undertaking for a minute to first applebee's month second - These are BAD captions.Here's an example of some automatic captions from my 3 minute Windows 8 video:

Hanselminutes, my "fresh air for developers" podcast has long had transcripts available. Our transcription has been championed by Carl Franklin, my producer, and it IS appreciated. When a show is missed or we lag behind, people notice. You can head to our archives page, and the search supports a live-filter with an * as I've marked all transcript shows with an asterisk.

Transcripts aren't just for the hard of hearing, they are also great for folks who are learning English or people who would rather learn by reading than by listening. Not everyone has an hour to listen to a show, but they can check out the transcripts and decide if they want to bother. It also helps for SEO by allowing keywords in your podcast or video to be picked up by Google, Bing and other search engines. Often people at work want to watch a YouTube video without the volume on.

Hiring a Transcription Service

Transcribing isn't as easy as you'd think. People talk WAY faster than the average typist. Feel feel to try transcribing the news or a podcast yourself. You'll quickly find that it's hard damn work. The service that I use the most,with success, has been Rev.com. They used to be called FoxTranscribe and changed their name.

Ordering is easy, you can upload files or just paste in URLs. I recently had them transcribe my Productivity Talk by just giving them the Vimeo link.

Recently Rev transcribed both of my Windows 8 videos! Having good closed captioning is super important with YouTube videos, and people who are looking for subtitles are REALLY happy when they find good ones.

You can turn on Closed Captioning for YouTube videos as a permanent setting as well.

  1. Go to your Account Settings page
  2. Select Playback from the left-hand menu
  3. Check or uncheck Always show captions
    (Check Show automatic captions by speech recognition (when available) to enable automatic captions for videos that don't already have captions provided)

YouTube lets you add captions in a few ways.

Upload a Caption File and Auto-Sync

This is the easiest thing to do because it doesn't include time stamps. YouTube knows what video you're trying to caption so it can make educated guesses as to what words line up where. Time moves forward, so the guesses are usually VERY good if your transcript is a good one. That's what Rev.com provided me.

Here's the first section of what Rev.com gave me for the 25 minute Windows 8 Video:

Scott>> Hi. I'm Scott Hanselman. This is the Missing Windows 8 Instructional Video. I've got another video where I show you basically everything I'm going to show you in this video, except I do it in only four minutes. That might be great for techies or people who are kind of advanced. But for the rest of us, it's pretty intense and it looks a little frantic. I thought it would take some time to go through a number of things within Windows 8, like “What changed?”, “Who moved my cheese?”

See the double >> mark? That's where you indicate who is talking. And that's it! It's worked great and I'm thrilled with the result.

Upload a Caption File with Timestamps

If your video has fast cuts, lots of speakers or needs more precision, you'll want to make a a formal caption file in one of a variety of formats. A .srt file is what I see the most, but there's a number of options.

Here's a .srt example from Google:

1
00:00:00,599 --> 00:00:04,160
>> ALICE: Hi, my name is Alice Miller and this is John Brown
2
00:00:04,160 --> 00:00:06,770
>> JOHN: and we're the owners of Miller Bakery.

These files should be created by a captioning software package, in my opinion.

Regardless of how you create it, once the file is uploaded to YouTube, it works just as it should and can be turned on and off by the user.

Crowd Sourcing Transcripts

You may also be able to Crowd Source your transcripts. That's what I'm trying with This Developer's Life, the other podcast that I do with Rob Conery.

Yes, we are working on the next episode. I promise. The theme is "Space" by the way. Coming soon.

Since we have a primarily technical developer audience, I chose to use GitHub to manage things. It's very open, collaborative and clean...for a programmer. We're using Mark Down files and I hope to generate HTML and link to them directly from the This Developer's Life site. You're more than welcome to get involved and help out. There are still transcripts that need help! Check out https://github.com/shanselman/ThisDevelopersLife-Transcripts

We've just received the complete transcript from the TDL episode where my wife and I talk about our Cancer Year. That one is currently here and the actual episode is still on the TDL site.

We used a more casual layout, but I think the result will be easy to read.

Scott: What happened yesterday, dear?

Mo: Yesterday, I was told that I have cervical cancer.

S: That sucks.

M: Yeah. That REALLY sucks. [Silence] Yeah. It does. It does. Yeah.

S: We spent most of yesterday surprisingly not crying and wailing or gnashing our teeth... but rather with quite a bit of black humor. Wouldn't you say?

M: [Laughing] Yeah, I would. I would say that. But I think what is still true is that it’s a pretty heavy thing to hear. What was particularly frustrating in our case was how we found out about it. It was just not the way that one should ever find out that you have cancer. I don’t care what kind that it is.

S: It was definitely, as I like to say, sub-optimal.

M: Sub-optimal is a very delicate way of putting it. Yes, it was sub-optimal.

I REALLY appreciate all the love that the community has given Rob and I on This Developer's Life. It's a labor of love, it takes hours and hours to make an episode and I hope you know that we are still having fun making it. We thank YOU for helping with the captions! As they get closer to being done, I'll update the site and make them easier to find.

Collaborative Subtitling Systems

There is a great online community and series of tools called Amara that is explicitly for enabling captions for media. You can order transcription services outright, but you can also crowdsource your captions directly from the tool. If you're using YouTube you can give them access to your account via OAuth and they'll update your video's captions automatically. You can volunteer and transcript videos yourself and be a part of the crowd and make someone's video more accessible!

There are also some startups in the space like EnhanceCast and 3PlayMedia that you should also take a look at.

Regardless of what you choose, I really encourage you to consider captioning your content. We're working on doing this for ASP.NET videos now as well.

If you appreciate closed captioning and subtitles, please sound off in the comments!


Sponsor: Big thanks to RedGate for sponsoring the feed this week! Check out Deployment Manager – app deployment without the stress. Deploy .NET code & SQL Server databases in one simple processfrom a web-based UI. Works with local, remote and cloud servers. Try it free.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

CSI: Visual Studio - Unable to translate Unicode character at index X to specified code page

June 8, '13 Comments [17] Posted in Bugs
Sponsored By
A crazy internal error from Visual Studio

A customer emailed me a weird one. I tend to have a sense for when something is up and when an obscure thing will turn into something interesting.

The person says:

...mysteriously most of my projects refuse to build.  "The build stopped unexpectedly because of an internal failure... something about unicode... blah blah"

There are a few messages out there on the web about it -- even a really old hot fix.  What's the best way to proceed with the VS team / MS?  Is there anyone actively interested in glitches like this?

My spidey-sense is tingling. First, when something says "internal failure" it means some fundamental expectation wasn't met. Garbage in perhaps? He says "most of my projects" which implies it's not a specific project. There's also the sense that this is a "suddenly things stopped working" type thing. Presumably it worked before.

I say:

"Have you checked all the source files to make sure one isn't filled with Unicode nulls or something?"

And says no, but sends a call-stack (which is always nice when it's sent FIRST, but still):

Error    1    The build stopped unexpectedly because of an internal failure.
System.Text.EncoderFallbackException: Unable to translate Unicode character \uD97C at index 1321 to specified code page.
at System.Text.EncoderExceptionFallbackBuffer.Fallback(Char charUnknown, Int32 index)
at System.Text.EncoderFallbackBuffer.InternalFallback(Char ch, Char*& chars)
at System.Text.UTF8Encoding.GetByteCount(Char* chars, Int32 count, EncoderNLS baseEncoder)
at System.Text.UTF8Encoding.GetByteCount(String chars)
at System.IO.BinaryWriter.Write(String value)
at Microsoft.Build.BackEnd.NodePacketTranslator.NodePacketWriteTranslator.TranslateDictionary(Dictionary`2& dictionary, IEqualityComparer`1 comparer)
at Microsoft.Build.Execution.BuildParameters.Microsoft.Build.BackEnd.INodePacketTranslatable.Translate(INodePacketTranslator translator)
at Microsoft.Build.BackEnd.NodePacketTranslator.NodePacketWriteTranslator.Translate[T](T& value, NodePacketValueFactory`1 factory)
at Microsoft.Build.BackEnd.NodeConfiguration.Translate(INodePacketTranslator translator)
at Microsoft.Build.BackEnd.NodeProviderOutOfProcBase.NodeContext.SendData(INodePacket packet)
...

OK, so it doesn't like a character. But a character in WHAT? Well, we'd assume a source file, but it's important to remember that there's other pieces of input to a compiler like path names, environment variables, commands passed to the compiler as switches, etc.

It says Index 1321 which seems pretty far into a string before it gets mad. I asked a few people inside and Sara Joiner says:

It looks like the only place in BuildParameters that we call TranslateDictionary is when transferring the state of the environment [variables] across the wire. 

Ah, so this is splitting up name-value pairs that are the environment variables! David Kean says "ask him what his PATH looks like." I ask and I get almost 2000 bytes of PATH! It's a HUGE path, it looks like it may even have been duplicated and appended to itself a few times.

Here's just a bit of the PATH in question. See anything?

\;C:\PROGRA~1\DISKEE~1\DISKEE~1\;C:\Program Files (x86)\Windows Kits\8.0\Windows
Performance Toolkit\;C:\Program Files\Microsoft SQL
Server\110\Tools\Binn\;C:\Program Files\Microsoft\Web Platform
Installer\;C:\Program Files\TortoiseSVN\binVN\???p??;C:\Program
Files\TortoiseSVN\bin;C:\PHP\;C:\progra~1\NVIDIA
Corporation\PhysX\Common;C:\progra~2\Common Files\Microsoft Shared\Windows
Live;C:\progra~1\Common Files\Microsoft Shared\Windows
Live;C:\q\w32;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;
C:\Windows\System32\WindowsPowerShell\v1.0\;C:\progra~2\WIDCOMM\Bluetooth
Software\;C:\progra~2\WIDCOMM\Bluetooth

See those ??? marks? That doesn't feel like question marks to me. I open the result of "SET > env.txt" as a binary file in Visual Studio and it looks like it's 3Fs, which are ? marks.

I think the text file was converted to ANSI

This makes me think that there's unicode goo in the PATH that was converted to ANSI with it was piped. Phrased differently, this text file isn't reality.

However, elsewhere in the Windows UI his PATH variable looks like different.

C:\Program Files\TortoiseSVN\binVN\�侱ᤣp䥠؉;

Sometimes that corruption in the path looks like this and you might assume it's Chinese. No, it's corruption that's getting interpreted as Unicode. Interestingly the error said the naughty character was 0xD97C which is &#0xD97C; � which implies to me that something got stripped out at some point in processing and turned into the Unicode equivalent of 'uh...' Regardless, it's wrong and it needs to be removed.

I ask him if cleaning his PATH worked and the customer just send me a one line response via email...the best kind of response:

========== Build: 12 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

Yay! I hope this helps the next person who goes aGoogling for the answer and thought they were alone. Thanks to David Kean, Sara Joiner and Srinivas Nadimpalli for looking at the call stack and guessing at solutions with me!

Any insights, Dear Reader?


Sponsor: Big thanks to RedGate for sponsoring the feed this week! Check out Deployment Manager – app deployment without the stress. Deploy .NET code & SQL Server databases in one simple process from a web-based UI. Works with local, remote and cloud servers. Try it free.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.