• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 465
  • Last Modified:

ASP.NET 3.5 | Ticks must be between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks.

Hi experts,

Suddenly and with no any changes on my project, except changing some fonts in the CSS file, I started getting this error:
---------------------------------------------------------------------------------------------------------------
Ticks must be between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks.
---------------------------------------------------------------------------------------------------------------
The error appears with no any references to a page or a line of code when I try building my project. However, if I try publishing the project it shows me the error on almost all the pages and points to a line where I have referenced a user control on all my pages:
---------------------------------------------------------------------------------------------------------------
<%@ Register Src="../../DesktopModuleTitle.ascx" TagName="DesktopModuleTitle" TagPrefix="uc1" %>
---------------------------------------------------------------------------------------------------------------
This ascx registration is repeated inside all of my aspx files, and it shows the error on all of these!
What went wrong, and how do I get rid of this error?
0
feesu
Asked:
feesu
  • 6
  • 4
  • 2
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
there must be a change, presumably in that usercontrol.
check the constructor and class properties of it, so each datetime typed value is properly initialized.
0
 
käµfm³d 👽Commented:
I haven't dealt with this issue myself, but according to this:

http://runtingsproper.blogspot.com/2010/03/solved-error-1-ticks-must-be-between.html

...the issue might be with one of your static content files (e.g. an image file). You might want to check the timestamps of your content files to see if they suffer something similar to the missing dates outlined in the linked article.
0
 
feesuAuthor Commented:
a3,

I confirm I haven't changed anything except for some CSS content.

The user control's markup is very simple:
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="DesktopModuleTitle.ascx.vb" Inherits="DesktopModuleTitle" %>

<table id="tbl_0_container" runat="server" cellpadding="1" cellspacing="0" 
    width="100%" border="0" bordercolor="Blue">
    <tr>
        <td id="td_container_title" class="module_Title" runat="server">
            <table id="tbl_Title" runat="server" cellpadding="0" cellspacing="0" border="0" 
                bordercolor="Red" >
                <tr>
                    <td id="td_titleImage" runat="server" align="<%$ Resources:Resource, LeftAligned %>">
                        <asp:Image ID="img_ModuleTitleImage" runat="server"  />
                    </td>
                    <td runat="server" align="<%$ Resources:Resource, LeftAligned %>" id="td_title">
                        <asp:Label ID="lbl_ModuleTitle" runat="server" EnableViewState="False"></asp:Label>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td id="td_container_subTitle" class="module_subTitle" runat="server">
            <table id="tbl_subTitle" runat="server" cellpadding="0" cellspacing="0" 
                border="0" bordercolor="Red" >
                <tr>
                    <td runat="server" align="<%$ Resources:Resource, LeftAligned %>">
                        <asp:Label 
                                ID="lbl_ModuleSubTitle" 
                                runat="server" 
                                EnableViewState="False">
                        </asp:Label>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>

<asp:TextBox ID="txt_AlternativeClass" runat="server" BackColor="#CC0000" Visible="False" Width="10px"></asp:TextBox> 

Open in new window



Kaufmed,

I had seen that article, where the user had a jpg issue. Mine does not apply there.
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
can we please see the code behind (DesktopModuleTitle.ascx.vb), the issue shall be in there, or in the control designer code ...
0
 
feesuAuthor Commented:
Here you go:

Partial Class DesktopModuleTitle
    Inherits System.Web.UI.UserControl

