Showing posts with label compilation. Show all posts
Showing posts with label compilation. Show all posts

Wednesday, March 28, 2012

Strange compilation error

Hi,

From time to time, I receive following error message when trying to access
my website.
When the error occurs, I have to recompile my dll until the error disappears
(this without changing anything in my code).
Where does this error come from ? What can I do to solve the problem ?
Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.

Compiler Error Message: CS0030: Cannot convert type
'System.Web.HttpApplication' to 'ASP.Global_asax'

Source Error:

Line 438: protected ASP.Global_asax ApplicationInstance {
Line 439: get {
Line 440: return
((ASP.Global_asax)(this.Context.ApplicationInstanc e));
Line 441: }
Line 442: }

Source File: c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Tempo rary ASP.NET
Files\emagic.net.website\1a713704\55d0ac6a\5rffbzu b.0.cs Line: 440Hi,

As you can figure out its a prpblem with dynamic compilation of pages
(and asax). do you write any code in your application asax file? if so
can you post it or at least tell what you are doing ? usually those
errors ate outcome of code being write in asax code behind.

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Strange compilation error

Hi,
From time to time, I receive following error message when trying to access
my website.
When the error occurs, I have to recompile my dll until the error disappears
(this without changing anything in my code).
Where does this error come from ? What can I do to solve the problem ?
Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.
Compiler Error Message: CS0030: Cannot convert type
'System.Web.HttpApplication' to 'ASP.Global_asax'
Source Error:
Line 438: protected ASP.Global_asax ApplicationInstance {
Line 439: get {
Line 440: return
((ASP.Global_asax)(this.Context.ApplicationInstance));
Line 441: }
Line 442: }
Source File: c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET
Files\emagic.net.website\1a713704\55d0ac6a\5rffbzub.0.cs Line: 440Hi,
As you can figure out its a prpblem with dynamic compilation of pages
(and asax). do you write any code in your application asax file? if so
can you post it or at least tell what you are doing ? usually those
errors ate outcome of code being write in asax code behind.
Natty Gur[MVP]
blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!

Strange compilation errors

Assuming two aspx pages named Defaul1 and Default2 whith separate code behin
d
files. The corresponding class names are Defaul1 and Default2 respectively
and are in the same namespace (MyCompany.MyApplication.UI).
In the "Page_Load" of Page2 class I have the following code
if ( Context.Handler is Page1 )
Page1 sourcePage = (Page1)Context.Handler;
Not allways but quite often during the build, I see the following error:
The type or namespace name 'Page1' could not be found (are you missing a
using directive or an assembly reference?)
The error message appears twise indicating the two code lines above.
There is no missing "using" because both classes are in the same namespace.
There is no missing assemply reference because both classes (pages) are in
the same web project.
The dev environment is VS 2005 and in the code behind files the classes are
declared as partial.
Any ideas what could be the problem?
Thanksyou should not confuse namespaces with assemblies. namespace is just that, a
naming prefix. using a namespace just allows shortcuts in speciing names.
several assemblies (dlls) may use the same namespace, or one assembly may
have several namespaces. to reference a routine, you must specify the name,
but also must include the assembly containing the routine.
asp.net builds an assembly per page, so even though you use the same
namespace, you als need to add a reference to the page. a confusing facter
is that asp.net will compile serveral pages into the same dll if batching is
allowed. if you forgt the refernce and the pages end up in the same assembly
your ok. if they end up in different assemblies, then you're in trouble.
-- bruce (sqlwork.com)
"Argirop" <Argirop@.discussions.microsoft.com> wrote in message
news:8B674FC6-4D83-4D02-8076-1EA6D72E804E@.microsoft.com...
> Assuming two aspx pages named Defaul1 and Default2 whith separate code
> behind
> files. The corresponding class names are Defaul1 and Default2 respectively
> and are in the same namespace (MyCompany.MyApplication.UI).
> In the "Page_Load" of Page2 class I have the following code
> if ( Context.Handler is Page1 )
> Page1 sourcePage = (Page1)Context.Handler;
> Not allways but quite often during the build, I see the following error:
> The type or namespace name 'Page1' could not be found (are you missing a
> using directive or an assembly reference?)
> The error message appears twise indicating the two code lines above.
> There is no missing "using" because both classes are in the same
> namespace.
> There is no missing assemply reference because both classes (pages) are in
> the same web project.
> The dev environment is VS 2005 and in the code behind files the classes
> are
> declared as partial.
> Any ideas what could be the problem?
> Thanks
>
And how can I add a reference to Default1 in Default2 ?
"bruce barker (sqlwork.com)" wrote:

> you should not confuse namespaces with assemblies. namespace is just that,
a
> naming prefix. using a namespace just allows shortcuts in speciing names.
> several assemblies (dlls) may use the same namespace, or one assembly may
> have several namespaces. to reference a routine, you must specify the nam
e,
> but also must include the assembly containing the routine.
> asp.net builds an assembly per page, so even though you use the same
> namespace, you als need to add a reference to the page. a confusing facter
> is that asp.net will compile serveral pages into the same dll if batching
is
> allowed. if you forgt the refernce and the pages end up in the same assemb
ly
> your ok. if they end up in different assemblies, then you're in trouble.
> -- bruce (sqlwork.com)
> "Argirop" <Argirop@.discussions.microsoft.com> wrote in message
> news:8B674FC6-4D83-4D02-8076-1EA6D72E804E@.microsoft.com...
>
>
Never mind, I found it.
Thanks a lot.
"Argirop" wrote:
> And how can I add a reference to Default1 in Default2 ?
> "bruce barker (sqlwork.com)" wrote:
>

Strange compilation errors

Assuming two aspx pages named Defaul1 and Default2 whith separate code behind
files. The corresponding class names are Defaul1 and Default2 respectively
and are in the same namespace (MyCompany.MyApplication.UI).

In the "Page_Load" of Page2 class I have the following code

if ( Context.Handler is Page1 )
Page1 sourcePage = (Page1)Context.Handler;

Not allways but quite often during the build, I see the following error:

The type or namespace name 'Page1' could not be found (are you missing a
using directive or an assembly reference?)

The error message appears twise indicating the two code lines above.

There is no missing "using" because both classes are in the same namespace.
There is no missing assemply reference because both classes (pages) are in
the same web project.

The dev environment is VS 2005 and in the code behind files the classes are
declared as partial.

Any ideas what could be the problem?

Thanksyou should not confuse namespaces with assemblies. namespace is just that, a
naming prefix. using a namespace just allows shortcuts in speciing names.
several assemblies (dlls) may use the same namespace, or one assembly may
have several namespaces. to reference a routine, you must specify the name,
but also must include the assembly containing the routine.

asp.net builds an assembly per page, so even though you use the same
namespace, you als need to add a reference to the page. a confusing facter
is that asp.net will compile serveral pages into the same dll if batching is
allowed. if you forgt the refernce and the pages end up in the same assembly
your ok. if they end up in different assemblies, then you're in trouble.

-- bruce (sqlwork.com)

"Argirop" <Argirop@.discussions.microsoft.comwrote in message
news:8B674FC6-4D83-4D02-8076-1EA6D72E804E@.microsoft.com...

Quote:

Originally Posted by

Assuming two aspx pages named Defaul1 and Default2 whith separate code
behind
files. The corresponding class names are Defaul1 and Default2 respectively
and are in the same namespace (MyCompany.MyApplication.UI).
>
In the "Page_Load" of Page2 class I have the following code
>
if ( Context.Handler is Page1 )
Page1 sourcePage = (Page1)Context.Handler;
>
Not allways but quite often during the build, I see the following error:
>
The type or namespace name 'Page1' could not be found (are you missing a
using directive or an assembly reference?)
>
The error message appears twise indicating the two code lines above.
>
There is no missing "using" because both classes are in the same
namespace.
There is no missing assemply reference because both classes (pages) are in
the same web project.
>
The dev environment is VS 2005 and in the code behind files the classes
are
declared as partial.
>
Any ideas what could be the problem?
>
Thanks
>
>


And how can I add a reference to Default1 in Default2 ?

"bruce barker (sqlwork.com)" wrote:

Quote:

Originally Posted by

you should not confuse namespaces with assemblies. namespace is just that, a
naming prefix. using a namespace just allows shortcuts in speciing names.
several assemblies (dlls) may use the same namespace, or one assembly may
have several namespaces. to reference a routine, you must specify the name,
but also must include the assembly containing the routine.
>
asp.net builds an assembly per page, so even though you use the same
namespace, you als need to add a reference to the page. a confusing facter
is that asp.net will compile serveral pages into the same dll if batching is
allowed. if you forgt the refernce and the pages end up in the same assembly
your ok. if they end up in different assemblies, then you're in trouble.
>
-- bruce (sqlwork.com)
>
"Argirop" <Argirop@.discussions.microsoft.comwrote in message
news:8B674FC6-4D83-4D02-8076-1EA6D72E804E@.microsoft.com...

Quote:

Originally Posted by

Assuming two aspx pages named Defaul1 and Default2 whith separate code
behind
files. The corresponding class names are Defaul1 and Default2 respectively
and are in the same namespace (MyCompany.MyApplication.UI).

In the "Page_Load" of Page2 class I have the following code

if ( Context.Handler is Page1 )
Page1 sourcePage = (Page1)Context.Handler;

Not allways but quite often during the build, I see the following error:

The type or namespace name 'Page1' could not be found (are you missing a
using directive or an assembly reference?)

The error message appears twise indicating the two code lines above.

There is no missing "using" because both classes are in the same
namespace.
There is no missing assemply reference because both classes (pages) are in
the same web project.

