【问题标题】:System.FormatException with ScriptManagerSystem.FormatException 与 ScriptManager
【发布时间】:2013-02-04 10:13:27
【问题描述】:

我在 ASP.NET 页面中使用ScriptManager

<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

从那时起,每次我重建页面(加载程序集)时都会发生错误:

[FormatException: String was not recognized as a valid DateTime.]
   System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) +3624418
   System.Windows.Forms.TypeLibraryTimeStampAttribute..ctor(String timestamp) +49
   System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs) +0
   System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs) +46
   System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) +529
   System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) +103
   System.Reflection.RuntimeAssembly.GetCustomAttributes(Boolean inherit) +33
   System.Web.UI.AssemblyCache.GetAjaxFrameworkAssemblyAttribute(Assembly assembly) +76
   System.Web.UI.ScriptManager.get_DefaultAjaxFrameworkAssembly() +399
   System.Web.UI.ScriptManager..ctor() +26
   ASP.usercontrols_asyncprocessingmonitor_ascx.__BuildControlScriptManager1() in d:\Developpement\Projects\CyberClasse\LNMManager\ManagementConsole\UserControls\AsyncProcessingMonitor.ascx:5
   ASP.usercontrols_asyncprocessingmonitor_ascx.__BuildControlTree(usercontrols_asyncprocessingmonitor_ascx __ctrl) in d:\Developpement\Projects\CyberClasse\LNMManager\ManagementConsole\UserControls\AsyncProcessingMonitor.ascx:1
   ASP.usercontrols_asyncprocessingmonitor_ascx.FrameworkInitialize() in d:\Developpement\Projects\CyberClasse\LNMManager\ManagementConsole\UserControls\AsyncProcessingMonitor.ascx.cs:912307
   System.Web.UI.UserControl.InitializeAsUserControlInternal() +35
   System.Web.UI.UserControl.InitializeAsUserControl(Page page) +14
   ASP.provisioning_default_aspx.__BuildControlasyncProcessingMonitor1() in d:\Developpement\Projects\CyberClasse\LNMManager\ManagementConsole\Provisioning\default.aspx:124
   ASP.provisioning_default_aspx.__BuildControlpnlProcessMonitor() in d:\Developpement\Projects\CyberClasse\LNMManager\ManagementConsole\Provisioning\default.aspx:123
   ASP.provisioning_default_aspx.__BuildControlForm1() in d:\Developpement\Projects\CyberClasse\LNMManager\ManagementConsole\Provisioning\default.aspx:51
   ASP.provisioning_default_aspx.__BuildControlTree(provisioning_default_aspx __ctrl) in d:\Developpement\Projects\CyberClasse\LNMManager\ManagementConsole\Provisioning\default.aspx:1
   ASP.provisioning_default_aspx.FrameworkInitialize() in d:\Developpement\Projects\CyberClasse\LNMManager\ManagementConsole\Provisioning\default.aspx.cs:912308
   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +54
   System.Web.UI.Page.ProcessRequest() +78
   System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
   System.Web.UI.Page.ProcessRequest(HttpContext context) +49
   ASP.provisioning_default_aspx.ProcessRequest(HttpContext context) in c:\Users\nba\AppData\Local\Temp\Temporary ASP.NET Files\managementconsole\6fc95b25\3fc34eab\App_Web_pm33amsb.2.cs:0
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +100
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

刷新页面后,错误就会消失。 我不明白这个错误。在许多论坛中,都将 System.Windows.Forms 程序集作为此错误的来源。这个程序集在我的网站项目中被引用,但我删除了它,错误仍然出现。

编辑

例如,herehere 报告了此问题(但与自定义脚本管理器有关)。

编辑 2

嗯。这是用户控件的一些代码,插入到asp.net页面中。

<asp:UpdatePanel ID="UpdatePanel1" runat="server" style="width:70%;" >
    <ContentTemplate>
        <asp:HiddenField ID="HiddenFieldProcessID" runat="server" />
        <asp:HiddenField ID="HiddenFieldRedirectURL" runat="server" Value="" />
        <asp:HiddenField ID="HiddenFieldRedirect" runat="server" Value="false" />
        <asp:Timer ID="TimerStatusUpdate" runat="server" Interval="1000" OnTick="TimerStatusUpdateTick"></asp:Timer>
        <br/><br/>
        <div align="center"><asp:Image ID="ImageProgressGif" runat="server" ImageUrl="https://cms.unov.org/FullTextSearch/Common/Images/progress.gif" /></div>
        <br/>
        <table>
            <tr>
                <td style="width: 30%;">Label Text :
                </td>
                <td>
                    <b>
                        <asp:Label ID="LabelCurrent" runat="server"></asp:Label> / <asp:Label ID="LabelTotal" runat="server"></asp:Label>
                    </b>
                    <input id="inputpercentage" name="inputpercentage" type="text" runat="server" hidden="true"/>
                    <input type="hidden" runat='server' id="completed" value="" />
                    <br/>
                </td>
            </tr>
        </table>
        <table>
            <tr>
                <td>
                    <asp:label id="LabelExportInfo" runat="server" Width="100%" Visible="true" Font-Size="Small" ForeColor="#6666FF"></asp:label>
                    <asp:linkbutton id="LinkExportInfo" runat="server" Width="100%" Visible="true" OnClick="DownloadFile" Font-Size="Small"></asp:linkbutton>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="LabelPasswordChanged" runat="server" Font-Size="Small" ForeColor="Red"></asp:Label>
                </td>
            </tr>
        </table>
    </ContentTemplate>
</asp:UpdatePanel>

但是,正如我所说,堆栈跟踪和提供的主题显示的报告问题来自程序集(它的“TypeLibraryTimeStampAttribute”属性更具体)。但是,我的观点是,我怎么知道它是关于哪个程序集的?

此外,我已按照主题中的建议删除了项目中对 System.Windows.Form 的引用,但没有结果。

编辑 3

一位同事在他的计算机上打开了该项目,构建并运行它,没有任何错误。他的一切都很好。所以,明确地说,这个问题在代码外部。 我就像他岛上的约翰洛克:迷路了。

有什么线索吗?

【问题讨论】:

  • String was not recognized as a valid DateTime. 错误很明显,与 ScriptManager 无关。
  • 这个错误是一般的 c# 错误,只是因为你的页面被包裹在 scriptManager 中(实际上使用 xmlHTTPhandler)它在页面的特定块中显示为错误,登录到控制台,因为它是部分页面渲染。
  • @walther 感谢您的评论。我知道那是什么意思,完全不适合我的情况。你没有帮助。
  • @VishalSachdeva 我的代码不包含任何日期解析(嗯,事实上,根本没有解析器,甚至在 javascript 中也不包含)。此外,您如何解释使错误消失的重新加载?
  • 我更新了我的问题。我提供了类似问题的主题。

标签: asp.net ajax scriptmanager


【解决方案1】:

花了几个小时解决这个问题后,我找到了原因。

它是我的项目中需要的一个程序集,AxAcroPDFLib.dll(需要 AcroPDFLib.dll 并生成 AxAcroPDFLib.dll 的 Migradoc)。它有一个日期格式错误的属性。 This guy 和我有同样的问题。

但我无法取消使用 Migradoc,所以我的问题仍然存在,但现在,我知道究竟是什么错误,以及它发生的原因。

编辑:问题已解决

问题已部分解决。 我清理了我的项目需要的程序集。两个 PDFSharp dll 没用,所以我删除了引用,删除了所有 bin 文件夹,并重建了我的解决方案。 和 TADAAAA。 AxAcroPDFLib.dll 已消失,错误不再出现。

【讨论】:

    猜你喜欢
    • 2021-03-17
    • 2015-02-21
    • 2011-07-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多