.NET Forum / Visual Studio.NET / IDE / March 2008
XAML Designer "unable to load" problem
|
|
Thread rating:  |
Jim Hudson - 07 Mar 2008 15:23 GMT I have VS.Net 2008 Team System installed on Vista/64 w/ SP1 installed. I'm building a WPF application (lots of <Pages>, <Windows>, <UserControls>, etc.). I cannot get the XAML Designer window to display ANY of my XAML files - in all cases, it displays "An Unhandled Exception has occured" in the designer pane in VS.Net. The details of the exception are:
Could not load file or assembly 'Waters.Capture.FCME, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9248a9e9e65bdbea' or one of its dependencies. The system cannot find the file specified.
Apparently, whatever is causing the Designer to fail to display also causes the XAML IntelliSense to fail, too, because I don't get IntelliSense for any of my XAML files.
We have a little C# program here that will load a given DLL, and then chase down all of the dependencies and print a little report. It CAN load my Waters.Capture.FCME.dll file, and it CAN find all of the dependencies. I get no errors on my build. When I run my application, the UI that's defined in this DLL loads and runs fine.
I'd REALLY like to get the XAML Designer and IntelliSense working. Any suggestions?
 Signature Jim Hudson
Jim Hudson - 07 Mar 2008 15:43 GMT I've found a clue that may shed some light on this problem. As I started to build my next <Window> object, I noticed that the XAML designer initially DID display properly. It continued to display properly, UNTIL I put the following attribute into my <Window> element:
xmlns:com="clr-namespace:Waters.Capture.Common"
Note that Waters.Capture.Common is one of the other projects in my solution, and is specified as a reference in the project containing this <Window>.
I also notice that I can use the other specifications for XML namespaces in my <Window> (e.g., xmlns:wat="http://www.waters.com/CoreUI/Controls" is OK) - it's only the clr-namespace form that causes the problem.
What can I do to get the XAML designer to accept the clr-namespace form?
 Signature Jim Hudson
Wen Yuan Wang [MSFT] - 10 Mar 2008 10:40 GMT Hello Jim,
According to your description, XAML Designer stop working when you put the clr-namespace attribute into <Window> element, correct? Please don't hesitate to correct me if I misunderstood anything here.
For CLR namespace, you have to specify the ASSEMBLY which contains the referenced CLR namespace in the attribute. For example: xmlns:custom="clr-namespace:SDKSample;assembly=SDKSampleLibrary"
You may like to refer to the following document for detailed information about namespace mapping. http://msdn2.microsoft.com/en-us/library/ms747086.aspx [XAML Namespaces and Namespace Mapping]
Hope this helps. Please try the above method and let me know if this works. We are glad to assist you.
Have a great day, Best regards, Wen Yuan
Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: msdnmg@microsoft.com.
================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscriptions/support/default.aspx. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
Jim Hudson - 10 Mar 2008 18:55 GMT Thanks for the reply, Wen Yuan.
1) Yes, you understood correctly. 2) I get the same behavior ("Could not load file or assembly ...") whether I specify the xmlns attribute WITH ";assembly=xxx" or WITHOUT it.
And, to reiterate: the assembly is in my \bin directory, it can be loaded explicity by a little test C# app, and it displays correctly when my application runs.
 Signature Jim Hudson
