question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Get-FormatData quietly ignores non-existing type-name arguments

See original GitHub issue

Steps to reproduce

Get-FormatData NoSuch.Type.Exists.Or.IsLoaded

Expected behavior

An error that indicates that the type does not exist (in the current session).

Actual behavior

A quiet no-op. No output, $? reports $True.

Environment data

PowerShell Core v6.0.0-beta.3 on macOS 10.12.5
PowerShell Core v6.0.0-beta.3 on Ubuntu 16.04.1 LTS
PowerShell Core v6.0.0-beta.3 on Microsoft Windows 10 Pro (64-bit; v10.0.14393)
Windows PowerShell v5.1.15063.413 on Microsoft Windows 10 Pro (64-bit; v10.0.15063)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Jaykulcommented, Aug 9, 2018

HANG ON … This is a breaking change to the function!!!

Does -ErrorAction SilentlyContinue work, or are you now forcing everyone to wrap this in a try/catch block?

I understand the desire to have this produce an error, but we can’t make existing commands throw exceptions in use cases that used to just return nothing.

You’re breaking every instance of existing code that looks like this, right?

if(!(Get-FormatData $Type)) {
   Update-FormatData -TypeName $Type ...
}
1reaction
SteveL-MSFTcommented, Jul 30, 2018

@faraazahmad consider it yours! Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ignore template parameter - c++
Just create a template argument for it and ignore it. template<typename T, typename Ignore> class event_loop { public: void watch(event<T, ...
Read more >
Template argument deduction
In order to instantiate a function template, every template argument must be known, but not every template argument has to be specified.
Read more >
Template parameters and template arguments
A non-type template parameter must have a structural type, which is one of the following types (optionally cv-qualified, the qualifiers are ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found