#Region "Properties"
    Private _ModuleTitle As String
    Public Property ModuleTitle() As String
        Get
            Return _ModuleTitle
        End Get
        Set(ByVal Value As String)
            _ModuleTitle = Value
            OnPropertyChanged_ModuleTitle(New ComponentModel.PropertyChangedEventArgs("moduletitle"))
        End Set
    End Property
    Private Sub OnPropertyChanged_ModuleTitle(ByVal propertyChangedEventArgs As ComponentModel.PropertyChangedEventArgs)
        Me.lbl_ModuleTitle.Text = Me.ModuleTitle
        td_container_title.Visible = CBool(lbl_ModuleTitle.Text.Trim <> "")
    End Sub

    Private _ModuleSubTitle As String
    Public Property ModuleSubTitle() As String
        Get
            Return _ModuleSubTitle
        End Get
        Set(ByVal Value As String)
            _ModuleSubTitle = Value
            OnPropertyChanged_ModuleSubTitle(New ComponentModel.PropertyChangedEventArgs("ModuleSubTitle"))
        End Set
    End Property
    Private Sub OnPropertyChanged_ModuleSubTitle(ByVal propertyChangedEventArgs As ComponentModel.PropertyChangedEventArgs)
        Me.lbl_ModuleSubTitle.Text = Me.ModuleSubTitle
        td_container_subTitle.Visible = CBool(lbl_ModuleSubTitle.Text.Trim <> "")
    End Sub

    Private _AlternativeClass As Boolean
    Public Property AlternativeClass() As Boolean
        Get
            Return _AlternativeClass
        End Get
        Set(ByVal Value As Boolean)
            _AlternativeClass = Value
            OnPropertyChanged_AlternativeClass(New ComponentModel.PropertyChangedEventArgs("AlternativeClass"))
        End Set
    End Property
    Private Sub OnPropertyChanged_AlternativeClass(ByVal propertyChangedEventArgs As ComponentModel.PropertyChangedEventArgs)
        If Me.AlternativeClass = True Then
            Me.td_container_title.Attributes.Add("Class", "module_Title_alternative")
            Me.td_container_subTitle.Attributes.Add("Class", "module_subTitle_alternative")
        End If
    End Sub

#End Region

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        ' Obtain PortalSettings from Current Context
        Dim _portalSettings As PortalSettings = CType(HttpContext.Current.Items("PortalSettings"), PortalSettings)

        ' Obtain reference to parent portal module
        Dim portalModule As PortalModuleControl '20091212 to avoid below mentioned error
        If TypeOf (Me.Parent) Is UserControl Then
            portalModule = CType(Me.Parent, PortalModuleControl)

        ElseIf TypeOf (Me.Parent.Parent) Is UserControl Then
            portalModule = CType(Me.Parent.Parent, PortalModuleControl)

        ElseIf TypeOf (Me.Parent.Parent.Parent) Is UserControl Then
            portalModule = CType(Me.Parent.Parent.Parent, PortalModuleControl)

        ElseIf TypeOf (Me.Parent.Parent.Parent.Parent) Is UserControl Then
            portalModule = CType(Me.Parent.Parent.Parent.Parent, PortalModuleControl)

        ElseIf TypeOf (Me.Parent.Parent.Parent.Parent.Parent) Is UserControl Then
            portalModule = CType(Me.Parent.Parent.Parent.Parent.Parent, PortalModuleControl)

        ElseIf TypeOf (Me.Parent.Parent.Parent.Parent.Parent.Parent) Is UserControl Then
            portalModule = CType(Me.Parent.Parent.Parent.Parent.Parent.Parent, PortalModuleControl)

        ElseIf TypeOf (Me.Parent.Parent.Parent.Parent.Parent.Parent.Parent) Is UserControl Then
            portalModule = CType(Me.Parent.Parent.Parent.Parent.Parent.Parent.Parent, PortalModuleControl)

        End If
        'With Me.Parent
        '    If TypeOf (.Parent) Is System.Web.UI.HtmlControls.HtmlTableCell Then
        '        'portalModule = CType(Me.Parent, PortalModuleControl) 'NOTE: this created a runtime cast error after i changed the container table in the user control to run at server
        '        'Else
        '        portalModule = CType(Me.Parent.Parent.Parent.Parent.Parent, PortalModuleControl)
        '    Else
        '        portalModule = CType(Me.Parent.Parent.Parent.Parent, PortalModuleControl)
        '    End If
        'End With

        ' Display Modular Title Text and Edit Buttons

        If Not IsPostBack Then
            Dim sTitleImage As String = portalModule.ModuleConfiguration.ModuleTitleImage
            If sTitleImage.Trim = "" Then
                img_ModuleTitleImage.Visible = False
                td_titleImage.Visible = False
                'td_titleImage_partition.Visible = False
            Else
                img_ModuleTitleImage.ImageUrl = "~\files\" & sTitleImage
                td_titleImage.Visible = True
                'td_titleImage_partition.Visible = True
            End If

            '20100212
            'If Not IsPostBack Then
            '    If titleClass.Trim <> "" Then
            '        Me.txtTitleClass.Value = titleClass
            '    End If
            'End If


            'Me.pageTitle = Me.lblModuleTitle.Text
            'lblModuleTitle.Text = portalModule.ModuleConfiguration.ModuleTitle
            lbl_ModuleTitle.Text = portalModule.ModuleConfiguration.ModuleTitle
            lbl_ModuleSubTitle.Text = portalModule.ModuleConfiguration.ModuleSubTitle

            td_container_title.Visible = CBool(lbl_ModuleTitle.Text.Trim <> "" Or sTitleImage.Trim <> "")
            td_container_subTitle.Visible = CBool(lbl_ModuleSubTitle.Text.Trim <> "")

            'If PortalSecurity.IsInRoles(PortalSecurity.GetPermissionRoles(Module_IKey, Actions.Edit)) Then

            'End If
        End If

    End Sub
