Skip to content

Miscellaneous MetadataUpdater cleanups#54751

Merged
marek-safar merged 3 commits intodotnet:mainfrom
lambdageek:applyupdate-cleanup-mono
Jun 26, 2021
Merged

Miscellaneous MetadataUpdater cleanups#54751
marek-safar merged 3 commits intodotnet:mainfrom
lambdageek:applyupdate-cleanup-mono

Conversation

@lambdageek
Copy link
Copy Markdown
Member

@lambdageek lambdageek commented Jun 25, 2021

  1. On Mono make MetadataUpdater.GetCapabilities() return "Baseline" even if the environment isn't set up for applying updates (ie, no debugger, or the modifiable assemblies env var isn't set). This brings us in line with CoreCLR where that function always returns the same string. On Mono it now returns "Baseline" if the runtime has the hot_reload component, or "" if it doesn't (and thus applying updates is completely compiled out).

  2. Add a new test that checks that MetadataUpdater.IsSupported returns true for configurations where the launch environment sets up the modifiable assemblies environment var (so: mobile and wasm). The platforms that can use the remote executor, the env var is not set, so MetadataUpdater.IsSupported returns false.

  3. Replace the [ConditionalClass] attribute on the ApplyUpdateTest suite with [ConditionalFact] on the individual tests. This lets the other tests (that validate argument checking, or otherwise don't actually need to attempt to apply updates) run on more configurations.

MetadataUpdater.GetCapabilities() on CoreCLR always returns the supported
edits, even if in the current running instance the environment variables for
hot reload or EnC are unset.

This change makes mono behave the same, except in the case where the runtime is
built without hot reload support at all.

MetadataUpdater.IsSupported still behaves the same as before at runtime - it
returns true if there is some possibility that this ApplyUpdate could be called
and could succeed (ie env is set apropriately)
Use PlatformDetection more, and add some utility conditions

Add a new test for MetadataUpdater.IsSupported for scenarios where the test is
launched with the environment setup appropriately - rather than where we would
rely on the remote executor to set it for a child process.q
Instead of making the entire class a [ConditionalClass].

This lets us run the other tests (that validate parameters, or otherwise don't
rely on actually attempting to apply updates) on more configurations

Also slightly improves the xunit results report: [ConditionalClass] doesn't
increment the Skipped test count, whereas [ConditionalFact] does.
@lambdageek lambdageek added the area-EnC-mono Hot Reload for WebAssembly, iOS/Android, etc label Jun 25, 2021
@lambdageek lambdageek requested a review from mikem8361 June 25, 2021 17:05
@marek-safar marek-safar merged commit 15c2cc4 into dotnet:main Jun 26, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jul 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-EnC-mono Hot Reload for WebAssembly, iOS/Android, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants