Skip to content

NET6 - Wrong DateTime.ToString() formating when using monoVM and linux-arm #61598

Closed

Description

@michaldobrodenka

Description

DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") - returns
2021-11-15 14:54:33.3378046 -when app is published with -p:UseMonoRuntime=true.
When using default runtime (without -p:UseMonoRuntime=true) it returns
2021-11-15 15:58:30.675

Reproduction Steps

I was testing minimum possible delay with following program:

using System.Diagnostics;

Stopwatch sw = new Stopwatch();

while(true)
{
    sw.Restart();
    Thread.Sleep(1);
    sw.Stop();
    Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")} - Elapsed {sw.ElapsedMilliseconds}");
}

compiled with
dotnet publish -r linux-arm -p:PublishTrimmed=True -p:TrimMode=Link --self-contained true -c Release -f net6.0 -o bin\dotnet\mono -p:UseMonoRuntime=true for mono VM
and
dotnet publish -r linux-arm -p:PublishTrimmed=True -p:TrimMode=Link --self-contained true -c Release -f net6.0 -o bin\dotnet
for default runtime

Expected behavior

fff in DateTime.ToString() should return 1/1000ths of second

Actual behavior

fff in DateTime.ToString() return 1/10 000 000 of second

in screenshot - first with mono, then with dotnet default
image

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

Tested on 32bit linux-arm on Yocto linux

Activity

  1. ghost added
    untriaged
    on Nov 15, 2021
  2. changed the title [-]NET6 - Wrong millisecond time formating when using monoVM[/-] [+]NET6 - Wrong DateTime.ToString() formating when using monoVM[/+] on Nov 15, 2021
  3. added and removed
    untriaged
    on Nov 15, 2021
  4. added this to the 6.0.x milestone on Nov 15, 2021
  5. changed the title [-]NET6 - Wrong DateTime.ToString() formating when using monoVM[/-] [+]NET6 - Wrong DateTime.ToString() formating when using monoVM and linux-arm[/+] on Nov 15, 2021
  6. Clockwork-Muse commented on Nov 15, 2021

    @Clockwork-Muse
    Contributor

    .... the formatting code is unlikely to be in a runtime-dependent section. If you completely clean your build directories, does the issue persist?

  7. michaldobrodenka commented on Nov 15, 2021

    @michaldobrodenka
    Author

    Yes, I've retested it, deleted all the bin/obj and publish folders.

  8. michaldobrodenka commented on Nov 15, 2021

    @michaldobrodenka
    Author

    The same program running on Windows PC from VS and deployed to ARM mini PC:
    image

  9. michaldobrodenka commented on Nov 15, 2021

    @michaldobrodenka
    Author

    Deleted bin, obj & publish folders, dotnet clean, then publish with default runtime, it's ok:
    image

  10. michaldobrodenka commented on Nov 15, 2021

    @michaldobrodenka
    Author

    Deleted bin, obj & publish folders, dotnet clean, then publish with mono for win-x64, it's ok also:
    image

  11. michaldobrodenka commented on Nov 15, 2021

    @michaldobrodenka
    Author

    so

    • windows x64 mono & dotnet ok
    • linux-arm - dotnet ok, mono - bug
  12. michaldobrodenka commented on Nov 15, 2021

    @michaldobrodenka
    Author

    monoVM linux-x64 tested on WSL - also ok

  13. self-assigned this
    on Dec 2, 2021
  14. ghost added
    in-pr
    on Dec 2, 2021
  15. ghost removed
    in-pr
    on Dec 9, 2021
  16. removed their assignment
    on Dec 9, 2021
  17. added a commit that references this issue on Dec 9, 2021
    f661a0e
  18. ghost added
    in-pr
    on Dec 9, 2021
  19. ghost removed
    in-pr
    on Jan 24, 2022
  20. ghost locked as resolved and limited conversation to collaborators on Feb 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions