Skip to content

Stop unnecessary exceptions from being thrown from crossgen when a reference is not actually a managed dll#70191

Merged
davidwrighton merged 1 commit intodotnet:mainfrom
davidwrighton:reduce_unnecessary_exceptions
Jun 6, 2022
Merged

Stop unnecessary exceptions from being thrown from crossgen when a reference is not actually a managed dll#70191
davidwrighton merged 1 commit intodotnet:mainfrom
davidwrighton:reduce_unnecessary_exceptions

Conversation

@davidwrighton
Copy link
Member

  • Makes ad hoc usage of crossgen2 much more convenient on Windows as the exceptions generated are annoying to deal with in the debugger

…ference is not actually a managed dll

- Makes ad hoc usage of crossgen2 much more convenient on Windows as the exceptions generated are annoying to deal with in the debugger
try
{
EcmaModule module = _typeSystemContext.GetModuleFromPath(referenceFile);
EcmaModule module = _typeSystemContext.GetModuleFromPath(referenceFile, throwOnFailureToLoad: false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need this to be in a try/catch (catch { } // Ignore non-managed pe files)? Same question for below.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that we still need a try/catch block. I'm really trying to reduce the number of weirdo useless exceptions, not get rid of them entirely. I'm not prepared at the moment to actually attempt to get rid of all of the exception paths that are possible (or at least make sure they are only present for cases where we'd like to kill the entire debugging process.

Copy link
Member

@trylek trylek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo Michal's comment I believe to be valid - we either need a catch block within AddModule or keep this one. Should be easy to test using the IJW runtime tests.

@davidwrighton davidwrighton merged commit febd927 into dotnet:main Jun 6, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Jul 7, 2022
@davidwrighton davidwrighton deleted the reduce_unnecessary_exceptions branch April 13, 2023 18:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants