Friday, December 28, 2012

Solved: "Prefix '..' does not map to a namespace" when binding to a custom dependency property

I quickly want to share some information about a strange error I got when binding to one of my dependency properties and how to solve it.

The error is a TypeNameParserException with the following additional information: Prefix 'dp' does not map to a namespace.

TypeNameParserException

I got this when binding to one of my dependency properties with namespace, like this:

<ContextMenu x:Key="contextMenu" Tag="{Binding PlacementTarget.(dp:MyClass.MyDependencyProperty), RelativeSource={RelativeSource Self}, Mode=OneWay}">

As you can see the element is a context menu (which is defined in a Resources section, don't know if this matters). And I am binding to the dependency property dp:MyClass.MyDependencyProperty of the context menu's PlacementTarget (PlacementTarget is the element the context menu is invoked for).

This binding caused the problem because as soon as I opened the context menu I got the TypeNameParserException. When I removed this binding the error went away.

So this lead to the error:
Binding PlacementTarget.(dp:MyClass.MyDependencyProperty)

(Note: there were no compiler warnings, no squiggly lines, everything seemed valid.)
After some fiddling and googling I found the solution.

This solved the error:
Binding Path=PlacementTarget.(dp:MyClass.MyDependencyProperty)

It's simple: you explicitly have to specify the Path part! See the difference? Let's highlight it a bit more:

Binding Path=PlacementTarget.(dp:MyClass.MyDependencyProperty)

Maybe this helps you when you get strange namespace-related errors.

Sunday, December 16, 2012

A Better ULS Log File Viewer

While analyzing SharePoint ULS logs I felt the need for a better ULS log viewer. With more capabilities than the existing ones 1, 2. I don't like them. They are either old, look ugly or don't provide the capabilities I need.

Time to create a better one. Time for Heu's ULS Viewer.

I will provide more information soon.
Update - Download Heu's ULS Viewer here.
Until then here are some teaser screenshots:

Main View
Main view of Heu's ULS Viewer

Features:
  1.  Support for multiple log files
    • file contents will be concatenated
    • Drag & Drop support
    • fast log file parsing
  2. Extended filtering capabilities
    • decide in which of the columns you want to filter
    • two different filter types; you can choose to include items matching your search term, or to exlude items matching it
  3. Grid view of all log entries
    • sort by clicking column header
    • fast sorting even for large data sets
    • select multiple rows and copy them to clipboard by pressing Ctrl+C (good for quickly pasting them to a mail or support ticket)
  4. Detailed display of selected log entry
    • multi-line log entries are merged to one
    • proper formatting of stack traces
Visualization

Visualization of message count over time

Visualizing SharePoint ULS log messages provides a general survey you don't easily get when looking at the raw log data. For now there are two series: one for the overall log message count (in blue) and one for the log messages with level "Unexpected" (in red).

The diagrams respect your current filters.

That's all for today. I hope you are as excited as I am. Stay tuned for more!

Saturday, December 15, 2012

Getting Shell Integration for TFS when using TFS Cloud Services and Visual Studio Express 2012

I recently started using Team Foundation Service 2012 in the cloud together with Visual Studio Express 2012 for Windows Desktop. The cloud service allows me to easily put my sources under version control and schedule automatic builds without having to set up any servers.

From TortoiseSVN I am used to access source control features from the context menu of files and folders. For instance I want to be able to add files to source control directly from the right-click menu.

This is possible. The short-named Microsoft Visual Studio Team Foundation Server 2012 Update 1 Power Tools contains a shell extension which does exactly that. Cool!

But my first attempt to install the Power Tools failed. It thought having Visual Studio Express installed would be enough. But apparently you first have to install Team Explorer for Microsoft Visual Studio 2012.

Having done this the Power Tools installation succeeds and you get the full context menu goodness:

TFS shell integration