Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

XmlSchemaException in App.config using UIP Application Block

Does anyone know why I might be getting an XmlSchemaException in App.config configured as below to use the UIP Application Block?

I get the following error for every sub-element and attribute
within the <uipConfiguration> element:

Message 1 Could not find schema information for the element
'uipConfiguration'.
Message 2 Could not find schema information for the element 'objectTypes'.
Message 3 Could not find schema information for the element 'iViewManager'.
... etc. etc.

My App.config file:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="uipConfiguration"
type="Microsoft.ApplicationBlocks.UIProcess.UIPConfigHandler,
Microsoft.ApplicationBlocks.UIProcess,
Version=1.0.1.0,
Culture=neutral,
PublicKeyToken=null"
/>
</configSections>
<uipConfiguration>
<objectTypes>
<iViewManager
name="WindowsFormViewManager"
type="Microsoft.ApplicationBlocks.UIProcess.WindowsFormViewManager,
Microsoft.ApplicationBlocks.UIProcess,
Version=1.0.1.0,
Culture=neutral,
PublicKeyToken=null"
/>
<state
name="TestState"
type="PresentationLayer.TestState,
PresentationLayer,
Version=null,
Culture=neutral,
PublicKeyToken=null"
/>

<controller
name="TestController"
type="Common.TestController,
Common,
Version=null,
Culture=neutral,
PublicKeyToken=null"
/>
<statePersistenceProvider
name="IsolatedStoragePersistence"
type="Microsoft.ApplicationBlocks.UIProcess.IsolatedStoragePersistence,
Microsoft.ApplicationBlocks.UIProcess,
Version=1.0.1.0,
Culture=neutral,
PublicKeyToken=null"
/>

</objectTypes>
<views>
<view
name="TestView"
type="PresentationLayer.TestView,
PresentationLayer,
Version=null,
Culture=neutral,
PublicKeyToken=null"
controller="TestController"
stayOpen="true"
floatable="true"
/>

</views>
</uipConfiguration>
<system.diagnostics>
<sources>
<!-- This section defines the logging configuration for
My.Application.Log -->
<source name="DefaultSource" switchName="DefaultSwitch">
<listeners>
<add name="FileLog"/>
<!-- Uncomment the below section to write to the Application Event Log
-->
<!--<add name="EventLog"/>-->
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSwitch" value="Information" />
</switches>
<sharedListeners>
<add name="FileLog"
type="Microsoft.VisualBasic.Logging.FileLogTraceListener,
Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
initializeData="FileLogWriter"/>
<!-- Uncomment the below section and replace APPLICATION_NAME with the
name of your application to write to the Application Event Log -->
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener"
initializeData="APPLICATION_NAME"/> -->
</sharedListeners>
</system.diagnostics>

</configuration>

The exception is thrown in UIPConfigHandler.cs at the statement:

validatingReader.Schemas.Add( XmlSchema.Read( new XmlTextReader( streamReader ), null ) );

If you don't know why the exception is thrown maybe you could suggest a way to narrow down the possible cause or know any further information I could provide to help answer this question?

Thanks v. much!
Mark
[4134 byte] By [mjtech] at [2007-11-11 8:13:59]
# 1 Re: XmlSchemaException in App.config using UIP Application Block
Having looked at the UIP code, that is weird. It's just the XSD validation failing for some reason. Some possibilities to look at:

1. The XSD (UIPConfigSchema.xsd) may not be embedded in your UIP DLL. Make sure it has been compiled as an embedded resource.

2. Try running one of the sample apps with your build of UIP - that might tell you more.

HTH,
Kent
kentcb at 2007-11-11 21:47:54 >
# 2 Re: XmlSchemaException in App.config using UIP Application Block
Thanks, Kent.

You may be onto something there. I built the UIProcess.dll with Visual C# 2005 Express Edition. Listed in the solution explorer is the UIPConfigSchema.xsd but a tree sub-menu item under this called "UIPConfigSchema.xsx" has a warning triangle beside it (see image attached) and upon trying to open this file an alert appears that states:

The item 'UIPConfigSchema.xsx' does not appear in the project directory. It may have been moved, renamed or deleted.

I don't know what this means or if it is significant.

I only use Visual C# 2005 Express Edition which had to upgrade the UIProcess solution in order to open it (although there were no errors reported maybe it got messed up). This is the only version I have at the moment but perhaps it only works properly with VS 2003? I'd be curious to know if anyone has built the UIP in 2005 EE and it worked OK.

What about if I obtained a pre-compiled UIProcess.dll from somewhere else and used that?

Thanks
Mark
mjtech at 2007-11-11 21:48:52 >
# 3 Re: XmlSchemaException in App.config using UIP Application Block
No problem Mark. Yes, you could try a pre-built version first to verify the issue. Also, try right-clicking the XSD file and selecting properties. Make sure the build action is "Embedded Resource".

I believe the XSX file is just so the designer can keep track of where objects in the XSD have been dragged etcetera.

HTH,
Kent
kentcb at 2007-11-11 21:49:51 >
# 4 Re: XmlSchemaException in App.config using UIP Application Block
I tried using a pre-built dll and also the XSD file's build action is "Embedded Resource". I am, for the moment, completely stuck as to how to overcome this impasse. I wonder if anyone else has got the UIPAB2 to work with the Visual Express Editions?

Do you know which version of Visual Studio the UIPAB 2.0 was designed to work with - 2003 or 2005? I would have thought anything that works in 2005 works with the 2005 Express Editions too but I always have to convert the solutions before I can open them in the EEs.

Oh, and I forgot to mention last time that the QuickStart samples have the same problems too (referencing the same UIProcess.dll as my own project).

I'm looking at your Ingenious MVC right now. I'd still like to get this to work, though, as I think this problem must be solvable somehow.

Thanks.
Mark
mjtech at 2007-11-11 21:50:51 >
# 5 Re: XmlSchemaException in App.config using UIP Application Block
This thread here (http://forums.asp.net/1081395/ShowPost.aspx) indicates that .NET 2.0 handles XML or configs in a different way to .NET 1.1 and as the UIPAB was built for .NET 1.1 this was the source of the XmlSchemaException.

I don't completely understand what the problem was but commenting out the offending line in the UIPConfigSchema.xsd, as advised, seems to have done the trick :)

There very well be more compatility problems as the UIPAB 2.0 reference states as a system requirement .NET 1.1.

UIPAB 2.0 needs to be updated for .NET 2.0. Hopefully, the patterns team will move on this soon.
mjtech at 2007-11-11 21:51:56 >