Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
|
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 7th, 2005, 04:39 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default AmbiguousMatchException running the .aspx

Given the following error, where do I look now?
Code:
Ambiguous match found.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Reflection.AmbiguousMatchException: Ambiguous match found.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 


[AmbiguousMatchException: Ambiguous match found.]
   System.RuntimeType.GetPropertyImpl(String name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers) +245
   System.Type.GetProperty(String name, BindingFlags bindingAttr) +24
   System.Web.UI.Util.GetNonPrivatePropertyType(Type classType, String propName) +9
   System.Web.Compilation.TemplateControlCompiler.BuildFieldDeclaration(ControlBuilder builder, Boolean fGeneratedID) +48
   System.Web.Compilation.TemplateControlCompiler.BuildSourceDataTreeFromBuilder(ControlBuilder builder, Boolean fInTemplate, PropertySetterEntry pse) +794
   System.Web.Compilation.TemplateControlCompiler.BuildSourceDataTreeFromBuilder(ControlBuilder builder, Boolean fInTemplate, PropertySetterEntry pse) +355
   System.Web.Compilation.TemplateControlCompiler.BuildSourceDataTreeFromBuilder(ControlBuilder builder, Boolean fInTemplate, PropertySetterEntry pse) +355
   System.Web.Compilation.TemplateControlCompiler.BuildMiscClassMembers() +52
   System.Web.Compilation.PageCompiler.BuildMiscClassMembers() +10
   System.Web.Compilation.BaseCompiler.BuildSourceDataTree() +1291
   System.Web.Compilation.BaseCompiler.GetCompiledType() +129
   System.Web.UI.PageParser.CompileIntoType() +63
   System.Web.UI.TemplateParser.GetParserCacheItemThroughCompilation() +124

[HttpException (0x80004005): Ambiguous match found.]
   System.Web.UI.TemplateParser.GetParserCacheItemInternal(Boolean fCreateIfNotFound) +692
   System.Web.UI.TemplateParser.GetParserCacheItemWithNewConfigPath() +125
   System.Web.UI.TemplateParser.GetParserCacheItem() +88
   System.Web.UI.TemplateControlParser.CompileAndGetParserCacheItem(String virtualPath, String inputFile, HttpContext context) +116
   System.Web.UI.TemplateControlParser.GetCompiledInstance(String virtualPath, String inputFile, HttpContext context) +36
   System.Web.UI.PageParser.GetCompiledPageInstanceInternal(String virtualPath, String inputFile, HttpContext context) +43
   System.Web.UI.PageHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String path) +44
   System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, String path, String pathTranslated, Boolean useAppConfig) +696
   System.Web.MapHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() +95
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +173
   I don’t really know what the references in the square brackets beginning each section represent, just for starters.
 
Old December 8th, 2005, 02:27 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

I have additional information.

I edited Global.asax.vb to try to get some reporting on how far the process progressed before there was an error. I changed it to:
Code:
Imports System.Web
Imports System.Web.SessionState

Public Class Global
    Inherits System.Web.HttpApplication

#Region " Component Designer Generated Code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Component Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Required by the Component Designer
    Private components As System.ComponentModel.IContainer

    ' NOTE: The following procedure is required by the Component Designer
    ' It can be modified using the Component Designer.
    ' Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
        Private Sub InitializeComponent()
            components = New System.ComponentModel.Container
        End Sub

#End Region

    Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
        Speak("Running Application_Start()")    ' Fires when the application is started
    End Sub

    Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
        Speak("Running Session_Start()")        ' Fires when the session is started
    End Sub

    Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
        Speak("Running App..._BeginRequest()") ' Fires at the beginning of each request
    End Sub

    Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs)
        Speak("Running App..._Auth...Request()") ' Fires upon attempting to authenticate the use
    End Sub

    Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
        Speak("Running App..._Error()")         ' Fires when an error occurs
    End Sub

    Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
        Speak("Running Session_End()")          ' Fires when the session ends
    End Sub

    Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
        Speak("Running Application_End()")      ' Fires when the application ends
    End Sub

    Private Sub Speak(ByVal Msg As String)

        Dim writer As System.IO.StreamWriter = _
                      System.IO.File.AppendText("C:\inetpub\IDDS_Logging\StartMtChk.txt")
            writer.WriteLine(Now & ": " & Msg)
            writer.Close()

    End Sub

End Class
In the file that was to be written to, I got:
Code:
12/8/05 0959:19: Running Application_Start()
12/8/05 0959:19: Running App..._BeginRequest()
12/8/05 0959:19: Running App..._Auth...Request()
12/8/05 0959:21: Running App..._Error()
 
Old December 13th, 2005, 05:08 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

And the answer is . . .

I had named a global variable User.
There were no compile errors, but that is a name used in the base class for HTML forms;
hence the conflict.
 
Old December 15th, 2005, 12:18 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I ran into a similar problem when I created a javascript class called "location". It royally screwed up some JS code. While I have used it numerous times, I somehow forgot that "location" is the name of a property of the browser DOM's window object which is in global scope of all client side script. OOPS.

At least you had an error message! ;)

-Peter





Similar Threads
Thread Thread Starter Forum Replies Last Post
I get an error when running ManageDepartments.aspx sstuber BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 June 1st, 2008 12:00 AM
AmbiguousMatchException running the .aspx BrianWren ASP.NET 1.0 and 1.1 Professional 0 December 8th, 2005 02:30 PM
AmbiguousMatchException running the .aspx BrianWren ASP.NET 1.0 and 1.1 Basics 0 December 8th, 2005 02:30 PM
AmbiguousMatchException running the .aspx BrianWren Pro VB.NET 2002/2003 0 December 7th, 2005 04:41 PM
Running an aspx file mahulda ASP.NET 1.0 and 1.1 Basics 5 March 27th, 2004 01:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.