Also removed declaration of status codes which are not used anywhere in the product anymore.
Co-Authored-By: Elinor Fung <47805090+elinor-fung@users.noreply.github.com>
Co-Authored-By: Steve MacLean <stmaclea@microsoft.com>
The "latest" bit in `LatestMinor` and `LatestMajor` is now considered separately from the version range. It propagates on its own and also propagates into frameworks.
Also modifies how "roll to latest patch" is applied to pre-release versions. If the selected version if pre-release there's no additional automatic roll forward. If the selected version is release, normal "roll to latest patch" is applied.
Some tweaks to algorithm description and some more samples.
Co-Authored-By: Elinor Fung <47805090+elinor-fung@users.noreply.github.com>
- Track existing hostpolicy_context in hostpolicy
- Add host_context to hostfxr to represent active (first) and secondary contexts
- Switch com/ijw/winrt hosts to use host context-based APIs
- Update nativehost test executable to exercise new APIs
- Make non-context-based entry points check for existing context and create an empty context
- Basic automated tests for context-based entry points
This is the new implementation of the framework resolution with the new roll forward setting.
The spec for this is [framework version resolution](https://github.com/dotnet/core-setup/blob/master/Documentation/design-docs/framework-version-resolution.md).
Major parts:
- introduce `rollForward` setting (CLI, env, config)
- convert the existing `rollForwardOnNoCandidateFx` to the new `rollForward` internally
- change framework reference compatibility algorithm to use the new `rollFoward` settings.
- basically rewrite the framework resolution algorithm with the new settings and fix an existing bug with incorrect retry logic
- add test infra for the new setting
- add tests for the new setting
* Update hosting components with new hosts and new scenarios
* Apply suggestions from code review
Co-Authored-By: vitek-karas <vitek.karas@microsoft.com>
Implement a WinRT host for .NET Core so users can write WinRT WinMDs that target and build on .NET Core.
We can't accurately test this E2E in CI until we have a test machine running a version of Windows with the Reg-Free WinRT support (requires at least Windows 10 19H1 Build 18309).
Runtime side of the host work is in dotnet/coreclr#23402
* First pass porting mscoree/mscoreei's IJW hosting hooks into a new .NET Core host. Functions that use runtime data structures are stubbed out.
* Use Windows heap functions for allocating executable memory.
* Add IJW activation design document.
* Add talking point about loading dependencies from *.deps.json* files and what work needs to be done for those.
* Clean up design doc.
* Update design doc.
* Feedback.
* Clean up the PEDecoder since we don't need to port over all of the validation, just enough to ensure that the assembly is a .NET assembly.
* The OS will verify that the IJW image and the IJW host are the same architecture, so we don't need to branch on architecture.
* Clean up ijwhost and PEDecoder code based on review feedback.
* Refactor corehost.cpp and add implementations of functions to fetch IJW delegates from hostfxr.
* Move hostfxr resolution into separate file and make corehost only relevant for the exe hosts.
* Make get_latest_fxr local to fxr_resolver.cpp
* Implement fxr wire-up for ijwhost.
* Rvas are already mapped for loaded images.
* Don't use stubs if being loaded into currently running runtime.
* Update IJW activation doc based on updated info about callbacks.
* Implement token resolution from thunks. Fix calling a users native entry-point from _CorDllMain.
* Correctly resolve side-by-side hostfxr from ijwhost and comhost. Correctly handle an empty TPA when appending S.P.CL. Pass app-path to delegate.
* Update design doc.
* Remove unneeded validation.
* Fix assembler selection for ARM/ARM64.
* Fix indentation.
* Remove dead code in PEDecoder.
* Fix missing CommandLineToArgvW symbol in arm/arm64 builds.
* Fix ARM/ARM64 build by bringing over custom arm assembler supporting cmake from coreclr.
* Remove IJWBootstrapThunk opaque class. Rename all non-exported apis to match the snake_case convention in this repo.
* Remove exports.cpp files per pr feedback.
* Use an enum to specify which delegate to load from the runtime in the hostfxr<->hostpolicy API.
* Fix x86 build
* Make x86 implementation of get_thunk_from_cookie clearer.
* Symbol export changes needed for x86 as found by testing.
* Remove ijw-exe-specific path.
* clean up ijwhost.cpp since we only have one entrypoint into hostfxr from ijwhost now.
* Use enum for delegate getter in hostfxr-exposed api as well.
* PR Feedback.
* Add ijwhost to Microsoft.NetCore.DotNetAppHost package.
* Setup tracing on comhost and ijwhost entry points.
* PR Feedback.
* Remove IsILOnly checks.
* Clean up design doc.
* More cleanup on IJW activation design doc
* swallow tracing on IJW. Remove as much of corhdr.h as possible.
* Fix bad copy-paste in the install command in ijwhost cmake script.
* Fix cmake
* Add error message to trace for failure to find the "corehost_get_coreclr_delegate" entrypoint.
* Sign ijwhost. Fixes#5485.
The original version of the doc defined that chained framework references would inherit effective roll forward settings (with possible overrides).
But the code never implemented the behavior. The behavior in code is such that each `.runtimeconfig.json` is processed in isolation.
Changing the document to match the code.
Add `comhost` into the list.
Use platform agnostic wording and library names.
Reword certain description to provide more precise and detailed information.
* Add new comhost library for COM activation
- Supports reading clsidmap as file or resource
- Supports registration and unregistration of COM server
* Replace COREHOST_MAKE_DLL define with EXPORT_SHARED_API
* Convert CoreClr instance loading API from a flat C-style to a class API . This will make having multiple CoreClr instances in the same process easier in the future.
* Move internal execute* APIs to the fx_muxer.cpp compilation unit
Add initial/erroring implementation for get_com_activation_delegate() to fx_muxer_t.
* Create coreclr_property_bag_t for property management.
* Extract coreclr property creations into a reusable class.
* Report process ID during test run.
* Remove the new corehost_ensure_load() export since the previous semantics
of reinitializing hostpolicy were designed for testing.
* Fix P/Invoke signature for hostfxr_get_native_search_directories to define
the calling convention and remove usage of StringBuilder.
* Properly propagate the host command on reinitialization
Remove additional uses of global variables where possible
* Don't add the COM server assembly to the TPA
Ensure the COM server assembly deps.json isn't added to the AppContext
* Feedback on error propagation
* Improve SDK version lookup description
Link to official docs which have detailed description of the algorithm.
Add a note about the hostfxr export options as well.
* Fix a small issue to avoid looking up directories like -1.-1.-1
If the global.json specifies SDK version but we can't find that version in a given search location, the code would end up checking if a folder with name "-1.-1.-1" exist. This is because we're left with empty version structure which is represented as -1.-1.-1.
Not only this is a small perf issue (unnecessarily looking at disk), but if the folder existed by any chance we would have returned that version for use.
* Add new export to hostpolicy and hostfxr to redirect error output to a callback
This introduces corehost_set_error_writer and hostfxr_set_error_writer exports.
If set, all errors will be written to the error writer instead of the default stderr.
Tracing is unaffected by this change.
The error writer is set per-thread (thread local).
Only one error writer can be set on a given thread. Subsequent calls to set error
writer will overwrite the previous writer.
hostfxr propagates the custom error writer (if any) to the hostpolicy
for the duration of the calls it makes to hostpolicy.
Added tests to validate the new behavior.
* Remove TODOs which are now resolved with this change
* Fix buffer allocation to work with any string (arbitrary large).
Remove locks on error writer since it's thread local.
* Fix the error formating on Linux
* Fix error formatting on Linux
va_list is not reusable, by definition. On Windows this works since the implementation makes it reusable. but on Linux it's not. So make a copy before calling the printf with it.
Simplify the code, since vsnprintf and _vsnwprintf do in fact behave the same if passed NULL buffer and zero length (calculates the necessary buffer size). So no need for two functions even on Windows.
Introduce the component resolve entry point.
- Refactors argument init to use the same code for app and components
- Remove usage of the global init structure from args init - makes it much clearer what is used where.
- Other small refactorings
- Adds basic doc with notes and open questions - should eventually become the real design doc for this feature.
* Add script to start Visual Studio
Add script to properly set the environment variables to run tests
within the Visual Studio IDE test explorer
Add brief documentation
Respond to feedback
Add COREHOST_TRACEFILE
Add support for redirecting COREHOST_TRACE to a file
via COREHOST_TRACEFILE
Update host tracing design doc
Add comments about trace to file appending log.
Add timestamp to logs
Trace thread safety -
Prevent garbling of trace output by adding a mutex
Use C++11 std::mutex and std::lock_guard directly
Add COREHOST_TRACE_VERBOSITY to allow controlling verbosity
of trace,
When COREHOST_TRACE_VERBOSITY is not set behavior will remain unchanged
COREHOST_TRACE_VERBOSITY=1 errors only
COREHOST_TRACE_VERBOSITY=2 errors & warnings
COREHOST_TRACE_VERBOSITY=3 errors, warnings, and info
COREHOST_TRACE_VERBOSITY=4 errors, warnings, info, and verbose
Add tracing tests
Describes in detail how the host does probing for assets.
Replace the existing short description of this in the shared store document.
Fix some related comments in the code.
* Add hosting for COM activation design proposal
* Document RegFree COM issues
* Mention compat issues
* Add frameworks link
* Add details regarding UX and clarify associated assembly for runtimeconfig.json
* Update the anticipated public API