[Mono-list] ASP.NET / usings (C#) and Imports (VB)
Jochen Wezel
jwezel@compumaster.de
Fri, 7 Nov 2003 08:57:54 +0100
This is a multi-part message in MIME format.
------_=_NextPart_001_01C3A504.D9A64977
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi!
I recommend some changes in System.CodeDom.Compiler.CodeGenerator.cs, =
but this might change generated ASP.NET code in a critical kind.
That's why I haven't had the heart to do these modifications myself =
without any reviewing of other peoples involved in creating this script
These changes would influence the behaviour of VB as well as C# - in the =
baddest case, you won't be able to launch ASP.NET pages even if they're =
written in C#
I don't know where to place the additional needed "using ASP"/"Imports =
ASP" command correctly (this would be a need after the modifications)
Please find code and further comments below.
Can anybody help reviewing and coding?
-Jochen
> Order of Namespace declaration and Imports/usings seems to be =
changeable as follows (also see my comments):
> //
> // System.CodeDom.Compiler.CodeGenerator.cs
> //
> // Authors:
> // Miguel de Icaza (miguel@ximian.com)
> // Daniel Stodden (stodden@in.tum.de)
> // Gonzalo Paniagua Javier (gonzalo@ximian.com)
> // Andreas Nahr (ClassDevelopment@A-SoftTech.com)
> //
> // (C) 2001-2003 Ximian, Inc.
> //
> ...
> protected virtual void GenerateNamespace (CodeNamespace ns)
> {
> foreach (CodeCommentStatement statement in ns.Comments)
> GenerateCommentStatement (statement);
>=20
> // <moved to here>
> foreach (CodeNamespaceImport import in ns.Imports)
> GenerateNamespaceImport (import);
>=20
> output.WriteLine();
> // </moved to here>
>=20
> GenerateNamespaceStart (ns);
>=20
> // <moved from here />=20
> // !!! I think we have to pay attention to the required Imports =
ASP/using ASP for ASP.NET !!!
>=20
> foreach (CodeTypeDeclaration type in ns.Types) {
> GenerateType (type);
> output.WriteLine();
> }
>=20
>=20
> Unclear for me is the right placing location for "Option Strict Off" =
and "Option Explicit On"
> The same with "Imports Microsoft.VisualBasic" and "Imports ASP"
>=20
>=20
> -----Urspr=FCngliche Nachricht-----
> Von: Jochen Wezel =20
> Gesendet: Mittwoch, 5. November 2003 15:26
> An: 'Gonzalo Paniagua Javier'
> Betreff: WG: ASP.NET's VB support
>=20
> There are some differences regarding the standard includes and also =
the standard options in ASP.NET of Mono and MS (here shown as VB code):
>=20
> This is Mono:
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Line 11: Namespace ASP
> Line 12: Imports System
> Line 13: Imports System.Collections
> Line 14: Imports System.Collections.Specialized
> Line 15: Imports System.Configuration
> Line 16: Imports System.Text
> Line 17: Imports System.Text.RegularExpressions
> Line 18: Imports System.Web
> Line 19: Imports System.Web.Caching
> Line 20: Imports System.Web.Security
> Line 21: Imports System.Web.SessionState
> Line 22: Imports System.Web.UI
> Line 23: Imports System.Web.UI.WebControls 'MS: HtmlControls =
first, the next line WebControls (TODO priority: low)
> Line 24: Imports System.Web.UI.HtmlControls
>=20
> This is MS:
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> Zeile 11: Option Strict Off 'missing in Mono's ASP.NET (TODO =
priority: high)
> Zeile 12: Option Explicit On 'missing in Mono's ASP.NET (TODO =
priority: high)
> Zeile 13: 'missing in Mono's ASP.NET (TODO priority: high)
> Zeile 14: Imports ASP 'missing in Mono's ASP.NET (TODO =
priority: high)
> Zeile 15: Imports Microsoft.VisualBasic 'missing in Mono's =
ASP.NET (TODO priority: high)
> Zeile 16: Imports System
> Zeile 17: Imports System.Collections
> Zeile 18: Imports System.Collections.Specialized
> Zeile 19: Imports System.Configuration
> Zeile 20: Imports System.Text
> Zeile 21: Imports System.Text.RegularExpressions
> Zeile 22: Imports System.Web
> Zeile 23: Imports System.Web.Caching
> Zeile 24: Imports System.Web.Security
> Zeile 25: Imports System.Web.SessionState
> Zeile 26: Imports System.Web.UI>=20
> Zeile 27: Imports System.Web.UI.HtmlControls
> Zeile 28: Imports System.Web.UI.WebControls
Zeile 29: =20
Zeile 30: Namespace ASP
Zeile 31: =20
------_=_NextPart_001_01C3A504.D9A64977
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
6.5.6944.0">
<TITLE>ASP.NET / usings (C#) and Imports (VB)</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P><FONT SIZE=3D2 FACE=3D"Courier New">Hi!</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Courier New">I recommend some changes =
in<I></I></FONT><I> <FONT COLOR=3D"#008000" SIZE=3D2 FACE=3D"Courier =
New">System.CodeDom.Compiler.CodeGenerator.cs</FONT></I><FONT SIZE=3D2 =
FACE=3D"Courier New">, but this might change generated ASP.NET code in a =
critical kind.</FONT></P>
<P><FONT SIZE=3D2 FACE=3D"Courier New">That's why I haven't had the =
heart to do these modifications myself without any reviewing of other =
peoples involved in creating this script</FONT></P>
<P><FONT SIZE=3D2 FACE=3D"Courier New">These changes would influence the =
behaviour of VB as well as C# - in the baddest case, you won't be able =
to launch ASP.NET pages even if they're written in C#</FONT></P>
<P><FONT SIZE=3D2 FACE=3D"Courier New">I don't know where to place the =
additional needed "using ASP"/"Imports ASP" command =
correctly (this would be a need after the modifications)</FONT></P>
<P><FONT SIZE=3D2 FACE=3D"Courier New">Please find code and further =
comments below.</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Courier New">Can anybody help reviewing and =
coding?</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Courier New">-Jochen</FONT>
</P>
<BR>
<BR>
<BR>
<BR>
<P><FONT SIZE=3D2 FACE=3D"Courier New">Order of Namespace declaration =
and Imports/usings seems to be changeable as follows (also see my =
comments):</FONT>
<BR><I><FONT COLOR=3D"#008000" SIZE=3D2 FACE=3D"Courier =
New">//</FONT></I>
<BR><I><FONT COLOR=3D"#008000" SIZE=3D2 FACE=3D"Courier New">// =
System.CodeDom.Compiler.CodeGenerator.cs</FONT></I>
<BR><I><FONT COLOR=3D"#008000" SIZE=3D2 FACE=3D"Courier =
New">//</FONT></I>
<BR><I><FONT COLOR=3D"#008000" SIZE=3D2 FACE=3D"Courier New">// =
Authors:</FONT></I>
<BR><I><FONT COLOR=3D"#008000" SIZE=3D2 FACE=3D"Courier =
New">// Miguel de Icaza (miguel@ximian.com)</FONT></I>
<BR><I><FONT COLOR=3D"#008000" SIZE=3D2 FACE=3D"Courier =
New">// Daniel Stodden (stodden@in.tum.de)</FONT></I>
<BR><I><FONT COLOR=3D"#008000" SIZE=3D2 FACE=3D"Courier =
New">// Gonzalo Paniagua Javier =
(gonzalo@ximian.com)</FONT></I>
<BR><I><FONT COLOR=3D"#008000" SIZE=3D2 FACE=3D"Courier =
New">// Andreas Nahr =
(ClassDevelopment@A-SoftTech.com)</FONT></I>
<BR><I><FONT COLOR=3D"#008000" SIZE=3D2 FACE=3D"Courier =
New">//</FONT></I>
<BR><I><FONT COLOR=3D"#008000" SIZE=3D2 FACE=3D"Courier New">// (C) =
2001-2003 Ximian, Inc.</FONT></I>
<BR><I><FONT COLOR=3D"#008000" SIZE=3D2 FACE=3D"Courier =
New">//</FONT></I>
<BR><I><FONT COLOR=3D"#008000" SIZE=3D2 FACE=3D"Courier =
New">...</FONT></I>
<BR> =
<B></B><B> <FONT =
COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Courier New">protected</FONT></B> =
<FONT COLOR=3D"#A52A2A" SIZE=3D2 FACE=3D"Courier New">virtual</FONT> =
<FONT COLOR=3D"#FF0000" SIZE=3D2 FACE=3D"Courier New">void</FONT><B> =
<FONT COLOR=3D"#191970" SIZE=3D2 FACE=3D"Courier =
New">GenerateNamespace</FONT></B> <FONT COLOR=3D"#006400" SIZE=3D2 =
FACE=3D"Courier New">(</FONT><FONT COLOR=3D"#000000" SIZE=3D2 =
FACE=3D"Courier New">CodeNamespace ns</FONT><FONT COLOR=3D"#006400" =
SIZE=3D2 FACE=3D"Courier New">)</FONT>
<BR> =
<FONT COLOR=3D"#006400" =
SIZE=3D2 FACE=3D"Courier New">{</FONT>
<BR> =
=
<B> <FONT COLOR=3D"#0000FF" =
SIZE=3D2 FACE=3D"Courier New">foreach</FONT></B> <FONT COLOR=3D"#006400" =
SIZE=3D2 FACE=3D"Courier New">(</FONT><FONT COLOR=3D"#000000" SIZE=3D2 =
FACE=3D"Courier New">CodeCommentStatement statement</FONT><B> <FONT =
COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Courier New">in</FONT></B> <FONT =
COLOR=3D"#000000" SIZE=3D2 FACE=3D"Courier New">ns</FONT><FONT =
COLOR=3D"#006400" SIZE=3D2 FACE=3D"Courier New">.</FONT><FONT =
COLOR=3D"#000000" SIZE=3D2 FACE=3D"Courier New">Comments</FONT><FONT =
COLOR=3D"#006400" SIZE=3D2 FACE=3D"Courier New">)</FONT>
<BR> =
=
=
<B> <FONT COLOR=3D"#191970" =
SIZE=3D2 FACE=3D"Courier New">GenerateCommentStatement</FONT></B> <FONT =
COLOR=3D"#006400" SIZE=3D2 FACE=3D"Courier New">(</FONT><FONT =
COLOR=3D"#000000" SIZE=3D2 FACE=3D"Courier New">statement</FONT><FONT =
COLOR=3D"#006400" SIZE=3D2 FACE=3D"Courier New">);</FONT>
</P>
<P> =
=
<FONT COLOR=3D"#006400" =
SIZE=3D2 FACE=3D"Courier New">// <moved to here></FONT>
<BR> =
=
<B> <FONT COLOR=3D"#0000FF" =
SIZE=3D2 FACE=3D"Courier New">foreach</FONT></B> <FONT COLOR=3D"#006400" =
SIZE=3D2 FACE=3D"Courier New">(</FONT><FONT COLOR=3D"#000000" SIZE=3D2 =
FACE=3D"Courier New">CodeNamespaceImport import</FONT><B> <FONT =
COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Courier New">in</FONT></B> <FONT =
COLOR=3D"#000000" SIZE=3D2 FACE=3D"Courier New">ns</FONT><FONT =
COLOR=3D"#006400" SIZE=3D2 FACE=3D"Courier New">.</FONT><FONT =
COLOR=3D"#000000" SIZE=3D2 FACE=3D"Courier New">Imports</FONT><FONT =
COLOR=3D"#006400" SIZE=3D2 FACE=3D"Courier New">)</FONT>
<BR> =
=
=
<B> <FONT COLOR=3D"#191970" =
SIZE=3D2 FACE=3D"Courier New">GenerateNamespaceImport</FONT></B> <FONT =
COLOR=3D"#006400" SIZE=3D2 FACE=3D"Courier New">(</FONT><FONT =
COLOR=3D"#000000" SIZE=3D2 FACE=3D"Courier New">import</FONT><FONT =
COLOR=3D"#006400" SIZE=3D2 FACE=3D"Courier New">);</FONT>
</P>
<P> =
=
<FONT COLOR=3D"#000000" =
SIZE=3D2 FACE=3D"Courier New">output</FONT><FONT COLOR=3D"#006400" =
SIZE=3D2 FACE=3D"Courier New">.</FONT><B><FONT COLOR=3D"#191970" =
SIZE=3D2 FACE=3D"Courier New">WriteLine</FONT></B><FONT =
COLOR=3D"#006400" SIZE=3D2 FACE=3D"Courier New">();</FONT>
<BR> =
=
<FONT COLOR=3D"#006400" =
SIZE=3D2 FACE=3D"Courier New">// </moved to here></FONT>
</P>
<P> =
=
<B> <FONT COLOR=3D"#191970" =
SIZE=3D2 FACE=3D"Courier New">GenerateNamespaceStart</FONT></B> <FONT =
COLOR=3D"#006400" SIZE=3D2 FACE=3D"Courier New">(</FONT><FONT =
COLOR=3D"#000000" SIZE=3D2 FACE=3D"Courier New">ns</FONT><FONT =
COLOR=3D"#006400" SIZE=3D2 FACE=3D"Courier New">);</FONT>
</P>
<P> =
=
<FONT COLOR=3D"#006400" =
SIZE=3D2 FACE=3D"Courier New">// <moved from here /> </FONT>
<BR> =
=
<FONT COLOR=3D"#006400" =
SIZE=3D2 FACE=3D"Courier New">// !!! I think we have to pay attention to =
the required Imports ASP/using ASP for ASP.NET !!!</FONT>
</P>
<P> =
=
<B> <FONT COLOR=3D"#0000FF" =
SIZE=3D2 FACE=3D"Courier New">foreach</FONT></B> <FONT COLOR=3D"#006400" =
SIZE=3D2 FACE=3D"Courier New">(</FONT><FONT COLOR=3D"#000000" SIZE=3D2 =
FACE=3D"Courier New">CodeTypeDeclaration type</FONT><B> <FONT =
COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Courier New">in</FONT></B> <FONT =
COLOR=3D"#000000" SIZE=3D2 FACE=3D"Courier New">ns</FONT><FONT =
COLOR=3D"#006400" SIZE=3D2 FACE=3D"Courier New">.</FONT><FONT =
COLOR=3D"#000000" SIZE=3D2 FACE=3D"Courier New">Types</FONT><FONT =
COLOR=3D"#006400" SIZE=3D2 FACE=3D"Courier New">) {</FONT>
<BR> =
=
=
<B> <FONT COLOR=3D"#191970" =
SIZE=3D2 FACE=3D"Courier New">GenerateType</FONT></B> <FONT =
COLOR=3D"#006400" SIZE=3D2 FACE=3D"Courier New">(</FONT><FONT =
COLOR=3D"#000000" SIZE=3D2 FACE=3D"Courier New">type</FONT><FONT =
COLOR=3D"#006400" SIZE=3D2 FACE=3D"Courier New">);</FONT>
<BR> =
=
=
<FONT COLOR=3D"#000000" =
SIZE=3D2 FACE=3D"Courier New">output</FONT><FONT COLOR=3D"#006400" =
SIZE=3D2 FACE=3D"Courier New">.</FONT><B><FONT COLOR=3D"#191970" =
SIZE=3D2 FACE=3D"Courier New">WriteLine</FONT></B><FONT =
COLOR=3D"#006400" SIZE=3D2 FACE=3D"Courier New">();</FONT>
<BR> =
=
<FONT COLOR=3D"#006400" =
SIZE=3D2 FACE=3D"Courier New">}</FONT>
</P>
<BR>
<P><FONT SIZE=3D2 FACE=3D"Courier New">Unclear for me is the right =
placing location for "Option Strict Off" and "Option =
Explicit On"</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">The same with "Imports =
Microsoft.VisualBasic" and "Imports ASP"</FONT>
</P>
<BR>
<P><FONT FACE=3D"Courier New"></FONT> <FONT SIZE=3D1 =
FACE=3D"Tahoma">-----Urspr=FCngliche Nachricht-----</FONT>
<BR><B><FONT SIZE=3D1 FACE=3D"Tahoma">Von: </FONT></B> <FONT =
SIZE=3D1 FACE=3D"Tahoma">Jochen Wezel </FONT>
<BR><B><FONT SIZE=3D1 =
FACE=3D"Tahoma">Gesendet: </FONT></B> =
<FONT SIZE=3D1 FACE=3D"Tahoma">Mittwoch, 5. November 2003 15:26</FONT>
<BR><B><FONT SIZE=3D1 =
FACE=3D"Tahoma">An: </FONT></B> <FONT SIZE=3D1 =
FACE=3D"Tahoma">'Gonzalo Paniagua Javier'</FONT>
<BR><B><FONT SIZE=3D1 =
FACE=3D"Tahoma">Betreff: </FONT>=
</B> <FONT SIZE=3D1 FACE=3D"Tahoma">WG: ASP.NET's VB support</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Courier New">There are some differences =
regarding the standard includes and also the standard options in ASP.NET =
of Mono and MS</FONT><FONT COLOR=3D"#0000FF" SIZE=3D2 =
FACE=3D"Arial"> (here shown as VB code)</FONT><FONT SIZE=3D2 =
FACE=3D"Courier New">:</FONT></P>
<P><FONT SIZE=3D2 FACE=3D"Courier New">This is Mono:</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier =
New">=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">Line 11: Namespace ASP</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">Line 12: =
Imports System</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">Line 13: =
Imports System.Collections</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">Line 14: =
Imports System.Collections.Specialized</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">Line 15: =
Imports System.Configuration</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">Line 16: =
Imports System.Text</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">Line 17: =
Imports System.Text.RegularExpressions</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">Line 18: =
Imports System.Web</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">Line 19: =
Imports System.Web.Caching</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">Line 20: =
Imports System.Web.Security</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">Line 21: =
Imports System.Web.SessionState</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">Line 22: =
Imports System.Web.UI</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">Line 23: =
Imports System.Web.UI.WebControls =
=
=
'MS: HtmlControls first, the =
next line WebControls (TODO priority: low)</FONT></P>
<P><FONT SIZE=3D2 FACE=3D"Courier New">Line 24: =
Imports System.Web.UI.HtmlControls</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Courier New">This is MS:</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier =
New">=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">Zeile 11: Option =
Strict Off =
=
=
=
=
'missing in Mono's =
ASP.NET</FONT> <FONT SIZE=3D2 FACE=3D"Courier New">(TODO priority: =
high)</FONT></P>
<P><FONT SIZE=3D2 FACE=3D"Courier New">Zeile 12: Option =
Explicit On =
=
=
=
'missing in Mono's =
ASP.NET</FONT> <FONT SIZE=3D2 FACE=3D"Courier New">(TODO priority: =
high)</FONT></P>
<P><FONT SIZE=3D2 FACE=3D"Courier New">Zeile 13: =
=
=
=
=
=
=
=
'missing in Mono's =
ASP.NET</FONT> <FONT SIZE=3D2 FACE=3D"Courier New">(TODO priority: =
high)</FONT></P>
<P><FONT SIZE=3D2 FACE=3D"Courier New">Zeile 14: Imports ASP =
=
=
=
=
=
=
'missing in Mono's =
ASP.NET</FONT> <FONT SIZE=3D2 FACE=3D"Courier New">(TODO priority: =
high)</FONT></P>
<P><FONT SIZE=3D2 FACE=3D"Courier New">Zeile 15: Imports =
Microsoft.VisualBasic =
=
=
=
'missing in Mono's =
ASP.NET</FONT> <FONT SIZE=3D2 FACE=3D"Courier New">(TODO priority: =
high)</FONT></P>
<P><FONT SIZE=3D2 FACE=3D"Courier New">Zeile 16: Imports =
System</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">Zeile 17: Imports =
System.Collections</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">Zeile 18: Imports =
System.Collections.Specialized</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">Zeile 19: Imports =
System.Configuration</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">Zeile 20: Imports =
System.Text</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">Zeile 21: Imports =
System.Text.RegularExpressions</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">Zeile 22: Imports =
System.Web</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">Zeile 23: Imports =
System.Web.Caching</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">Zeile 24: Imports =
System.Web.Security</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">Zeile 25: Imports =
System.Web.SessionState</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">Zeile 26: Imports =
System.Web.UI</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">Zeile 27: Imports =
System.Web.UI.HtmlControls</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">Zeile 28: Imports =
System.Web.UI.WebControls</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">Zeile 29: </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">Zeile 30: Namespace =
ASP</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">Zeile =
31: </FONT>=20
</P>
</BODY>
</HTML>
------_=_NextPart_001_01C3A504.D9A64977--