weixin_39588209
weixin_39588209
2021-01-01 12:27

dateTimeOffset.LocalDateTime.ToLongDateString() Error

Version 3.15.0.0 namespace PackageExplorer


        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is DateTimeOffset)
            {
                DateTimeOffset dateTimeOffset = (DateTimeOffset)value;

                if (dateTimeOffset != Constants.Unpublished)
                {
                    //Use return dateTimeOffset.LocalDateTime.ToLongDateString(); Error Will automatically exit
                    return dateTimeOffset.LocalDateTime.ToShortDateString();//Use normal
                }
            }
            return null;
        }`

该提问来源于开源项目:NuGetPackageExplorer/NuGetPackageExplorer

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

6条回答

  • weixin_39614060 weixin_39614060 4月前

    I also encountered this problem

    点赞 评论 复制链接分享
  • weixin_39790760 weixin_39790760 4月前

    Is there somewhere an exception /stacktrace to see? How could we reproduce this?

    点赞 评论 复制链接分享
  • weixin_39790760 weixin_39790760 4月前

    Please use the template. We are missing needed info now.

    点赞 评论 复制链接分享
  • weixin_39614060 weixin_39614060 4月前

    I'm sorry, again according to the template

    点赞 评论 复制链接分享
  • weixin_39664431 weixin_39664431 4月前

    Full stacktrace for this error: Aplikacja: NuGetPackageExplorer.exe Wersja architektury: v4.0.30319 Opis: proces został przerwany z powodu nieobsłużonego wyjątku. Informacje o wyjątku: System.ArgumentNullException w System.String.FormatHelper(System.IFormatProvider, System.String, System.ParamsArray) w System.String.Format(System.String, System.Object[]) w Humanizer.Localisation.Formatters.DefaultFormatter.Format(System.String, Int32) w Humanizer.Localisation.Formatters.DefaultFormatter.DateHumanize(Humanizer.Localisation.TimeUnit, Humanizer.Localisation.Tense, Int32) w Humanizer.DateTimeHumanizeStrategy.DateTimeHumanizeAlgorithms.DefaultHumanize(System.DateTime, System.DateTime, System.Globalization.CultureInfo) w Humanizer.DateTimeHumanizeStrategy.DefaultDateTimeHumanizeStrategy.Humanize(System.DateTime, System.DateTime, System.Globalization.CultureInfo) w Humanizer.DateHumanizeExtensions.Humanize(System.DateTime, Boolean, System.Nullable`1, System.Globalization.CultureInfo) w PackageExplorer.DateTimeOffsetHumanizeConverter.Convert(System.Object, System.Type, System.Object, System.Globalization.CultureInfo) w System.Windows.Data.BindingExpression.TransferValue(System.Object, Boolean) w System.Windows.Data.BindingExpression.Activate(System.Object) w System.Windows.Data.BindingExpression.AttachToContext(AttachAttempt) w System.Windows.Data.BindingExpression.MS.Internal.Data.IDataBindEngineClient.AttachToContext(Boolean) w MS.Internal.Data.DataBindEngine+Task.Run(Boolean) w MS.Internal.Data.DataBindEngine.Run(System.Object) w MS.Internal.Data.DataBindEngine.OnLayoutUpdated(System.Object, System.EventArgs) w System.Windows.ContextLayoutManager.fireLayoutUpdateEvent() w System.Windows.ContextLayoutManager.UpdateLayout() w System.Windows.ContextLayoutManager.UpdateLayoutCallback(System.Object) w System.Windows.Media.MediaContext+InvokeOnRenderCallback.DoWork() w System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks() w System.Windows.Media.MediaContext.RenderMessageHandlerCore(System.Object) w System.Windows.Media.MediaContext.RenderMessageHandler(System.Object) w System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) w System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) w System.Windows.Threading.DispatcherOperation.InvokeImpl() w System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(System.Object) w System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) w System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) w System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) w MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object) w System.Windows.Threading.DispatcherOperation.Invoke() w System.Windows.Threading.Dispatcher.ProcessQueue() w System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) w MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) w MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object) w System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) w System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) w System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32) w MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr) w MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef) w System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame) w System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame) w System.Windows.Window.ShowHelper(System.Object) w System.Windows.Window.Show() w System.Windows.Window.ShowDialog() w PackageExplorer.PackageChooserService.SelectPackage(System.String) w PackageExplorer.MainWindow+d__47.MoveNext() w System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task) w System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task) w PackageExplorer.MainWindow+d__45.MoveNext() w System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b__6_0(System.Object) w System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) w System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) w System.Windows.Threading.DispatcherOperation.InvokeImpl() w System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(System.Object) w System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) w System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) w System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) w MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object) w System.Windows.Threading.DispatcherOperation.Invoke() w System.Windows.Threading.Dispatcher.ProcessQueue() w System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) w MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) w MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object) w System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) w System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) w System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32) w MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr) w MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef) w System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame) w System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame) w System.Windows.Application.RunDispatcher(System.Object) w System.Windows.Application.RunInternal(System.Windows.Window) w System.Windows.Application.Run(System.Windows.Window) w PackageExplorer.App.Main()

    点赞 评论 复制链接分享
  • weixin_39790760 weixin_39790760 4月前

    Fixed by #103

    点赞 评论 复制链接分享

相关推荐