Home All Groups Group Topic Archive Search About

XmlSchemaException in App.config using UIP Application Block

Author
13 Mar 2006 5:08 PM
SparkPlug
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 element, 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="BusinessLayer.TestState, BusinessLayer,
                Version=null,
                Culture=neutral,
                PublicKeyToken=null"
        />

            <controller
                name="TestController"
                type="PresentationLayer.Controllers.TestController,
                SBMPresentationLayer,
                Version=1.0.1.0,
                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.Views.TestView,
                PresentationLayer,
                Version=null,
                Culture=neutral,
                PublicKeyToken=null"
                controller="TestController"
                stayOpen="true"
                floatable="true"
        />

        </views>
        <!--
    <sharedTransitions>
    </sharedTransitions>
    -->
        <!--
    <navigationGraph>
    </navigationGraph>
    -->
        <!--
    <uipWizard>
    </uipWizard>
    -->
        <!--
    <userControls>
    </userControls>
    -->
    </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>



Thanks

Author
14 Mar 2006 1:24 AM
Zafar Abbas
These are validation errors, are you trying to validate your file or just
parse it. If you dont need validation, turn validation off when you create
the validating reader in .NET.

Zafar


Show quote
"SparkPlug" <SparkP***@discussions.microsoft.com> wrote in message
news:50450B7E-1A91-4F0A-9D2B-0EC804827A63@microsoft.com...
> 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 element, 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="BusinessLayer.TestState, BusinessLayer,
> Version=null,
> Culture=neutral,
> PublicKeyToken=null"
> />
>
> <controller
> name="TestController"
> type="PresentationLayer.Controllers.TestController,
> SBMPresentationLayer,
> Version=1.0.1.0,
> 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.Views.TestView,
> PresentationLayer,
> Version=null,
> Culture=neutral,
> PublicKeyToken=null"
> controller="TestController"
> stayOpen="true"
> floatable="true"
> />
>
> </views>
> <!--
> <sharedTransitions>
> </sharedTransitions>
> -->
> <!--
> <navigationGraph>
> </navigationGraph>
> -->
> <!--
> <uipWizard>
> </uipWizard>
> -->
> <!--
> <userControls>
> </userControls>
> -->
> </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>
>
>
>
> Thanks
Author
14 Mar 2006 2:40 PM
SparkPlug
"Zafar Abbas" wrote:

> These are validation errors, are you trying to validate your file or just
> parse it. If you dont need validation, turn validation off when you create
> the validating reader in .NET.

That sounds useful. I've only just begun creating an application based on
UIPAB so I am just trying to build & run it with one simple View and one
simple Controller to test that I have written the config correctly.

Is it trying to validate the config file but doesn't have access to the
schema? If so, how can I prevent Visual Studio (Express) from trying to
validate the app.config?

FYI the message in the Visual Studio Immediate Window is

A first chance exception of type 'System.Xml.Schema.XmlSchemaException'
occurred in System.Xml.dll
A first chance exception of type
'System.Configuration.ConfigurationErrorsException' occurred in
System.Configuration.dll
A first chance exception of type
'Microsoft.ApplicationBlocks.UIProcess.UIPException' occurred in
Microsoft.ApplicationBlocks.UIProcess.dll

and the debugging process appears to be showing me the exception is being
thrown from a statement is the UIPConfigHandler.cs that says:

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

Thanks for your help.
Author
15 Mar 2006 1:46 AM
Priya Lakshminarayanan
If the exception is thrown from the following line that means that there was
a problem in parsing and compiling the schema that is being added.

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

Can you write out the exception message and check the error in the schema?

Thanks,
Priya

Show quote
"SparkPlug" <SparkP***@discussions.microsoft.com> wrote in message
news:9A6300BB-F2E8-40DE-8581-B04A98F69F11@microsoft.com...
>
> "Zafar Abbas" wrote:
>
>> These are validation errors, are you trying to validate your file or just
>> parse it. If you dont need validation, turn validation off when you
>> create
>> the validating reader in .NET.
>
> That sounds useful. I've only just begun creating an application based on
> UIPAB so I am just trying to build & run it with one simple View and one
> simple Controller to test that I have written the config correctly.
>
> Is it trying to validate the config file but doesn't have access to the
> schema? If so, how can I prevent Visual Studio (Express) from trying to
> validate the app.config?
>
> FYI the message in the Visual Studio Immediate Window is
>
> A first chance exception of type 'System.Xml.Schema.XmlSchemaException'
> occurred in System.Xml.dll
> A first chance exception of type
> 'System.Configuration.ConfigurationErrorsException' occurred in
> System.Configuration.dll
> A first chance exception of type
> 'Microsoft.ApplicationBlocks.UIProcess.UIPException' occurred in
> Microsoft.ApplicationBlocks.UIProcess.dll
>
> and the debugging process appears to be showing me the exception is being
> thrown from a statement is the UIPConfigHandler.cs that says:
>
> validatingReader.Schemas.Add( XmlSchema.Read( new XmlTextReader(
> streamReader ), null ) );
>
> Thanks for your help.
>
Author
15 Mar 2006 1:06 PM
SparkPlug
"Priya Lakshminarayanan" wrote:

> If the exception is thrown from the following line that means that there was
> a problem in parsing and compiling the schema that is being added.

Yes I agree that is the problem.

> validatingReader.Schemas.Add( XmlSchema.Read( new XmlTextReader(
> streamReader ), null ) );
>
> Can you write out the exception message and check the error in the schema?

I am using only Visual Basic 2005 Express Edition and will not provide
exception stack traces for exceptions thrown in referenced C# code, the only
exception messages are in the Immediate Window and Error List as I described
previously and repost below:

Immediate Window:
A first chance exception of type 'System.Xml.Schema.XmlSchemaException'
occurred in System.Xml.dll
A first chance exception of type
'System.Configuration.ConfigurationErrorsException' occurred in
System.Configuration.dll
A first chance exception of type
'Microsoft.ApplicationBlocks.UIProcess.UIPException' occurred in
Microsoft.ApplicationBlocks.UIProcess.dll
A first chance exception of type
'Microsoft.ApplicationBlocks.UIProcess.UIPException' occurred in
Microsoft.ApplicationBlocks.UIProcess.dll
A first chance exception of type
'Microsoft.ApplicationBlocks.UIProcess.UIPException' occurred in
Microsoft.ApplicationBlocks.UIProcess.dll
....

.... ad nauseam

Error List:
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. for every element and attribute in the <uipConfiguration> section

I currently think that the process of upgrading the UIP solution to Visual
C# 2005 EE (I only have Express Editions at home) has caused a problem so
that the UIPConfigSchema.xsd is not being correctly built into the
UIProcess.dll.

This screen image may indicate that but I'm not sure:
http://uk.geocities.com/mjtech_uk/UIPConfigSchema_VStudio2005EE.jpg

I am currently asking a friend to try building the UIPAB on VS 2003 with
..NET 1.1 to see that solves the problem. I will post the results on this
thread but would welcome any comments/insights/suggestions in the meantime.

Thanks.
Author
15 Mar 2006 11:00 PM
SparkPlug
"SparkPlug" wrote:


> I am using only Visual Basic 2005 Express Edition and will not provide
> exception stack traces for exceptions thrown in referenced C# code,

Oops, that should have said "I am using only Visual Basic 2005 Express
Edition and *it* will not provide exception stack traces for exceptions
thrown in referenced C# code"

If *it* gave me an exception report I would gladly pass it on!!! :-)
Author
17 Mar 2006 10:18 PM
Priya Lakshminarayanan
Can you try a smaller code sample by adding the UIP schema directly into a
XmlSchemaSet and check what errors/exception you get?

XmlSchemaSet schemas = new XmlSchemaSet();
schemas.Add(null, "UipConfigSchema.xsd");
schemas.Compile();

Thanks,
Priya

Show quote
"SparkPlug" <SparkP***@discussions.microsoft.com> wrote in message
news:4FA7763E-CAC9-47EA-886D-3A826E0DA28F@microsoft.com...
>
>
> "SparkPlug" wrote:
>
>
>> I am using only Visual Basic 2005 Express Edition and will not provide
>> exception stack traces for exceptions thrown in referenced C# code,
>
> Oops, that should have said "I am using only Visual Basic 2005 Express
> Edition and *it* will not provide exception stack traces for exceptions
> thrown in referenced C# code"
>
> If *it* gave me an exception report I would gladly pass it on!!! :-)
Author
20 Mar 2006 9:06 PM
SparkPlug
"Priya Lakshminarayanan" wrote:

> Can you try a smaller code sample by adding the UIP schema directly into a
> XmlSchemaSet and check what errors/exception you get?
>
> XmlSchemaSet schemas = new XmlSchemaSet();
> schemas.Add(null, "UipConfigSchema.xsd");
> schemas.Compile();

Sorry for the delay in replying. I did as you advised and the exception
message is below.

System.Xml.Schema.XmlSchemaException was unhandled
  Message="Wildcard '##any' allows element 'statePersistenceProvider', and
causes the content model to become ambiguous. A content model must be formed
such that during validation of an element information item sequence, the
particle contained directly, indirectly or implicitly therein with which to
attempt to validate each item in the sequence in turn can be uniquely
determined without examining the content or attributes of that item, and
without any information about the items in the remainder of the sequence."
  Source="System.Xml"
  StackTrace:
       at System.Xml.Schema.XmlSchemaSet.InternalValidationCallback(Object
sender, ValidationEventArgs e)
       at
System.Xml.Schema.BaseProcessor.SendValidationEvent(XmlSchemaException e,
XmlSeverityType severity)
       at System.Xml.Schema.Compiler.CompileElement(XmlSchemaElement xe)
       at
System.Xml.Schema.Compiler.CompileParticleElements(XmlSchemaComplexType
complexType, XmlSchemaParticle particle)
       at
System.Xml.Schema.Compiler.CompileParticleElements(XmlSchemaComplexType
complexType, XmlSchemaParticle particle)
       at
System.Xml.Schema.Compiler.CompileComplexTypeElements(XmlSchemaComplexType
complexType)
       at System.Xml.Schema.Compiler.Compile()
       at System.Xml.Schema.Compiler.Execute(XmlSchemaSet schemaSet,
SchemaInfo schemaCompiledInfo)
       at System.Xml.Schema.XmlSchemaSet.Compile()
       at UIPAB_Sandbox.MainClass.Main(String[] args) in D:\Visual Studio
2005\Projects\UIPAB_Sandbox\UIPAB_Sandbox\MainClass.vb:line 13
       at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()


I have also identified a forum thread that appears to address this problem
(explained as something to do with .NET 2.0 handling XML differently to .NET
1.1 which the UIPAB was built on) and offers a solution at
http://forums.asp.net/713774/ShowPost.aspx

Implementing the solution prevents the original exception.

I would still welcome your comments or insights regarding this issue.

Hopefully, one day soon this *important* application block will be properly
ported to the .NET 2.0 Framework (how about it, Microsoft?!!)

AddThis Social Bookmark Button