Im not sure why I am running into a circular reference when trying to register script descriptors. Here is my code for the user control:
protected void Page_Load(object sender, EventArgs eventArguments)
{
}
protected override void OnPreRender(EventArgs eventArguments)
{
ScriptManager.GetCurrent(Page).RegisterScriptControl(this);
base.OnPreRender(eventArguments);
}
protected override void Render(HtmlTextWriter htmlWriter)
{
ScriptManager.GetCurrent(Page).RegisterScriptDescriptors(this);
base.Render(htmlWriter);
}
I am getting the exception ( System.InvalidOperationException: A circular reference was detected while serializing an object of type 'ASP.global_asax'.) on RegisterScriptDescriptors.
Here is my entire Global.asax
<%@ Application Language="C#" %>
<%@ Import Namespace="System.Web.Optimization" %>
<%@ Import Namespace="System.Web.Routing" %>
<script runat="server">
void Application_Start(object sender, EventArgs e)
{
StockPicker.BundleConfig.RegisterBundles(BundleTable.Bundles);
}
</script>
Sorry, but I answered it after struggling a bit. I was using another user control in the control and I was using that control in the GetScriptDescriptors method. This was causing the circular reference.