Wen Yuan Wang [MSFT] - 11 Mar 2008 13:58 GMT Hello Jim, Thanks for your reply.
But I cannot reproduce the issue on my side so far. I created a WPF Control Library project named "Waters.Capture.FCME", added reference to this library in my WPF Project. In window tag, I defined my namespace as "xmlns:my="clr-namespace:Waters.Capture.FCME;assembly=Waters.Capture.FCME". It really works fine on my side. I didn't get any error message, and IntelliSense work fine. If I type "my" in window tag, it will prompt "CustomControl1".
Could you let me know how did you specify the xmlns attribute? Is it "xmlns:my="clr-namespace:Waters.Capture.FCME;assembly=Waters.Capture.FCME"?
By the way, is it possible for you to provide some repro steps? This will help on research very much.
Best regards, Wen Yuan Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: msdnmg@microsoft.com. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
Jim Hudson - 12 Mar 2008 13:59 GMT Thanks for trying, Wen Yuan. I have several little prototype C# applications that I've built recently, and (like you) clr-namespace works fine in all of them. My production application is part of a much larger system of VS.Net projects and I cannot send it to you.
We use the clr-namespace variation of the xmlns attribute in two ways:
1) To reference classes defined within the same assembly as the XAML <Page>/<Window>. In that case, we use the simple form of xmlns. 2) To reference classes defined within other assemblies. In that case, we use the assembly= form of xmlns.
One thing that is particularly aggravating is that I get the following errors when I use the assembly= form of xmlns. What happens is that the XAML file compiles fine. I get "Build succeeded" a there are no errors in th Output window. However, when the XAML designer attempts to load the XAML file, it gets the following two errors:
Assembly 'Waters.AnalyticalFW.Methods.Client' was not found. Verify that you are not missing an assembly reference. Also, verify that your project and all referenced assemblies have been built. The type 'afwm:DataTreeControl' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.
Is there any way to get the XAML designer to emit a diagnostic/debugging logfile, so that I can try to fix this?
Thanks, again.
 Signature Jim Hudson
Wen Yuan Wang [MSFT] - 13 Mar 2008 11:11 GMT Hello Jim,
Thanks for your reply. That's really strange... XAML file compiles fine in VS 2008, but XAML Designer complains that reference class doesn't exist.
According to your description, it seems VS IDE cannot find the reference assembles in Designer mode. To resolve this issue, we have to know the file location where VS XMAL Designer tried to query, then we can check if the assemble exists. VS IDE doesn't output such log file. I suggest you may use "Process Monitor" to troubleshooting such issue. Process Monitor is a free advanced monitoring tool for Windows that shows real-time file system, Registry and process/thread activity. You can free download it at http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx [Process Monitor v1.26]
After included "Devenv.exe" process in Process Monitor, you can get a list include Operation,path,result,detail information that VS IDE tried to do on your windows System. You can search "Waters.AnalyticalFW.Methods.Client" keyword in the list. I think we will get some clue from the result.
Hope this helps. Please try the above method and let me know if there is anything more information. We are glad to assist you.
Have a great day, Best regards,
Wen Yuan Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: msdnmg@microsoft.com. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
Jim Hudson - 13 Mar 2008 20:55 GMT Well, I'm a step closer, now. We use a CM tool here, which normally results in our source-code residing in a directory with a name like "C:\CaptureGroupUS1#hudsonj_1.0.2\CaptureGroup\Waters.Capture.FCME". When I looked through the ProcessMonitor output, I noticed that the "#" in the top-level foldername was causing problems. I changed the name of the top-level folder and XAML Designer started loading. HOORAY!!! Would you please tell the WPF development folks that they have a bug?
However, I'm still not "out of the woods". We have various DLLs that define ResourceDictionaries - specifically, ResourceDictionaries full of <Style> resources. I still get errors, related to those styles. For example:
<Window x:Uid="Window_1" x:Class="Waters.Capture.FCME.RenameAgentDialog" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ws="http://www.waters.com/CoreUI/Controls;assembly=Waters.UI.WatStyle"> <Window.Resources> . . . <Style x:Uid="Style_3" x:Key="labelStyle" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource Dialog.TextBoxLabel.Font}"> <Setter x:Uid="Setter_4" Property="Background" Value="{StaticResource Dialog.TextBox.BackgroundBrush}"/> </Style>
I get a "StaticResource reference 'Dialog.TextBoxLabel.Font" was not found." error when I try to display this <Window> in the XAML Designer. I tried changing the BasedOn to DynamicResource, but that's not supported. I can't find anything in MSDN that will tell me how to specify the BasedOn StaticResource so that the XAML Designer will find it.
Got any ideas?
 Signature Jim Hudson
