handzlikchris / handzlikchris/FastScriptReload

New Private field method access issue [Workaround]

Offen
#121 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
workaround
Vorherrschende Sprache
C#
Sterne
2.2k
Forks
167
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

## 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.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.