handzlikchris / handzlikchris/FastScriptReload

New Private field method access issue [Workaround]

Open
#121 0 comments 0 reactions 0 assignees View on GitHub
workaround
Dominant language
C#
Stars
2.2k
Forks
167
PR merge metrics
No merged PRs in 30d

Description

## Current Workaround

So it seems this is the workaround for now. Any direct access the new field breaks the rewritter.

```c#
_instanceNewField.DoesWhatYouWant(); //<- fails to rewrite
var myLocalNewField = _instanceNewField; // <- this gets correctly rewritten
myLocalNewField.DoesWhatYouWant(); //<- All good
```
Then on your next recompilation round you can clean up the syntax.

## Issue
I'm not sure if it's a regression and what would be its reason, but most of the time nowadays adding private fields fails as they are not rewritten correctly in every places. Example bellow.
Added
`private CameraState _lastCamState;`

One of the correctly rewritten part I believe
`FastScriptReload.Scripts.Runtime.TemporaryNewFieldValues.ResolvePatchedObject(this)._lastCamState = state;`

Some other places not rewritten
` Gizmos.DrawWireSphere(_lastCamState.FinalPosition, BodyRadius);`

It is the NewFieldsRewriter job to perform the rewrite now not sure why it skip some cases.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.