Saturday, March 24, 2012
Strange Event Behavior
Scenario:
Class A has a method that returns an instantiated object of Class B.
Class A has a Public Event called "DataUpdated".
When the Class A method is called to return an instance of Class B,
Class A hands to Class B a pointer to itself. Therefore, Class B can
reference the instance of Class A that instantiated it.
Thus, Class B can call the DataUpdated event on the instance of Class A
that instantied it. A method of Class A marked "Friend", called
OnDataUpdated, is called when the "Save" method of Class B is called.
Weirdness:
This all works as planned, but strangely. In an ASP.NET application,
I'm storing an instance of Class A in the Cache. When I call the "Save"
method on Class B, the event bubbles up to the instance of Class A as
expected. However, the event fires up to five times. I've stepped
through the code; the event is only raised once.
Any ideas? Thanks.
Dave Swersky
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!Is it a special needs class?
Try giving them a longer recess. It will allow them to expend some energy
before they return to your classroom.
Strange exception
(http://communities2.microsoft.com/c...13-756f24b06d79)
Hello,
When i try to create a new page from a new template i get the exception belo
w.
Anyone have any directions on what i should look for?
The template path is correct and the project compiles ok.
When i run the project in debug no breakpoints in my template are hit.
/Johan
Exception: System.Web.HttpException
Message: External component has thrown an exception.
Source: System.Web
at System.Web.UI.TemplateParser.GetParserCacheItemInternal(Boolean
fCreateIfNotFound)
at System.Web.UI.TemplateParser.GetParserCacheItemWithNewConfigPath()
at System.Web.UI.TemplateParser.GetParserCacheItem()
at
System.Web.UI.TemplateControlParser.CompileAndGetParserCacheItem(String
virtualPath, String inputFile, HttpContext context)
at System.Web.UI.TemplateControlParser.GetCompiledInstance(String
virtualPath, String inputFile, HttpContext context)
at System.Web.UI.PageParser.GetCompiledPageInstanceInternal(String
virtualPath, String inputFile, HttpContext context)
at System.Web.UI.PageHandlerFactory.GetHandler(HttpContext context,
String requestType, String url, String path)
at System.Web.HttpApplication.MapHttpHandler(HttpContext context, String
requestType, String path, String pathTranslated, Boolean useAppConfig)
at
System.Web.MapHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep
.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously)
Nested Exception
Exception: System.Web.HttpCompileException
Message: External component has thrown an exception.
Source: System.Web
at
System.Web.Compilation.BaseCompiler.ThrowIfCompilerErrors(CompilerResults
results, CodeDomProvider codeProvider, CodeCompileUnit sourceData, String
sourceFile, String sourceString)
at System.Web.Compilation.BaseCompiler.GetCompiledType()
at System.Web.UI.PageParser.CompileIntoType()
at System.Web.UI.TemplateParser.GetParserCacheItemThroughCompilation()I know this probably doesn't help much, but I see this kind of exception all
the time when using the CSK. The CSK throws these exceptions as part of its
normal operation and continues on as per normal. I have a routine which
emails me exception details from a CSK site and I receive an email for
almost every page visited by a user.
- Paul Glavich
Microsoft MVP - ASP.NET
"Johan Neidenmark" <JohanNeidenmark@.discussions.microsoft.com> wrote in
message news:A0664C49-8947-4500-A5D8-7C6CE75791DB@.microsoft.com...
> Copied from microsoft.public.cmserver.general
>
(http://communities2.microsoft.com/c...us/default.aspx
?dg=microsoft.public.cmserver.general&mid=68d413a9-0f0e-458c-b913-756f24b06d
79)
> Hello,
> When i try to create a new page from a new template i get the exception
below.
> Anyone have any directions on what i should look for?
> The template path is correct and the project compiles ok.
> When i run the project in debug no breakpoints in my template are hit.
> /Johan
> Exception: System.Web.HttpException
> Message: External component has thrown an exception.
> Source: System.Web
> at System.Web.UI.TemplateParser.GetParserCacheItemInternal(Boolean
> fCreateIfNotFound)
> at System.Web.UI.TemplateParser.GetParserCacheItemWithNewConfigPath()
> at System.Web.UI.TemplateParser.GetParserCacheItem()
> at
> System.Web.UI.TemplateControlParser.CompileAndGetParserCacheItem(String
> virtualPath, String inputFile, HttpContext context)
> at System.Web.UI.TemplateControlParser.GetCompiledInstance(String
> virtualPath, String inputFile, HttpContext context)
> at System.Web.UI.PageParser.GetCompiledPageInstanceInternal(String
> virtualPath, String inputFile, HttpContext context)
> at System.Web.UI.PageHandlerFactory.GetHandler(HttpContext context,
> String requestType, String url, String path)
> at System.Web.HttpApplication.MapHttpHandler(HttpContext context,
String
> requestType, String path, String pathTranslated, Boolean useAppConfig)
> at
>
System.Web.MapHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep
.Execute()
> at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
> completedSynchronously)
> Nested Exception
> Exception: System.Web.HttpCompileException
> Message: External component has thrown an exception.
> Source: System.Web
> at
> System.Web.Compilation.BaseCompiler.ThrowIfCompilerErrors(CompilerResults
> results, CodeDomProvider codeProvider, CodeCompileUnit sourceData, String
> sourceFile, String sourceString)
> at System.Web.Compilation.BaseCompiler.GetCompiledType()
> at System.Web.UI.PageParser.CompileIntoType()
> at System.Web.UI.TemplateParser.GetParserCacheItemThroughCompilation()
>
Strange exception
(http://communities2.microsoft.com/c...13-756f24b06d79)
Hello,
When i try to create a new page from a new template i get the exception below.
Anyone have any directions on what i should look for?
The template path is correct and the project compiles ok.
When i run the project in debug no breakpoints in my template are hit.
/Johan
Exception: System.Web.HttpException
Message: External component has thrown an exception.
Source: System.Web
at System.Web.UI.TemplateParser.GetParserCacheItemInt ernal(Boolean
fCreateIfNotFound)
at System.Web.UI.TemplateParser.GetParserCacheItemWit hNewConfigPath()
at System.Web.UI.TemplateParser.GetParserCacheItem()
at
System.Web.UI.TemplateControlParser.CompileAndGetP arserCacheItem(String
virtualPath, String inputFile, HttpContext context)
at System.Web.UI.TemplateControlParser.GetCompiledIns tance(String
virtualPath, String inputFile, HttpContext context)
at System.Web.UI.PageParser.GetCompiledPageInstanceIn ternal(String
virtualPath, String inputFile, HttpContext context)
at System.Web.UI.PageHandlerFactory.GetHandler(HttpCo ntext context,
String requestType, String url, String path)
at System.Web.HttpApplication.MapHttpHandler(HttpCont ext context, String
requestType, String path, String pathTranslated, Boolean useAppConfig)
at
System.Web.MapHandlerExecutionStep.System.Web.Http Application+IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean&
completedSynchronously)
Nested Exception
Exception: System.Web.HttpCompileException
Message: External component has thrown an exception.
Source: System.Web
at
System.Web.Compilation.BaseCompiler.ThrowIfCompile rErrors(CompilerResults
results, CodeDomProvider codeProvider, CodeCompileUnit sourceData, String
sourceFile, String sourceString)
at System.Web.Compilation.BaseCompiler.GetCompiledTyp e()
at System.Web.UI.PageParser.CompileIntoType()
at System.Web.UI.TemplateParser.GetParserCacheItemThr oughCompilation()I know this probably doesn't help much, but I see this kind of exception all
the time when using the CSK. The CSK throws these exceptions as part of its
normal operation and continues on as per normal. I have a routine which
emails me exception details from a CSK site and I receive an email for
almost every page visited by a user.
--
- Paul Glavich
Microsoft MVP - ASP.NET
"Johan Neidenmark" <JohanNeidenmark@.discussions.microsoft.com> wrote in
message news:A0664C49-8947-4500-A5D8-7C6CE75791DB@.microsoft.com...
> Copied from microsoft.public.cmserver.general
(http://communities2.microsoft.com/c...us/default.aspx
?dg=microsoft.public.cmserver.general&mid=68d413a9-0f0e-458c-b913-756f24b06d
79)
> Hello,
> When i try to create a new page from a new template i get the exception
below.
> Anyone have any directions on what i should look for?
> The template path is correct and the project compiles ok.
> When i run the project in debug no breakpoints in my template are hit.
> /Johan
> Exception: System.Web.HttpException
> Message: External component has thrown an exception.
> Source: System.Web
> at System.Web.UI.TemplateParser.GetParserCacheItemInt ernal(Boolean
> fCreateIfNotFound)
> at System.Web.UI.TemplateParser.GetParserCacheItemWit hNewConfigPath()
> at System.Web.UI.TemplateParser.GetParserCacheItem()
> at
> System.Web.UI.TemplateControlParser.CompileAndGetP arserCacheItem(String
> virtualPath, String inputFile, HttpContext context)
> at System.Web.UI.TemplateControlParser.GetCompiledIns tance(String
> virtualPath, String inputFile, HttpContext context)
> at System.Web.UI.PageParser.GetCompiledPageInstanceIn ternal(String
> virtualPath, String inputFile, HttpContext context)
> at System.Web.UI.PageHandlerFactory.GetHandler(HttpCo ntext context,
> String requestType, String url, String path)
> at System.Web.HttpApplication.MapHttpHandler(HttpCont ext context,
String
> requestType, String path, String pathTranslated, Boolean useAppConfig)
> at
System.Web.MapHandlerExecutionStep.System.Web.Http Application+IExecutionStep
..Execute()
> at System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean&
> completedSynchronously)
> Nested Exception
> Exception: System.Web.HttpCompileException
> Message: External component has thrown an exception.
> Source: System.Web
> at
> System.Web.Compilation.BaseCompiler.ThrowIfCompile rErrors(CompilerResults
> results, CodeDomProvider codeProvider, CodeCompileUnit sourceData, String
> sourceFile, String sourceString)
> at System.Web.Compilation.BaseCompiler.GetCompiledTyp e()
> at System.Web.UI.PageParser.CompileIntoType()
> at System.Web.UI.TemplateParser.GetParserCacheItemThr oughCompilation()