I've written a guidance automation package based on the WCF service package provided for download but I've got a real problem with the type browser picker gadget :( This being the "..." that you should be able to click on when setting up a data contract or fault contract in order to select a data type for you member rather than having to type in the full name.
It doesn't matter what I do I just cannot get it to work. It throws an exception from the ReferencedAssemblies method as it is hard coded to do:
/// <summary>
/// Gets a collection of all assemblies referenced by the <see cref="T:System.Type"></see>. /// </summary> /// <value></value> /// <returns>A collection of all assemblies referenced by the <see cref="T:System.Type"></see>.</returns> public ICollection<Assembly> ReferencedAssemblies{
get { throw new Exception("The method or operation is not implemented."); }
}
I can't find any examples of how to use ITypeProvider like this which have the method ReferencedAssemblies in, i.e. they're all out of date. And the latest version of the package (September 2006) has the same issue.
I have tried replacing the hard coded exception with some code to retrieve assemblies referenced:
Assembly[] assemblyArray = AppDomain.CurrentDomain.GetAssemblies(); for (Int32 count = 0; count < assemblyArray.Length; count++){
Assembly assembly1 = assemblyArray[count];
tp.AddAssembly(assembly1);
}
return tp.ReferencedAssemblies;Where "tp" is the type provider which has been created by the class. But I still get a System.Exception thrown from some external code I cannot see. Very frustrating!
Has anyone out there managed to get the type browser working and if so, how
Thanks,
Sara

