madskristensen/WebEssentials2013 — pull request #826 by am11 (2014-03-30 17:39:52+00:00)
Title: CSS: Update B64-URI with fallback URL. (#607) --- { DON'T MERGE }

New disable-able feature added for #607:

**Description:**

When we use the CSS smart tag "Embed as base64 dataUri", to transform the image URL to its B64 counter-part, it generates a fallback declaration for IE6 and 7. For instance:

```css
background: url('data:text/plain;base64,XXXXXYYYYYZZZZ=') /*../Capture.PNG*/ 0 0;
*background: url('../Capture.PNG') 0 0; /* For IE 6 and 7 */
```

With this feature, changing `Capture.PNG` in above example will automagically update the dtat-URI and the link in comment.

---

@spadapet,

It works well, except for the first time it throws an internal exception dialog. Subsequently, after Ok'ing this dialog, it never shows again throughout the session (until new solution is loaded).

The activity log shows

```xml
Editor or Editor Extension
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: span
at Microsoft.VisualStudio.Text.SnapshotSpan..ctor(ITextSnapshot snapshot, Span span)
at Microsoft.CSS.Editor.CssClassifier.OnTreeItemsChanged(Object sender, CssItemsChangedEventArgs eventArgs)
at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
at Microsoft.CSS.Core.CssTree.FireOnItemsChanged(ParseItemList deletedItems, ParseItemList insertedItems, ParseItemList errorsChangedItems)
at Microsoft.CSS.Core.CssTree.OnTextChange(ITextProvider fullNewText, Int32 changeStart, Int32 deletedLength, Int32 insertedLength)
at Microsoft.CSS.Editor.CssEditorDocument.OnTextBufferChanged(Object sender, TextContentChangedEventArgs eventArgs)
at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.RaiseEvent[TArgs](Object sender, EventHandler`1 eventHandlers, TArgs args)
```

If I comment Line 182, https://github.com/am11/WebEssentials2013/commit/51a4dc19c645d13916aead665cd23090bb1be81c#diff-00aefb51dd4d31ae7e5d08d7d8ee2a66R181, the exception is gone, but then it doesn't update the b64 dataUri (only the comment).

Can we suppress this first-run exception?