Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localization.IsLocalizationEnabled() not working within PageAsyncTask #486

Closed
XHale84 opened this issue May 23, 2019 · 1 comment

Comments

@XHale84
Copy link

commented May 23, 2019

The AJAX Control Toolkit \18.1.1

The installation method

  • NuGet package

Minimal steps to reproduce the bug

After migrating to AjaxControlToolkit 18.1.1 from 3.5 we are facing problems with AsyncTasks. We are loading Custom Controls (ascx) content within a AsyncTask via Page.RegisterAsyncTask().
But in this case we are getting a NullRefrenceExeption with the following StackTrace:

AjaxControlToolkit.Localization.IsLocalizationEnabled() bei
AjaxControlToolkit.Localization.GetLocaleKey() bei AjaxControlToolkit.Localization.RegisterLocalization(ClientScriptManager scriptManager, Type type) bei AjaxControlToolkit.ExtenderControlBase.OnPreRender(EventArgs e) bei System.Web.UI.Control.PreRenderRecursiveInternal() bei System.Web.UI.Control.PreRenderRecursiveInternal() bei System.Web.UI.Control.PreRenderRecursiveInternal() bei System.Web.UI.Control.PreRenderRecursiveInternal() bei
System.Web.UI.Control.AddedControl(Control control, Int32 index) bei System.Web.UI.ControlCollection.Add(Control child) bei System.Web.UI.WebControls.Repeater.CreateItem(Int32 itemIndex, ListItemType itemType, Boolean dataBind, Object dataItem) bei System.Web.UI.WebControls.Repeater.AddDataItemsIntoItemsArray(IEnumerable dataSource, Boolean useDataSource) bei
System.Web.UI.WebControls.Repeater.PostGetDataAction(IEnumerable dataSource) bei System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource) bei System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e) bei System.Web.UI.WebControls.Repeater.DataBind() bei
...
System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs) bei System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink) Exception rethrown at [0]: bei System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase) bei System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData) bei System.Action.EndInvoke(IAsyncResult result) bei
...

Actual result

NullReferenceException.
The problem is, that there is no HttpContext at this point, therefore the line
Page page = HttpContext.Current.Handler as Page;
will throw a NullReferenceException.

Expected result

The site should load as normal.

Browser(s) used

Chrome

A site deployment method

  • IIS
@XHale84

This comment has been minimized.

Copy link
Author

commented May 23, 2019

I think that could easily be fixed by replacing Localization.cs line 115 through this

var page = HttpContext.Current?.Handler as Page;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.