> Does anybody know how to connect LinqBridge results with Results View?
If you add the internal SystemCore_EnumerableDebugView and
SystemCore_EnumerableDebugView<T> classes to the System.Linq
namespace, you will automatically get the results view in VS2008. For
example:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
namespace System.Linq
{
internal sealed class SystemCore_EnumerableDebugView
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private object[] cachedCollection;
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private int count;
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private IEnumerable enumerable;
public SystemCore_EnumerableDebugView(IEnumerable enumerable)
{
if (null == enumerable) throw new
ArgumentNullException("enumerable");
this.enumerable = enumerable;
}
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
public object[] Items
{
get
{
var list = new List<object>();
IEnumerator enumerator = this.enumerable.GetEnumerator();
if (enumerator != null)
{
this.count = 0;
while (enumerator.MoveNext())
{
list.Add(enumerator.Current);
this.count++;
}
}
this.cachedCollection = new object[this.count];
list.CopyTo(this.cachedCollection, 0);
return this.cachedCollection;
}
}
}
internal sealed class SystemCore_EnumerableDebugView<T>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private T[] cachedCollection;
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private int count;
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private IEnumerable<T> enumerable;
public SystemCore_EnumerableDebugView(IEnumerable<T> enumerable)
{
if (null == enumerable) throw new
ArgumentNullException("enumerable");
this.enumerable = enumerable;
}
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
public T[] Items
{
get
{
var list = new List<T>();
IEnumerator<T> enumerator = this.enumerable.GetEnumerator();
if (enumerator != null)
{
this.count = 0;
while (enumerator.MoveNext())
{
list.Add(enumerator.Current);
this.count++;
}
}
this.cachedCollection = new T[this.count];
list.CopyTo(this.cachedCollection, 0);
return this.cachedCollection;
}
}
}
}
If it doesn't work automatically, try adding DebuggerTypeProxy
attributes to the assembly:
[assembly:
DebuggerTypeProxy("System.Linq.SystemCore_EnumerableDebugView", Target
= typeof(System.Collections.IEnumerable))]
[assembly:
DebuggerTypeProxy("System.Linq.SystemCore_EnumerableDebugView<>",
Target = typeof(System.Collections.Generic.IEnumerable<>))]