The dev environment is VS 2005 and in the code behind files the classes
are
declared as partial.

Any ideas what could be the problem?

Thanks


>
>
>


Never mind, I found it.

Thanks a lot.

"Argirop" wrote:

Quote:

Originally Posted by

And how can I add a reference to Default1 in Default2 ?
>
"bruce barker (sqlwork.com)" wrote:
>

Quote:

Originally Posted by

you should not confuse namespaces with assemblies. namespace is just that, a
naming prefix. using a namespace just allows shortcuts in speciing names.
several assemblies (dlls) may use the same namespace, or one assembly may
have several namespaces. to reference a routine, you must specify the name,
but also must include the assembly containing the routine.

asp.net builds an assembly per page, so even though you use the same
namespace, you als need to add a reference to the page. a confusing facter
is that asp.net will compile serveral pages into the same dll if batching is
allowed. if you forgt the refernce and the pages end up in the same assembly
your ok. if they end up in different assemblies, then you're in trouble.

-- bruce (sqlwork.com)

"Argirop" <Argirop@.discussions.microsoft.comwrote in message
news:8B674FC6-4D83-4D02-8076-1EA6D72E804E@.microsoft.com...

Quote:

Originally Posted by

Assuming two aspx pages named Defaul1 and Default2 whith separate code
behind
files. The corresponding class names are Defaul1 and Default2 respectively
and are in the same namespace (MyCompany.MyApplication.UI).
>
In the "Page_Load" of Page2 class I have the following code
>
if ( Context.Handler is Page1 )
Page1 sourcePage = (Page1)Context.Handler;
>
Not allways but quite often during the build, I see the following error:
>
The type or namespace name 'Page1' could not be found (are you missing a
using directive or an assembly reference?)
>
The error message appears twise indicating the two code lines above.
>
There is no missing "using" because both classes are in the same
namespace.
There is no missing assemply reference because both classes (pages) are in
the same web project.
>
The dev environment is VS 2005 and in the code behind files the classes
are
declared as partial.
>
Any ideas what could be the problem?
>
Thanks
>
>


strange compilation error I have never seen before

Hi David,
A couple of things to try...
Make sure the ASP.NET mappings are still correctly configured. There's a
procedure here:
http://support.microsoft.com/defaul...&product=aspnet
Also, try deleting the contents of the
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files .
Let us know what works?
Ken
"David" <spammersgohome@dotnet.itags.org.spammersgohome.com> wrote in message
news:e5aGc.20071$ju5.4042@dotnet.itags.org.twister.socal.rr.com...
>I was experimenting with generating a Word file using ASP.NET, and lauching
> the web app did not cause any problems.
> Then out of the blue, this is happening to every asp.net app that I
> attempt
> to launch on my machine. When I click on the "Show Complete Compilation
> Source". this is what shows. Since it is happening to every ASP.NET app,
> I
> think my machine has been seriously screwed up. Has anyone seen this?
> Compiler Error Message: The compiler failed with error code 128.
> Show Complete Compilation Source:
> Line 1:
> //---
--
> --
> Line 2: // <autogenerated>
> Line 3: // This code was generated by a tool.
> Line 4: // Runtime Version: 1.1.4322.573
> Line 5: //
> Line 6: // Changes to this file may cause incorrect behavior and
> will
> be lost if
> Line 7: // the code is regenerated.
> Line 8: // </autogenerated>
> Line 9:
> //---
--
> --
> Line 10:
> Line 11: namespace ASP {
> Line 12: using System;
> Line 13: using System.Collections;
> Line 14: using System.Collections.Specialized;
> Line 15: using System.Configuration;
> Line 16: using System.Text;
> Line 17: using System.Text.RegularExpressions;
> Line 18: using System.Web;
> Line 19: using System.Web.Caching;
> Line 20: using System.Web.SessionState;
> Line 21: using System.Web.Security;
> Line 22: using System.Web.UI;
> Line 23: using System.Web.UI.WebControls;
> Line 24: using System.Web.UI.HtmlControls;
> Line 25:
> Line 26:
> Line 27:
> [System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()]
> Line 28: public class Global_asax : ApplicantApp.Global {
> Line 29:
> Line 30: private static bool __initialized = false;
> Line 31:
> Line 32: public Global_asax() {
> Line 33: if ((ASP.Global_asax.__initialized == false)) {
> Line 34: ASP.Global_asax.__initialized = true;
> Line 35: }
> Line 36: }
> Line 37: }
> Line 38: }
> Line 39:
>Rebooting the computer solved the problem.

> Hi David,
> A couple of things to try...
> Make sure the ASP.NET mappings are still correctly configured. There's a
> procedure here:
> http://support.microsoft.com/defaul...&product=aspnet
> Also, try deleting the contents of the
> C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files .
> Let us know what works?
> Ken
>