Powershell: System.TypeLoadException: Method 'PromptForCredential' does not have an implementation.

Created on 4 Aug 2020  路  8Comments  路  Source: PowerShell/PowerShell

https://github.com/PowerShell/PowerShell/pull/12782 introduced a new abstract member on PSHostUserInterface. This makes it impossible to implement PSHostUserInterface for both PS 7.1 and any earlier PowerShell version. Instead we get a TypeLoadException.

An explanation of this is here: https://github.com/PowerShell/PowerShell/pull/12782#discussion_r464724652

You can find the Host UI implementation (which works today with PS 7.0 and PS 5.1) here.

Issue-Bug WG-DevEx-SDK

Most helpful comment

Maybe we could simply remove the abstract method and do not revert the commit? Or add default implementation?

I'm going to revert the commit so that we don't risk the change being released. Our first job is to unbreak things. We can decide in a new PR whether we reuse the original code or to go with a different implementation.

All 8 comments

We're just lucky I was working against the PS master branch (so I could debug the full call stack) -- nothing else caught this

Given the difficulty of turning the abstract call into a virtual one with a sensible behaviour, my recommendation is to revert the change

I agree we should revert the original change. For password confirmation, I think the cmdlet can just call the existing prompt again and just compare the results.

Maybe we could simply remove the abstract method and do not revert the commit? Or add default implementation?

Maybe we could simply remove the abstract method and do not revert the commit? Or add default implementation?

I'm going to revert the commit so that we don't risk the change being released. Our first job is to unbreak things. We can decide in a new PR whether we reuse the original code or to go with a different implementation.

/cc @Shriram0908 for information.

@rjmholt What about to add optional PSES CI in the repo so that we see issues early?

What about to add optional PSES CI in the repo so that we see issues early?

Not a bad idea really. I'm not sure how we'd achieve that exactly but worth looking into.

/cc @TylerLeonhardt

Was this page helpful?
0 / 5 - 0 ratings