Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@pastasfuture
Copy link
Contributor

Without surfacing these exceptions, developers cannot act on any underlying reflection errors in the HDRP assembly.

https://unity.slack.com/archives/CE7DZN2H1/p1630106304084900

An example error message that this will now generate (from the case I hit while developing, which previously silently failed):
Encountered an exception while attempting to reflect the HDRP assembly to extract all RenderPipelineMaterial types. This exception must be fixed in order to fully initialize HDRP correctly. Generic class cannot have explicit layout. UnityEngine.Rendering.HighDefinition.AtlasAllocatorDynamic1/AtlasNode`
To be clear - the example error will not fire on master - that is just an example from code changes I was making on a branch.

Outside of the scope of this PR: I wonder if it would be better to not rely on reflection here, and instead just manually populate the list as mentioned in the comment with all RenderPipelineMaterial types - the list is fairly short, and I would expect this reflection the be the cause of maybe > 1 second during initialization time.

…rialList(). Without surfacing these exceptions, developers cannot act on any underlying reflection errors in the HDRP assembly.
@github-actions
Copy link

Hi! This comment will help you figure out which jobs to run before merging your PR. The suggestions are dynamic based on what files you have changed.
Link to Yamato: https://yamato.cds.internal.unity3d.com/jobs/902-Graphics
Search for your PR branch using the sidebar on the left, then add the following segment(s) to the end of the URL (you may need multiple tabs depending on how many packages you change)

HDRP
/.yamato%252Fall-hdrp.yml%2523PR_HDRP_2021.2

Depending on the scope of your PR, you may need to run more jobs than what has been suggested. Please speak to your lead or a Graphics SDET (#devs-graphics-automation) if you are unsure.

@sebastienlagarde
Copy link
Contributor

Adding Remi to get his though.

Note that we can have Material define outside of HDRP package (it is the case for automotive), thus why we rely on the reflection mechanism.

@RSlysz
Copy link
Contributor

RSlysz commented Sep 1, 2021

Note that we can have Material define outside of HDRP package (it is the case for automotive), thus why we rely on the reflection mechanism.

I agree. We cannot do it with hard coded list. But perhaps we can do it more efficiently using the TypeCache instead of C# reflection.

Other than that, Yes we want to throw error as explicite as possible for user creating its own material know what is the issue.

Copy link
Contributor

@RSlysz RSlysz left a comment

Choose a reason for hiding this comment

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

Proposed version is better than what we currently have.

But we should plan some improvement on it later:

  • Is there a similar mechanisme in URP? If yes, we should handle this in CoreSRP directly.
  • Using TypeCache will only gather type that are already loaded. Thus it already handled the load exception. It would also be more efficient this way than using reflection.

@sebastienlagarde
Copy link
Contributor

But we should plan some improvement on it later:

  • Is there a similar mechanisme in URP? If yes, we should handle this in CoreSRP directly.

Nope

@sebastienlagarde sebastienlagarde merged commit 06cbb03 into master Sep 12, 2021
@sebastienlagarde sebastienlagarde deleted the reflection-catch branch September 12, 2021 20:25
sebastienlagarde pushed a commit that referenced this pull request Sep 12, 2021
…rialList(). Without surfacing these exceptions, developers cannot act on any underlying reflection errors in the HDRP assembly. (#5474)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.