[Mono-list] null ref. exception
Peter Hagen
peter at wingsofdeath.nu
Mon Jul 20 09:27:38 EDT 2009
Hi Marek
you are right, there were some projects at 1.1. Yesterday I changed
that, but I seemed not to have checked in my changes. I now am sure that
all the controls (even NeatUpload) are compiled as 2.0, but still the
exception occures. Im sure that the exception is throw by the IsAbsolute
method:
> public static bool IsAbsolute (string virtualPath)
> {
> if (StrUtils.IsNullOrEmpty (virtualPath))
> throw new ArgumentNullException ("virtualPath");
>
> return (virtualPath [0] == '/' || virtualPath [0] == '\\');
> }
when I print the value of virtualPath, it is indeed empty (but not null). If I just compile a control which was made for 1.1 as a 2.0 project, then things should be ok? The control that gives the exception is the neatupload inputcontrol which is derived from the FileContol, which comes from the System.Web.UI.WebControls.WebControl. I guess that should be no problem?
public abstract class FileControl : System.Web.UI.WebControls.WebControl, System.Web.UI.IPostBackDataHandler
Cheers
Peter
On Mon, 2009-07-20 at 13:18 +0200, Marek Habersack wrote:
> Peter Hagen wrote:
> > Hi Gonzalo
> >
> > I did some tests on ./mcs/class/System.Web/System.Web.UI/Control.cs and
> > noticed if the TemplateSourceDirectory is empty, I get the crash.
> >
> [snip]
> >
> > So, i added this line, which is probably not ok, but it works now. Im
> > not sure what the TemplateSourceDirectory should be in this case. Do you
> > have a suggestion?
> It should always be set to the virtual directory of the current control's parent.
> TemplateSourceDirectory can be empty only in those cases (2.0 profile):
>
> 1. this.TemplateControl is null and HttpContext.Current is null and the current control is not a
> TemplateControl
> 2. current control is a TemplateControl and this.AppRelativeVirtualPath is null, which can happen
> only if AppRelativeVirtualPath is never initialized from code generated by ASP.NET compiler.
> 3. We have a bug in 2.0 logic for Control.TemplateSourceDirectory
>
> My bet is on #2, which would mean that your application is incorrectly ported to 2.0 - make sure
> that you run it with the 2.0 runtime, that all your code-behind and referenced assemblies are
> compiled with the 2.0 compiler. It is possible that some of your controls use the 1.1 version of
> System.Web and thus hit the 1.1 path in Control.TemplateSourceDirectory.
>
> regards,
>
> marek
>
> >
> > Cheers
> >
> > Peter
> >
> > On Mon, 2009-07-20 at 00:02 -0400, Gonzalo Paniagua Javier wrote:
> >> On Sun, 2009-07-19 at 18:40 +0200, Peter Hagen wrote:
> >> > Hi Gonzalo
> >> >
> >> > well, i have a bit a problem of recreating the bug in a new project.
> >> > If i make a new project from MonoDevelop, it works as planned. But
> >> > inside my project it doesn't. But this is originally a 1.1
> >> > application. Uploading the entire project isnt really an option. So,
> >> > ill try to figure out more about the project first :s
> >>
> >> If you can build System.Web from sources, sprinkle a few
> >> Console.WriteLine() in Contorl.AppRelativeTemplateSourceDirectory and
> >> ToAppRelative. That will at least tell you where the 'null' is used for
> >> the first time.
> >>
> >> -Gonzalo
> >>
> >>
> >> _______________________________________________
> >> Mono-list maillist - Mono-list at lists.ximian.com <mailto:Mono-list at lists.ximian.com>
> >> http://lists.ximian.com/mailman/listinfo/mono-list
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Mono-list maillist - Mono-list at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20090720/f53bedda/attachment-0001.html
More information about the Mono-list
mailing list