Skip to content

arguments like "-Ddart.vm.profile=false" aren't reliably parsed in Windows Powershell. Β #59751

@tylandercasper

Description

@tylandercasper

So, this was incredibly painful to track down, but it turns out that if an argument starts with a -(dash) and contains a .(period) than powershell will split it into two arguments. So -Ddart.vm.profile=false is sent to dart as the args "-Ddart" and ".vm.profile=false"
you can test this out with the echo command:

PS C:\Program Files\PowerShell\7> echo -Ddart.vm.profile=false
-Ddart
.vm.profile=false

This breaks argument formatting and will sometimes cause the command
dartaotruntime.exe frontend_server_aot.dart.snapshot [args]
to fall into the options.rest.isNotEmpty case and try to compile ".vm.profile=false" which will cause it to crash with a very confusing message of "unable to rebuild for Windows "type 'Null' is not a subtype of type 'Library' in type cast"

You can read more about it here: https://stackoverflow.com/questions/28704867/why-does-powershell-split-arguments-containing-hyphens-and-periods

Not sure how to fix other than dropping any arguments that use that format, but will try switching my terminal type to command prompt

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.closed-as-intendedClosed as the reported issue is expected behaviortriage-automationSee https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions