Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Distributed Applications / March 2006

Tip: Looking for answers? Try searching our database.

XmlSchemaException in App.config using UIP Application Block

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SparkPlug - 13 Mar 2006 18:08 GMT
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
Zafar Abbas - 14 Mar 2006 02:24 GMT
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

> Does anyone know why I might be getting an XmlSchemaException in App.config
> configured as below to use the UIP Application Block?
[quoted text clipped - 6 lines]
> Message 2 Could not find schema information for the element 'objectTypes'.
> Message 3 Could not find schema information for the element
'iViewManager'.
> ... etc. etc.
>
[quoted text clipped - 110 lines]
>
> Thanks
SparkPlug - 14 Mar 2006 15:40 GMT
> 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.
Priya Lakshminarayanan - 15 Mar 2006 02:46 GMT
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

>> 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
[quoted text clipped - 27 lines]
>
> Thanks for your help.
SparkPlug - 15 Mar 2006 14:06 GMT
> 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.
SparkPlug - 16 Mar 2006 00:00 GMT
> 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!!! :-)
Priya Lakshminarayanan - 17 Mar 2006 23:18 GMT
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

>> I am using only Visual Basic 2005 Express Edition and will not provide
>> exception stack traces for exceptions thrown in referenced C# code,
[quoted text clipped - 4 lines]
>
> If *it* gave me an exception report I would gladly pass it on!!! :-)
SparkPlug - 20 Mar 2006 22:06 GMT
> 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?!!)

Free Magazines

Get 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 ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.