Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ source on disk. When a run skips a method it had patched before, `Warnings` name
| Base call to a method marked `[Conditional]` | The compiler removes the call, and the evaluation of its arguments, when the symbol is not defined; hot reload cannot do the same. Run `uloop compile` |
| Base call to a method whose base type declares another overload with the same parameter types once its type arguments are filled in (for example `Pick(T)` and `Pick(int)` on `Base<int>`) | Hot reload finds the base method by name and parameter types, which cannot tell these overloads apart. Run `uloop compile` |
| Base call to a method the compiled assembly does not hold yet (added or re-signatured since the last compile) | Run `uloop compile` |
| Private/internal access inside an async/iterator/closure body has no accessor-delegate shape | Conditional access (`?.`), indexers, initializer member assignments, a member named in a property pattern (`x is { _count: 0 }`, or a link of `{ A.B: 0 }`; read the same member path outside the pattern instead: `x._count == 0`, `x.A.B == 0`), and calls with `ref`/`out`/`in`, named, omitted optional, or expanded `params` arguments (or to generic, by-ref-returning, or `[Conditional]` methods, or methods with a ref struct parameter or return type) cannot be rewritten to accessor delegates. An extension method of an `internal` static class applies in either form, because the accessor finds the class by name, as long as the last compile built that class into the edited assembly and the class is declared in a file this reload passes or pulls back in: one in a class this reload adds or in a file the reload does not see is refused, as is one whose return type the same edit changes, a method of an `internal` class that is not an extension method, or one whose parameter or return types are not public. Neither can ref-returning properties, nor these writes to a property through a private/internal setter: `??=`, a compound write whose receiver could be evaluated twice, an assignment whose value is used (a lambda or `=>` member that returns nothing and is only the assignment applies), and a deconstruction. A compound write (`+=`, `??=`, and the like) to a property whose getter is private/internal and whose setter is not is refused as well. The same writes to a private/internal field declared on a class apply, static fields included. In an async body, such a field is also refused when the expression uses it by reference and awaits after that use: passed as `ref`, `out` or `in`, the receiver of a call that takes it by reference, assigned to (`=`, `+=`, a deconstruction), or a struct field whose member or indexer is assigned, as in `M(ref _count, await GetAsync())` or `_count += await GetAsync()`. This holds whatever the call is, a method added in the same reload included; await into a local first, as in `int value = await GetAsync();`, and use the local. That moves the field's read after the await; when the original order matters, read the field into a local before the await as well: `int count = _count; int value = await GetAsync(); _count = count + value;`. A private/internal instance member declared on a struct is refused. An inaccessible method the compiler calls for `await`, `foreach`, `await foreach`, a deconstruction or positional pattern, a collection initializer, a query expression, an interpolated string handler, an index or range (`^1`, `a..b`), a ref struct's `using`, or `await using` is refused as well, including the awaiter of the value `DisposeAsync` or `MoveNextAsync` returns. These limits apply to compiled members; a method added in the same reload is reached directly, whatever its arguments, except a generic, by-ref-returning, or `[Conditional]` added method, which is refused as a compiled one is. An added extension method called on a receiver, `receiver.Method(...)`, gets the outcome of its static form, `Extensions.Method(receiver, ...)` (`Extensions.Method(ref receiver, ...)` for a `this ref` method), except through conditional access (`receiver?.Method(...)`), which is skipped as every added-method call through `?.` is; write the null check and the static form instead. A compiled private/internal static property can be read, assigned, and compound-assigned |
| Private/internal access inside an async/iterator/closure body has no accessor-delegate shape | Conditional access (`?.`), indexers, initializer member assignments, a member named in a property pattern (`x is { _count: 0 }`, or a link of `{ A.B: 0 }`; read the same member path outside the pattern instead: `x._count == 0`, `x.A.B == 0`), and calls with `ref`/`out`/`in`, named, omitted optional, or expanded `params` arguments (or to generic, by-ref-returning, or `[Conditional]` methods, or methods with a ref struct parameter or return type) cannot be rewritten to accessor delegates. An extension method of an `internal` static class applies in either form, because the accessor names the class through typeof, as long as the last compile built that class into the edited assembly and the class is declared in a file this reload passes or pulls back in: one in a class this reload adds or in a file the reload does not see is refused, as is one whose return type the same edit changes, a method of an `internal` class that is not an extension method, or one whose parameter or return types are not public. When an assembly the edited one references declares a public type with the same full name as the extension's class, the shim cannot tell the two apart (CS0433) and that file's edits are not applied; give one of the types another name. Neither can ref-returning properties, nor these writes to a property through a private/internal setter: `??=`, a compound write whose receiver could be evaluated twice, an assignment whose value is used (a lambda or `=>` member that returns nothing and is only the assignment applies), and a deconstruction. A compound write (`+=`, `??=`, and the like) to a property whose getter is private/internal and whose setter is not is refused as well. The same writes to a private/internal field declared on a class apply, static fields included. In an async body, such a field is also refused when the expression uses it by reference and awaits after that use: passed as `ref`, `out` or `in`, the receiver of a call that takes it by reference, assigned to (`=`, `+=`, a deconstruction), or a struct field whose member or indexer is assigned, as in `M(ref _count, await GetAsync())` or `_count += await GetAsync()`. This holds whatever the call is, a method added in the same reload included; await into a local first, as in `int value = await GetAsync();`, and use the local. That moves the field's read after the await; when the original order matters, read the field into a local before the await as well: `int count = _count; int value = await GetAsync(); _count = count + value;`. A private/internal instance member declared on a struct is refused. An inaccessible method the compiler calls for `await`, `foreach`, `await foreach`, a deconstruction or positional pattern, a collection initializer, a query expression, an interpolated string handler, an index or range (`^1`, `a..b`), a ref struct's `using`, or `await using` is refused as well, including the awaiter of the value `DisposeAsync` or `MoveNextAsync` returns. These limits apply to compiled members; a method added in the same reload is reached directly, whatever its arguments, except a generic, by-ref-returning, or `[Conditional]` added method, which is refused as a compiled one is. An added extension method called on a receiver, `receiver.Method(...)`, gets the outcome of its static form, `Extensions.Method(receiver, ...)` (`Extensions.Method(ref receiver, ...)` for a `this ref` method), except through conditional access (`receiver?.Method(...)`), which is skipped as every added-method call through `?.` is; write the null check and the static form instead. A compiled private/internal static property can be read, assigned, and compound-assigned |
| An async/iterator/closure body of a type not visible outside its assembly reaches a compiled member | An accessor delegate has to name its host, which a shim cannot do for an `internal` class or a class nested in one, so this refuses even a `public` member of that class. A body reaching only methods added in the same reload applies. In a lambda or local function, copy the compiled member into a local outside it; otherwise run `uloop compile` |
| An async/iterator/closure body references a private/internal type | Accessor delegates rescue member access, not type references; the body still cannot JIT-compile from the shim assembly. The one exception is the class of a call written in the static form, `Extensions.Method(receiver, ...)`, inside the lambda, local function or async body, when the call itself is rewritten, because the rewritten call no longer names the class |
| A declared return or parameter type cannot be resolved (a new type this reload could not introduce, a missing using, or a typo) | Skipped; a supported new type declared in an edited file of the same assembly is introduced by this reload, so check `Warnings` for the refusal reason (`introduced-types.md`); otherwise add the type or the `using`, or fix the typo, then run `uloop compile` |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ source on disk. When a run skips a method it had patched before, `Warnings` name
| Base call to a method marked `[Conditional]` | The compiler removes the call, and the evaluation of its arguments, when the symbol is not defined; hot reload cannot do the same. Run `uloop compile` |
| Base call to a method whose base type declares another overload with the same parameter types once its type arguments are filled in (for example `Pick(T)` and `Pick(int)` on `Base<int>`) | Hot reload finds the base method by name and parameter types, which cannot tell these overloads apart. Run `uloop compile` |
| Base call to a method the compiled assembly does not hold yet (added or re-signatured since the last compile) | Run `uloop compile` |
| Private/internal access inside an async/iterator/closure body has no accessor-delegate shape | Conditional access (`?.`), indexers, initializer member assignments, a member named in a property pattern (`x is { _count: 0 }`, or a link of `{ A.B: 0 }`; read the same member path outside the pattern instead: `x._count == 0`, `x.A.B == 0`), and calls with `ref`/`out`/`in`, named, omitted optional, or expanded `params` arguments (or to generic, by-ref-returning, or `[Conditional]` methods, or methods with a ref struct parameter or return type) cannot be rewritten to accessor delegates. An extension method of an `internal` static class applies in either form, because the accessor finds the class by name, as long as the last compile built that class into the edited assembly and the class is declared in a file this reload passes or pulls back in: one in a class this reload adds or in a file the reload does not see is refused, as is one whose return type the same edit changes, a method of an `internal` class that is not an extension method, or one whose parameter or return types are not public. Neither can ref-returning properties, nor these writes to a property through a private/internal setter: `??=`, a compound write whose receiver could be evaluated twice, an assignment whose value is used (a lambda or `=>` member that returns nothing and is only the assignment applies), and a deconstruction. A compound write (`+=`, `??=`, and the like) to a property whose getter is private/internal and whose setter is not is refused as well. The same writes to a private/internal field declared on a class apply, static fields included. In an async body, such a field is also refused when the expression uses it by reference and awaits after that use: passed as `ref`, `out` or `in`, the receiver of a call that takes it by reference, assigned to (`=`, `+=`, a deconstruction), or a struct field whose member or indexer is assigned, as in `M(ref _count, await GetAsync())` or `_count += await GetAsync()`. This holds whatever the call is, a method added in the same reload included; await into a local first, as in `int value = await GetAsync();`, and use the local. That moves the field's read after the await; when the original order matters, read the field into a local before the await as well: `int count = _count; int value = await GetAsync(); _count = count + value;`. A private/internal instance member declared on a struct is refused. An inaccessible method the compiler calls for `await`, `foreach`, `await foreach`, a deconstruction or positional pattern, a collection initializer, a query expression, an interpolated string handler, an index or range (`^1`, `a..b`), a ref struct's `using`, or `await using` is refused as well, including the awaiter of the value `DisposeAsync` or `MoveNextAsync` returns. These limits apply to compiled members; a method added in the same reload is reached directly, whatever its arguments, except a generic, by-ref-returning, or `[Conditional]` added method, which is refused as a compiled one is. An added extension method called on a receiver, `receiver.Method(...)`, gets the outcome of its static form, `Extensions.Method(receiver, ...)` (`Extensions.Method(ref receiver, ...)` for a `this ref` method), except through conditional access (`receiver?.Method(...)`), which is skipped as every added-method call through `?.` is; write the null check and the static form instead. A compiled private/internal static property can be read, assigned, and compound-assigned |
| Private/internal access inside an async/iterator/closure body has no accessor-delegate shape | Conditional access (`?.`), indexers, initializer member assignments, a member named in a property pattern (`x is { _count: 0 }`, or a link of `{ A.B: 0 }`; read the same member path outside the pattern instead: `x._count == 0`, `x.A.B == 0`), and calls with `ref`/`out`/`in`, named, omitted optional, or expanded `params` arguments (or to generic, by-ref-returning, or `[Conditional]` methods, or methods with a ref struct parameter or return type) cannot be rewritten to accessor delegates. An extension method of an `internal` static class applies in either form, because the accessor names the class through typeof, as long as the last compile built that class into the edited assembly and the class is declared in a file this reload passes or pulls back in: one in a class this reload adds or in a file the reload does not see is refused, as is one whose return type the same edit changes, a method of an `internal` class that is not an extension method, or one whose parameter or return types are not public. When an assembly the edited one references declares a public type with the same full name as the extension's class, the shim cannot tell the two apart (CS0433) and that file's edits are not applied; give one of the types another name. Neither can ref-returning properties, nor these writes to a property through a private/internal setter: `??=`, a compound write whose receiver could be evaluated twice, an assignment whose value is used (a lambda or `=>` member that returns nothing and is only the assignment applies), and a deconstruction. A compound write (`+=`, `??=`, and the like) to a property whose getter is private/internal and whose setter is not is refused as well. The same writes to a private/internal field declared on a class apply, static fields included. In an async body, such a field is also refused when the expression uses it by reference and awaits after that use: passed as `ref`, `out` or `in`, the receiver of a call that takes it by reference, assigned to (`=`, `+=`, a deconstruction), or a struct field whose member or indexer is assigned, as in `M(ref _count, await GetAsync())` or `_count += await GetAsync()`. This holds whatever the call is, a method added in the same reload included; await into a local first, as in `int value = await GetAsync();`, and use the local. That moves the field's read after the await; when the original order matters, read the field into a local before the await as well: `int count = _count; int value = await GetAsync(); _count = count + value;`. A private/internal instance member declared on a struct is refused. An inaccessible method the compiler calls for `await`, `foreach`, `await foreach`, a deconstruction or positional pattern, a collection initializer, a query expression, an interpolated string handler, an index or range (`^1`, `a..b`), a ref struct's `using`, or `await using` is refused as well, including the awaiter of the value `DisposeAsync` or `MoveNextAsync` returns. These limits apply to compiled members; a method added in the same reload is reached directly, whatever its arguments, except a generic, by-ref-returning, or `[Conditional]` added method, which is refused as a compiled one is. An added extension method called on a receiver, `receiver.Method(...)`, gets the outcome of its static form, `Extensions.Method(receiver, ...)` (`Extensions.Method(ref receiver, ...)` for a `this ref` method), except through conditional access (`receiver?.Method(...)`), which is skipped as every added-method call through `?.` is; write the null check and the static form instead. A compiled private/internal static property can be read, assigned, and compound-assigned |
| An async/iterator/closure body of a type not visible outside its assembly reaches a compiled member | An accessor delegate has to name its host, which a shim cannot do for an `internal` class or a class nested in one, so this refuses even a `public` member of that class. A body reaching only methods added in the same reload applies. In a lambda or local function, copy the compiled member into a local outside it; otherwise run `uloop compile` |
| An async/iterator/closure body references a private/internal type | Accessor delegates rescue member access, not type references; the body still cannot JIT-compile from the shim assembly. The one exception is the class of a call written in the static form, `Extensions.Method(receiver, ...)`, inside the lambda, local function or async body, when the call itself is rewritten, because the rewritten call no longer names the class |
| A declared return or parameter type cannot be resolved (a new type this reload could not introduce, a missing using, or a typo) | Skipped; a supported new type declared in an edited file of the same assembly is introduced by this reload, so check `Warnings` for the refusal reason (`introduced-types.md`); otherwise add the type or the `using`, or fix the typo, then run `uloop compile` |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ public async Task Run_ClosureInNonPublicClassCallingItsAddedMethodInStaticForm_I

/// <summary>
/// What: a lambda that calls an extension method of an internal static class in a namespace
/// named with a keyword is Patched and returns the edited value, because the accessor looks
/// the class up by its metadata name.
/// named with a keyword is Patched and returns the edited value, because the accessor's
/// typeof escapes the keyword (@event).
/// </summary>
[Test]
public async Task Run_ClosureCallingExtensionInKeywordNamedNamespace_IsPatched()
Expand Down
Loading
Loading