Has anyone got the "TypeBrowser" working?
Amjath
Hi Sara,
Yes, using the TypeBrowser assumes a dependency against .Net 3.0.
Let us know when if you hit some new issues.
-Victor.
ryan101
3jg1333
Hi David,
Thank you so much for your reply, I was begining to think that I was the only one trying to get this thing going from the silence my post generated. I'm in the same position, it's a really useful feature to have in the GAT package but only if it works properly.
It sounds like I'm going down the exact same path as you did, I've got as far as finding that it's the Workflow class that dies but I hadn't got as far as finding out exactly why. You've certainly solved that problem for me
. So ... as you seem to be far ahead of me on this and still hitting a dead-end I'll hang fire for the moment, if you don't mind, and see if you manage to get any success either from your dev contact or from your Redmond trip.
Thanks,
Sara.
Galoleins
Robert Gregory Garfinkle
Rattlerr
Sara_H,
I have been struggling with this issue for months. I have basically been ignoring it, hoping it would go away. No luck. Here is what I know and what I have tried - the exception is coming from the TypeBrowserDialog class in a WinFX workflow assembly. After Feb CTP bits, there was a check added for a null DesignerHost. There is no DeisgnerHost available in the GAT context, so the exception is thrown. I tried everything possible to get a reference to the DesignerHost, with now luck.
Then, I tried to manually load a referenence of the type myself (abandoning the workflow type browser). I could get at the appropriate project's bin\Debug version of the dll to load the type within the GAT context. However, once I did that to load the type, GAT kept the lib referenced and the solution could not be built. So, I spent about two days trying to load that assembly in another AppDomain so that I could unload it. I got all the way to the end of that process when I realized that you cannot marshall an instance of System.Type across app domain boundaries.
At my wits end, I tried the Sevice Factory BAT solution. Here's where it gets wierd. If I run their code on the same machine as my code, theirs' works, mine does not. It's the exact same code. I got my code from them. Through a couple of contacts, I got in touch with the tech lead on the Service BAT project in Patterns&Practices group. He suggested that the issue was that I was using a standard GAT wizard page and that I should migrate toa custom page, which they did shortly after the Sept. CTP of the Service BAT was released. He sent me the bits to try a custom page. I tried it and it did not work. I really don't think that's it anyway, because the version I have of the Service BAT (before the build he emailed me) used a standard page and it worked.
Then, I thought maybe it was the configuration on my machine. So, I tried a different machine. No dice. Still nothing. So, I now have two weeks to either solve the problem or remove the functionality from my GAT package. I am in contact still with the dev lead and I am telling him what I am experiencing. Hopefully, I will find an answer from him sometime this week. If not, I will probably abort for now, and then talk more in depth at the end of the month when I will be at Redmond for a couple of days.
So, I know I did not solve your problem, but I just wanted you to know that you are not alone in your situation and frustration. For a while, I thought it was something I was doing wrong. Anyway, I will post back here if I discover anything.
David
Tom Waters
I've actually gone ahead and hacked at the code until it worked. Download here: http://www.sitechno.com/Blog/ReusingTheWFTypeBrowserInYourApplications.aspx
Leave comment in the blogpost if you find it useful. Hope it works for you.
sapo
detzX
Hi Victor & David,
I've looked at the September release of the WCF guidance package again and having had a chance to actually install it and run it properly this time I've found that the TypeBrowser does actually work in this version. The reason I thought it wouldn't is because when I visually inspected the code the TypeBrowser class still has the hard coded exception thrown in it so obviously this bit of code is no longer being used. The custom wizard pages seem to be far more involved than previously too.
The upshot is that I think I'm going to wait until we switch to .Net 3.0 RTM (which I believe is needed to run the Sept WCF package) and then I'll reimplement my package customisations to work with this new code supplied with the Sept release. I think this will ultimately be the path of least resistance for getting the TypeBrowser working properly. Until then the developers will just have to type class names out in full rather than getting to pick them from a list.
Thanks for the help, no doubt I'll be back :)
Sara
Bobby Dreamer
In fact, that's where I started (on CodeProject) with the downloaded code.
I then moved to the Web Service Software Factory (WSSF) (per Daniel's suggestion) and got that to compile, but extracted the TypeBrowser stuff to a separate, smaller project to see if I could get it working there because I really don't know how the GAT stuff works. Unfortunately, every time I mark a property (either Type or String) as having the TypeBrowser editor, it blows up.
It always blows up after executing GetService on the ContextProxy, because it tries to instantiate a DummyDesignerHost (because the current Service type implements IDesignerHost).
I've stepped through the GetService method (it gets called a bunch of times) and it does in fact return the correct CustomTypeProvider at one point b/c the type does implement ITypeProvider. But it seems that this return type is too far down the recursive stack or something to actually pop out and be used. The code is executing editor.EditValue (which then executes GetService) is external so it's hard for me to really understand what is happening.
Am I missing something simple here
Here's an example of my applying the attribute to a property (where MyTypeBrowserEditor is really just the same TypeBrowser in the WSSF).
[TypeFilterProvider(typeof(WCFOperationContractArgumentFilter))]
[Editor(typeof(MyTypeBrowserEditor), typeof(UITypeEditor))]
public string DataContractType
{
get { return someType; }
set { someType = value; }
}
Thoughts
THX! Joel
XNAConfused
Did you guys could finally make this work If not, let me know and I'll ping a few people who could help.
thanks,
-Victor.
s441
itznfb
Looking through it I see that I'm getting to the TypeBrowserDialog of System.Component.Workflow so this seems at least partially right. I just don't know why my GetService method of ContextProxy loops so much and eventually creates the DummyDesignerHost. I don't want it to be the DummyDesignerHost
Any thoughts
TypeBrowserLibrary.dll!TypeBrowser.MyTypeBrowserEditor.DummyDesignerHost.GetDesigner(System.ComponentModel.IComponent component = { [System.Windows.Forms.PropertyGrid]}) Line 571 C#
> System.Design.dll!System.ComponentModel.Design.TypeDescriptorFilterService.GetDesigner(System.ComponentModel.IComponent component) + 0x48 bytes
System.Design.dll!System.ComponentModel.Design.TypeDescriptorFilterService.System.ComponentModel.Design.ITypeDescriptorFilterService.FilterAttributes(System.ComponentModel.IComponent component, System.Collections.IDictionary attributes = Count = 16) + 0x1b bytes
System.dll!System.ComponentModel.TypeDescriptor.PipelineFilter(int pipelineType = 0, System.Collections.ICollection members, object instance, System.Collections.IDictionary cache = Count = 0) + 0x1fd bytes
System.dll!System.ComponentModel.TypeDescriptor.GetAttributes(object component, bool noCustomTypeDesc) + 0x9a bytes
System.dll!System.ComponentModel.TypeDescriptor.GetAttributes(object component) + 0x7 bytes
System.Design.dll!System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.ModifiersExtenderProvider.CanExtend(object o) + 0x3a bytes
System.dll!System.ComponentModel.ReflectTypeDescriptionProvider.GetExtenders(System.Collections.ICollection components = {Dimensions:
System.dll!System.ComponentModel.ReflectTypeDescriptionProvider.GetExtendedProperties(object instance) + 0xc1 bytes
System.dll!System.ComponentModel.TypeDescriptor.TypeDescriptionNode.DefaultExtendedTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetProperties() + 0x25 bytes
System.dll!System.ComponentModel.TypeDescriptor.TypeDescriptionNode.DefaultExtendedTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetProperties() + 0x42 bytes
System.dll!System.ComponentModel.TypeDescriptor.GetPropertiesImpl(object component = { [System.Windows.Forms.PropertyGrid]}, System.Attribute[] attributes = null, bool noCustomTypeDesc, bool noAttributes) + 0xea bytes
System.dll!System.ComponentModel.TypeDescriptor.GetProperties(object component) + 0xb bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.SetBounds(System.Drawing.Rectangle bounds, System.Windows.Forms.BoundsSpecified specified = None) + 0x195 bytes
System.Windows.Forms.dll!System.Windows.Forms.Layout.DefaultLayout.xLayoutDockedControl(System.Windows.Forms.Layout.IArrangedElement element, System.Drawing.Rectangle newElementBounds, bool measureOnly, ref System.Drawing.Size preferredSize, ref System.Drawing.Rectangle remainingBounds) + 0x3a bytes
System.Windows.Forms.dll!System.Windows.Forms.Layout.DefaultLayout.LayoutDockedControls(System.Windows.Forms.Layout.IArrangedElement container, bool measureOnly = false) + 0x41f bytes
System.Windows.Forms.dll!System.Windows.Forms.Layout.DefaultLayout.xLayout(System.Windows.Forms.Layout.IArrangedElement container = {TabPage: {Advanced}}, bool measureOnly = false, out System.Drawing.Size preferredSize = {Width = -7103 Height = -7105}) + 0x134 bytes
System.Windows.Forms.dll!System.Windows.Forms.Layout.DefaultLayout.LayoutCore(System.Windows.Forms.Layout.IArrangedElement container, System.Windows.Forms.LayoutEventArgs args) + 0x19 bytes
System.Windows.Forms.dll!System.Windows.Forms.Layout.LayoutEngine.Layout(object container, System.Windows.Forms.LayoutEventArgs layoutEventArgs) + 0x19 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.OnLayout(System.Windows.Forms.LayoutEventArgs levent) + 0x78 bytes
System.Windows.Forms.dll!System.Windows.Forms.ScrollableControl.OnLayout(System.Windows.Forms.LayoutEventArgs levent) + 0x49 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.PerformLayout(System.Windows.Forms.LayoutEventArgs args) + 0xa7 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.PerformLayout() + 0x13 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.ResumeLayout(bool performLayout = true) + 0x80 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.Scale(float dx, float dy) + 0x59 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.ScaleCore(float dx, float dy) + 0x15f bytes
System.Windows.Forms.dll!System.Windows.Forms.TabControl.ScaleCore(float dx, float dy) + 0x19 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.Scale(float dx, float dy) + 0x37 bytes
System.Windows.Forms.dll!System.Windows.Forms.Form.ScaleCore(float x = 1.0, float y = 1.15692317) + 0x194 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.Scale(float dx, float dy) + 0x37 bytes
System.Windows.Forms.dll!System.Windows.Forms.Form.ApplyAutoScaling() + 0x104 bytes
System.Windows.Forms.dll!System.Windows.Forms.Form.OnLoad(System.EventArgs e = {System.EventArgs}) + 0xe3 bytes
System.Workflow.ComponentModel.dll!System.Workflow.ComponentModel.Design.TypeBrowserDialog.OnLoad(System.EventArgs e) + 0x1c bytes
System.Windows.Forms.dll!System.Windows.Forms.Form.OnCreateControl() + 0x52 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.CreateControl(bool fIgnoreVisible) + 0x172 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.CreateControl() + 0x1b bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.WmShowWindow(ref System.Windows.Forms.Message m) + 0x8e bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) + 0x70b bytes
System.Windows.Forms.dll!System.Windows.Forms.ScrollableControl.WndProc(ref System.Windows.Forms.Message m) + 0x45 bytes
System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.WndProc(ref System.Windows.Forms.Message m) + 0x13 bytes
System.Windows.Forms.dll!System.Windows.Forms.Form.WmShowWindow(ref System.Windows.Forms.Message m) + 0x3e bytes
System.Windows.Forms.dll!System.Windows.Forms.Form.WndProc(ref System.Windows.Forms.Message m) + 0x230 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref System.Windows.Forms.Message m) + 0xd bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m) + 0xd6 bytes
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr hWnd, int msg = 24, System.IntPtr wparam, System.IntPtr lparam) + 0x75 bytes
[Native to Managed Transition]
[Managed to Native Transition]
System.Windows.Forms.dll!System.Windows.Forms.Control.SetVisibleCore(bool value = true) + 0x125 bytes
System.Windows.Forms.dll!System.Windows.Forms.Form.SetVisibleCore(bool value = true) + 0xb7 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.Visible.set(bool value) + 0xe bytes
System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(int reason = 4, System.Windows.Forms.ApplicationContext context = {System.Windows.Forms.Application.ModalApplicationContext}) + 0x1b2 bytes
System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoop(int reason, System.Windows.Forms.ApplicationContext context) + 0x53 bytes
System.Windows.Forms.dll!System.Windows.Forms.Form.ShowDialog(System.Windows.Forms.IWin32Window owner) + 0x4ee bytes
Microsoft.VisualStudio.dll!Microsoft.VisualStudio.UIService.System.Windows.Forms.Design.IUIService.ShowDialog(System.Windows.Forms.Form form = { [System.Workflow.ComponentModel.Design.TypeBrowserDialog], Text: Browse and Select a .NET Type}) + 0x76 bytes
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.PropertyGridView.ShowDialog(System.Windows.Forms.Form dialog) + 0x169 bytes
System.Workflow.ComponentModel.dll!System.Workflow.ComponentModel.Design.TypeBrowserEditor.EditValue(System.ComponentModel.ITypeDescriptorContext typeDescriptorContext = {TypeBrowser.MyTypeBrowserEditor.ContextProxy}, System.IServiceProvider serviceProvider, object value) + 0x333 bytes
TypeBrowserLibrary.dll!TypeBrowser.MyTypeBrowserEditor.EditValue(System.ComponentModel.ITypeDescriptorContext context = {System.Windows.Forms.PropertyGridInternal.PropertyDescriptorGridEntry DataContractType}, System.IServiceProvider provider = {System.Windows.Forms.PropertyGridInternal.PropertyDescriptorGridEntry DataContractType}, object value = null) Line 93 + 0x16 bytes C#
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.GridEntry.EditPropertyValue(System.Windows.Forms.PropertyGridInternal.PropertyGridView iva = {System.Windows.Forms.PropertyGridInternal.PropertyGridView}) + 0x4c bytes
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.PropertyDescriptorGridEntry.EditPropertyValue(System.Windows.Forms.PropertyGridInternal.PropertyGridView iva) + 0x13 bytes
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.PropertyGridView.PopupDialog(int row) + 0x703 bytes
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.PropertyGridView.OnBtnClick(object sender, System.EventArgs e) + 0x87 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.OnClick(System.EventArgs e) + 0x57 bytes
System.Windows.Forms.dll!System.Windows.Forms.Button.OnClick(System.EventArgs e) + 0x49 bytes
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.DropDownButton.OnClick(System.EventArgs e) + 0xe bytes
System.Windows.Forms.dll!System.Windows.Forms.Button.OnMouseUp(System.Windows.Forms.MouseEventArgs mevent = {X = 9 Y = 9 Button = Left}) + 0xc3 bytes
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.DropDownButton.OnMouseUp(System.Windows.Forms.MouseEventArgs e) + 0xe bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.WmMouseUp(ref System.Windows.Forms.Message m, System.Windows.Forms.MouseButtons button, int clicks) + 0xf2 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) + 0x544 bytes
System.Windows.Forms.dll!System.Windows.Forms.ButtonBase.WndProc(ref System.Windows.Forms.Message m) + 0xce bytes
System.Windows.Forms.dll!System.Windows.Forms.Button.WndProc(ref System.Windows.Forms.Message m) + 0x2b bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref System.Windows.Forms.Message m) + 0xd bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m) + 0xd6 bytes
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr hWnd, int msg = 514, System.IntPtr wparam, System.IntPtr lparam) + 0x75 bytes
Iris Stern
http://www.clariusconsulting.net/blogs/kzu/archive/2006/01/07/WFTypeBrowser.aspx