End Class

Open in new window

Partial Class DesktopModuleTitle
    Inherits System.Web.UI.UserControl

#Region "Properties"
    Private _ModuleTitle As String
    Public Property ModuleTitle() As String
        Get
            Return _ModuleTitle
        End Get
        Set(ByVal Value As String)
            _ModuleTitle = Value
            OnPropertyChanged_ModuleTitle(New ComponentModel.PropertyChangedEventArgs("moduletitle"))
        End Set
    End Property
    Private Sub OnPropertyChanged_ModuleTitle(ByVal propertyChangedEventArgs As ComponentModel.PropertyChangedEventArgs)
        Me.lbl_ModuleTitle.Text = Me.ModuleTitle
        td_container_title.Visible = CBool(lbl_ModuleTitle.Text.Trim <> "")
    End Sub

    Private _ModuleSubTitle As String
    Public Property ModuleSubTitle() As String
        Get
            Return _ModuleSubTitle
        End Get
        Set(ByVal Value As String)
            _ModuleSubTitle = Value
            OnPropertyChanged_ModuleSubTitle(New ComponentModel.PropertyChangedEventArgs("ModuleSubTitle"))
        End Set
    End Property
    Private Sub OnPropertyChanged_ModuleSubTitle(ByVal propertyChangedEventArgs As ComponentModel.PropertyChangedEventArgs)
        Me.lbl_ModuleSubTitle.Text = Me.ModuleSubTitle
        td_container_subTitle.Visible = CBool(lbl_ModuleSubTitle.Text.Trim <> "")
    End Sub

    Private _AlternativeClass As Boolean
    Public Property AlternativeClass() As Boolean
        Get
            Return _AlternativeClass
        End Get
        Set(ByVal Value As Boolean)
            _AlternativeClass = Value
            OnPropertyChanged_AlternativeClass(New ComponentModel.PropertyChangedEventArgs("AlternativeClass"))
        End Set
    End Property
    Private Sub OnPropertyChanged_AlternativeClass(ByVal propertyChangedEventArgs As ComponentModel.PropertyChangedEventArgs)
        If Me.AlternativeClass = True Then
            Me.td_container_title.Attributes.Add("Class", "module_Title_alternative")
            Me.td_container_subTitle.Attributes.Add("Class", "module_subTitle_alternative")
        End If
    End Sub

#End Region

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        ' Obtain PortalSettings from Current Context
        Dim _portalSettings As PortalSettings = CType(HttpContext.Current.Items("PortalSettings"), PortalSettings)

        ' Obtain reference to parent portal module
        Dim portalModule As PortalModuleControl '20091212 to avoid below mentioned error
        If TypeOf (Me.Parent) Is UserControl Then
            portalModule = CType(Me.Parent, PortalModuleControl)

        ElseIf TypeOf (Me.Parent.Parent) Is UserControl Then
            portalModule = CType(Me.Parent.Parent, PortalModuleControl)

        ElseIf TypeOf (Me.Parent.Parent.Parent) Is UserControl Then
            portalModule = CType(Me.Parent.Parent.Parent, PortalModuleControl)

        ElseIf TypeOf (Me.Parent.Parent.Parent.Parent) Is UserControl Then
            portalModule = CType(Me.Parent.Parent.Parent.Parent, PortalModuleControl)

        ElseIf TypeOf (Me.Parent.Parent.Parent.Parent.Parent) Is UserControl Then
            portalModule = CType(Me.Parent.Parent.Parent.Parent.Parent, PortalModuleControl)

        ElseIf TypeOf (Me.Parent.Parent.Parent.Parent.Parent.Parent) Is UserControl Then
            portalModule = CType(Me.Parent.Parent.Parent.Parent.Parent.Parent, PortalModuleControl)

        ElseIf TypeOf (Me.Parent.Parent.Parent.Parent.Parent.Parent.Parent) Is UserControl Then
            portalModule = CType(Me.Parent.Parent.Parent.Parent.Parent.Parent.Parent, PortalModuleControl)

        End If
        'With Me.Parent
        '    If TypeOf (.Parent) Is System.Web.UI.HtmlControls.HtmlTableCell Then
        '        'portalModule = CType(Me.Parent, PortalModuleControl) 'NOTE: this created a runtime cast error after i changed the container table in the user control to run at server
        '        'Else
        '        portalModule = CType(Me.Parent.Parent.Parent.Parent.Parent, PortalModuleControl)
        '    Else
        '        portalModule = CType(Me.Parent.Parent.Parent.Parent, PortalModuleControl)
        '    End If
        'End With

        ' Display Modular Title Text and Edit Buttons

        If Not IsPostBack Then
            Dim sTitleImage As String = portalModule.ModuleConfiguration.ModuleTitleImage
            If sTitleImage.Trim = "" Then
                img_ModuleTitleImage.Visible = False
                td_titleImage.Visible = False
                'td_titleImage_partition.Visible = False
            Else
                img_ModuleTitleImage.ImageUrl = "~\files\" & sTitleImage
                td_titleImage.Visible = True
                'td_titleImage_partition.Visible = True
            End If

            '20100212
            'If Not IsPostBack Then
            '    If titleClass.Trim <> "" Then
            '        Me.txtTitleClass.Value = titleClass
            '    End If
            'End If


            'Me.pageTitle = Me.lblModuleTitle.Text
            'lblModuleTitle.Text = portalModule.ModuleConfiguration.ModuleTitle
            lbl_ModuleTitle.Text = portalModule.ModuleConfiguration.ModuleTitle
            lbl_ModuleSubTitle.Text = portalModule.ModuleConfiguration.ModuleSubTitle

            td_container_title.Visible = CBool(lbl_ModuleTitle.Text.Trim <> "" Or sTitleImage.Trim <> "")
            td_container_subTitle.Visible = CBool(lbl_ModuleSubTitle.Text.Trim <> "")

            'If PortalSecurity.IsInRoles(PortalSecurity.GetPermissionRoles(Module_IKey, Actions.Edit)) Then

            'End If
        End If

    End Sub
End Class

Open in new window

0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
I must admit that I don't see what could be wrong there.
can you get the file before those changes, and see if you get still the same issue?
0
 
feesuAuthor Commented:
a3,

That's all I initially added when I got different errors to do with the format itself, but later started getting the current error. I have removed what I've added completely but still that error didin't go away:

/* Generated by Font Squirrel (http://www.fontsquirrel.com) on March 12, 2014 */



@font-face {
    font-family: 'source_sans_prolight';
    src: url('sourcesanspro-light-webfont.eot');
    src: url('sourcesanspro-light-webfont.eot?#iefix') format('embedded-opentype'),
         url('sourcesanspro-light-webfont.woff') format('woff'),
         url('sourcesanspro-light-webfont.ttf') format('truetype'),
         url('sourcesanspro-light-webfont.svg#source_sans_prolight') format('svg');
    font-weight: normal;
    font-style: normal;

}
0
 
käµfm³d 👽Commented:
where the user had a jpg issue. Mine does not apply there.
I have removed what I've added completely but still that error didin't go away
What about those font and vector graphics files you are embedding?
0
 
feesuAuthor Commented:
I only added the previous lines to the CSS file and a folder holding the fonts. I removed the code of the CSS and deleted the folder.
0
 
feesuAuthor Commented:
Hi Experts,

All I did was that I excluded the CSS file, and re-included it, and the problem was gone!

This is so weird that I cannot justify.

Thanks,
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
the wonders of "visual studio" sometimes getting weird ...
0
 
feesuAuthor Commented:
This is what actually solved my problem. Although it does not have a proper justification.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 6
  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now