Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InterpreterFrame.SaveTraceToException publishes a private type #39433

Open
yecril71pl opened this issue Jul 16, 2020 · 5 comments
Open

InterpreterFrame.SaveTraceToException publishes a private type #39433

yecril71pl opened this issue Jul 16, 2020 · 5 comments
Labels
area-System.Linq.Expressions backlog-cleanup-candidate An inactive issue that has been marked for automated closure. no-recent-activity
Milestone

Comments

@yecril71pl
Copy link
Contributor

yecril71pl commented Jul 16, 2020

Description

The type InterpretedFrameInfo is private and should not be published as a key to exception data map.

 [TestMethod] public void ThrownExceptionHasPrivateKey () /* !ThrownExceptionHasPrivateKey */
 {
try { 
Expression .Lambda (
// I have to use a bogus TryCatch here because the bug is triggered by Interpreter.EnterTryCatchFinallyInstruction.Run
 Expression .TryCatch (
Expression .Call (
typeof (int). GetMethod ("Parse", new Type[] { typeof (string) }), 
Expression .Constant ("?")
),
new CatchBlock [] {
// I do not actually want to catch anything here, so that EnterTryCatchFinallyInstruction can do its evil deed
 Expression .Catch (typeof (DivideByZeroException),
// Linq says this expression must be a call expression too, the actual call is irrelevant.
Expression .Call (
typeof (int). GetMethod ("Parse", new Type[] { typeof (string) }), 
Expression .Constant ("0")
)
)
 }
)
)
// do not compile (isn’t the syntax funny here?)
 .Compile (true)
 .DynamicInvoke ();
 }
catch (ApplicationException x) { 
var dat = x .InnerException .Data;
// Data has 1 key, which is a type, which is private, oops.
Assert.AreEqual (1, data.Count);
foreach (Type key in data.Keys)
Assert.AreEqual (true, key.IsPublic);
 } 
 
 } /* !ThrownExceptionHasPrivateKey X */

Configuration

Name Value


PSVersion 7.0.2
PSEdition Core
GitCommitId 7.0.2
OS Microsoft Windows 10.0.18363
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

Regression?

Other information

area-System.Linq.Expressions
Pingback from PowerShell/PowerShell#13172 (comment)

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the untriaged New issue has not been triaged by the area owner label Jul 16, 2020
@Dotnet-GitSync-Bot
Copy link
Collaborator

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@ghost
Copy link

ghost commented Jul 16, 2020

Tagging subscribers to this area: @cston
Notify danmosemsft if you want to be subscribed.

@cston
Copy link
Member

cston commented Aug 13, 2020

@yecril71pl

The type InterpretedFrameInfo is private and should not be published as a key to exception data map.

Does the private type key lead to an issue? Thanks.

@cston cston removed the untriaged New issue has not been triaged by the area owner label Aug 13, 2020
@cston cston added this to the Future milestone Aug 13, 2020
@yecril71pl
Copy link
Contributor Author

When you get an exception from PowerShell, you can interactively investigate its content. The content of the serialisation is presented using a default format, which means you can see the key but you cannot look at the content at the key because the key itself is inaccessible. This leads to user frustration. The fix would be to use the class name as the key.

Copy link
Contributor

Due to lack of recent activity, this issue has been marked as a candidate for backlog cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.

This process is part of our issue cleanup automation.

@dotnet-policy-service dotnet-policy-service bot added backlog-cleanup-candidate An inactive issue that has been marked for automated closure. no-recent-activity labels Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Linq.Expressions backlog-cleanup-candidate An inactive issue that has been marked for automated closure. no-recent-activity
Projects
None yet
Development

No branches or pull requests

4 participants