JetBrains / JetBrains/resharper-unity

String based lookup is inefficient quick fix can generate uncompilable code

Open
#1,641 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
1.2k
Forks
142
PR merge metrics
No merged PRs in 30d

Description

If you have a ScriptableObject in the Assembly-CSharp dll and create an instance of that in a AsmDef using the string based ScriptableObject.CreateInstance

Rider can generate incorrect code when trying to fix a string based lookup in ScriptableObject.CreateInstance. This happens if you define your ScriptableObject class in the Assembly-CSharp dll and you try to the create the instance in a AsmDef. Since AsmDefs can't have a reference to Assembly-CSharp it should not be possible to have a reference to a class defined in that assembly.

Contributor guide

Open the contributing guide

Research direction

No source file or test is named. Start by reproducing the string-based ScriptableObject.CreateInstance lookup with the ScriptableObject in Assembly-CSharp and the creation call in an AsmDef, then trace Rider's quick-fix code generation. Done means the quick fix no longer generates an invalid Assembly-CSharp reference or uncompilable code.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, unity
Domain
devtools, game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.