[Mono-list] Context object inside Web service constructor.
Gonzalo Paniagua Javier
gonzalo.reply.to.the.list.iam.subscribed@ximian.com
Tue, 17 Aug 2004 12:47:08 -0400
On Tue, 2004-08-17 at 12:37, Mariano Alarcon wrote:
> Here is a small web service that behaves strangelly:
> ...
> [WebService]
> public class ContextInsideConstructor : System.Web.Services.WebService {
> public ContextInsideConstructor() {
> //CODEGEN: This call is required by the ASP.NET Web Services
> Designer
> InitializeComponent();
>
> // This throws a Null Reference Exception on mono
> string fails1 = Context.Request.PhysicalApplicationPath;
> string fails2 = Context.Request.Url.AbsoluteUri;
> }
>
> [WebMethod]
> public string ReturnPhisicalPath() {
> // This works fine
> return Context.Request.PhysicalApplicationPath;
> }
>
> [WebMethod]
> public string ReturnAbsoluteUri() {
> // This works fine too
> return Context.Request.Url.AbsoluteUri;
> }
> ...
>
> This web service was created with VS.NET 2003 and it works fine on
> Windows with the .NET 1.1 from ms. However, mono 1.0 running on linux
> gives a NullReferenceException when trying to call either webmethod.
> Commenting the lines in the constructor of the WS solves the problem. So
> I am guessing the Context object is not properly initialized by the time
> mod_mono or xsp hit the constructor.
>
> This is as far as I am willing to go. Hope it helps.
It does not help. Read http://www.mono-project.com/using/bugs.html for a
check list when reporting a bug.
-Gonzalo