Hello all,

No matter what I try, I can't seem to get the hybrid web scope working
with an asynchronous action when using Mono (tested on 2.6.1, 2.6.3,
and 2.6.4).  Each time I get a NullRefEx in either the OnEndRequest
method or the SessionScopeWebModule.  Here is the stacktrace running
locally on a windows machine using XSP2:

System.NullReferenceException: Object reference not set to an instance
of an object
  at [MyApp].Global.OnEndRequest (System.Object sender,
System.EventArgs e) [0x00000] in <filename unknown>:0
  at (wrapper delegate-invoke)
System.EventHandler:invoke_void__this___object_EventArgs
(object,System.EventArgs)
  at (wrapper delegate-invoke)
System.EventHandler:invoke_void__this___object_EventArgs
(object,System.EventArgs)
  at (wrapper delegate-invoke)
System.EventHandler:invoke_void__this___object_EventArgs
(object,System.EventArgs)
  at System.Web.HttpApplication.PipelineDone () [0x0001c] in C:\cygwin
\tmp\monobuild\build\BUILD\mono-2.6.4\mcs\class\System.Web\System.Web
\HttpApplication.cs:1106

Here is the same stack trace using mod_mono on Ubuntu, notice on this
one I was using the SessionScopeWebModule:

System.NullReferenceException: Object reference not set to an instance
of an object
  at Castle.ActiveRecord.Framework.SessionScopeWebModule.OnEndRequest
(System.Object sender, System.EventArgs e) [0x00000] in <filename
unknown>:0
  at (wrapper delegate-invoke)
System.EventHandler:invoke_void__this___object_EventArgs
(object,System.EventArgs)
  at System.Web.HttpApplication.PipelineDone () [0x00000] in <filename
unknown>:0

I tried both methods (writing my own OnBegin/OnEndRequest methods and
SessionScopeWebModule) since I thought it may at first have been the
module causing the problem.

The asynchronous action is a simple example:

        public class TasksController : ARSmartDispatchController {
                public TasksController()
                        : base() {
                        asynctestTask = AsyncTestTaskRun;
                }
                private delegate string AsyncTestTask();
                private readonly AsyncTestTask asynctestTask;
                private string AsyncTestTaskRun() {
                        System.Threading.Thread.Sleep(250);
                        return "Async Test Finished Successfully";
                }

                public IAsyncResult BeginAsyncTest() {
                        return 
asynctestTask.BeginInvoke(ControllerContext.Async.Callback,
ControllerContext.Async.State);
                }

                public void EndAsyncTest() {
                        Flash["message"] =
asynctestTask.EndInvoke(ControllerContext.Async.Result);
                        RedirectToAction("index");
                }
        }

Any ideas on this one?  I've tried many things to get this working,
and I do have the HybridWebThreadScopeInfo configured on my
activerecord:
  <activerecord isWeb="true"
threadinfotype="Castle.ActiveRecord.Framework.Scopes.HybridWebThreadScopeInfo,
Castle.ActiveRecord">
     ....
  </activerecord>

Thanks!
-Brian

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en.

Reply via email to