Wen Yuan Wang [MSFT] - 14 Mar 2008 10:37 GMT Hello Jim, Thanks for your reply.
It sounds like a product issue. VS XAML Designer could not work fine with "#". Removing ther charater resolves the issue. I will log this issue in our DB for product team to investigate. This will benefit our product quality improvement. Thanks for your investigat. However, please understood this's the first verion XAML Designer for WPF Project. It's not very strong. Project team are hard working on impoving it now. They may need more time. By the way, you can also post the issue to our Connect feedback portal, if you want to communicate with product developers directly on the issue. http://connect.microsoft.com/VisualStudio/ Improving the quality of our products and services is a never ending process for Microsoft .
Regard to the style issue, could you let me know does it work fine in run time? This information help on narrow the issue. We can know whether this is a designer issue or not. Moreover, I'm not sure how did you define the style on "Dialog.TextBox.BackgroundBursh"? is it possible for you to paste some code snippet? Thereby we can reproduce the issue on our side.
Please feel free to let me know if you have any more concern. We are glad to assist you.
Have a great day, Best regards, Wen Yuan
Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: msdnmg@microsoft.com. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
Jim Hudson - 14 Mar 2008 13:26 GMT As for the "# in the path" problem, all I ask is what you've already done: post the issue in your DB. It's easy for me to reconfigure our CM tool to avoid the "#" characters, so I don't need any immediate response from Microsoft.
As for the ResourceDictionary/style issue, I should have included the code in my previous post. The ResourceDictionay is in that Waters.UI.WatStyle DLL. The DLL is constructed from a set of XAML files. The "root" is WatStyle.xaml:
<ResourceDictionary x:Uid="UserControl_1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:Waters.UI;assembly=Waters.UI.WatStyle"> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="BrushStyles.xaml"/> <ResourceDictionary Source="TextStyles.xaml"/> <ResourceDictionary Source="ControlStyles.xaml"/> </ResourceDictionary.MergedDictionaries> . . .
The TextStyles.xaml file is as follows:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ws="clr-namespace:Waters.UI.WatStyle"> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="TextStyles\CollectionPanelTextStyles.xaml"/> <ResourceDictionary Source="TextStyles\DialogBoxTextStyles.xaml"/> . . .
That Dialog.TextBoxLabel.Font that's mentioned in the error is inside DialogBoxTextStyles.xaml:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > . . . <Style x:Key="Dialog.TextBox.Font"> <Setter Property="Control.FontSize" Value="11" /> <Setter Property="Control.FontWeight" Value="Normal" /> <Setter Property="Control.FontFamily" Value="SegoeUI" /> <Setter Property="Control.Foreground" Value="#000000" /> </Style>
</ResourceDictionary>
Let me know if you figure anything out.
As always: thanks!!!
 Signature Jim Hudson
Wen Yuan Wang [MSFT] - 18 Mar 2008 09:11 GMT Hello Jim, Thanks for your reply.
It sounds what you need is to reference to style which defined in Referenced Assembly Resource File. If I misunderstood anything, please don't hesitate to correct me.
In order to achieve that goal, you have to Use Pack URIs. I didn't found any entry in your code snippet. Did you miss it? Maybe this is the reason why VS IDE complains it couldn't found related style. For example: <ResourceDictionary Source="pack://application:,,,/Waters.Capture.FCME;component/TextStyles/Dial ogBoxTextStyles.xaml"></ResourceDictionary>
More detailed information about Packing URLs in WPF, you may check out the following article. http://msdn2.microsoft.com/en-us/library/aa970069.aspx [Pack URIs in Windows Presentation Foundation]
Hope this helps. Please feel free to let me know if there is anything unclear. We are glad to assist you.
Best regards, Wen Yuan Microsoft Online Community Support Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: msdnmg@microsoft.com. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
Jim Hudson - 18 Mar 2008 15:56 GMT That was it, Wen Yuan.
Thank you, once again for all your help!!!!
 Signature Jim Hudson
Wen Yuan Wang [MSFT] - 19 Mar 2008 09:09 GMT The pleasure is all mine. :)
Have a great day, Best regards, Wen Yuan Microsoft Online Community Support Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: msdnmg@microsoft.com. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|