summaryrefslogtreecommitdiff
path: root/src/dlls
AgeCommit message (Collapse)AuthorFilesLines
2019-10-15[Tizen] Add coreclr_preload_assembly to CoreCLR host APItizen_5.5.m2_releasesubmit/tizen_5.5_mobile_hotfix/20201026.185106submit/tizen_5.5/20191031.000006submit/tizen/20191014.221258accepted/tizen/unified/20191015.012049accepted/tizen/5.5/unified/mobile/hotfix/20201027.061818accepted/tizen/5.5/unified/20191031.004944Konstantin Baladurin3-2/+42
2019-09-26[Tizen] Partially revert a6292a6.Mikhail Kurinnoi1-0/+39
NetcoreDBG depends from PAL functions. Instead of SOS plugin, that use PAL static libs, debugger should be able to operate with any runtime version and can't be statically linked to PAL.
2019-06-11Delete dead code (#25066)Jan Kotas1-1/+0
2019-06-10Switch P/Invokes into libcoreclr for the PAL to QCalls (#25055)Jeremy Koritzinsky1-39/+0
* Switch PInvokes into libcoreclr to QCalls * Register QCalls in runtime. Remove pal exports from libcoreclr * Alphabetize new ecalllist.h entries * Remove W suffixes from native side of QCall * Interop signatures are in nested classes (which doesn't show up here) in the root namespace. So we don't want to pass a namespace in here * Convert the interop test in R2R to use a local native library instead of calling into the CoreCLR PAL via DllImport.
2019-06-07Do not delete polymorphic objects without a virtual destructor (#23705)Omair Majid1-4/+0
SEI CERT C++ Coding Standard says: > Do not delete an object of derived class type through a pointer to its > base class type that has a non-virtual destructor. Instead, the base > class should be defined with a virtual destructor. Deleting an object > through a pointer to a type without a virtual destructor results in > undefined behavior. See https://wiki.sei.cmu.edu/confluence/display/cplusplus/OOP52-CPP.+Do+not+delete+a+polymorphic+object+without+a+virtual+destructor Clang generally warns about this, but we disabled the warning via -Wno-delete-non-virtual-dtor. This commit re-enables the warning and fixes up all the code that hits the warning.
2019-06-06Use CMake's C# support to build DacTableGen instead of manually invoking ↵Jeremy Koritzinsky1-41/+46
csc.exe ourselves. (#24342) * Use CMake's C# support to build DacTableGen instead of manually invoking csc.exe ourselves. * Fix x86 failures. * Disable DAC generation when building with NMake Makefiles and issue an error since the CMake C# support is VS-only. We don't actually support building with NMake (only configure) so this is ok. * Clean up rest of the macro=1's PR Feedback. * Fix Visual Studio generator matching. * Explicitly specify anycpu32bitpreferred for DacTableGen so the ARM64 build doesn't accidentally make it 64-bit * Fix bad merge
2019-06-05Use Modern CMake features instead of CMAKE_CXX_FLAGS (#24861)Jeremy Koritzinsky1-1/+1
* Convert C++ standard settings and warning options from CMAKE_<LANG>_FLAGS to Modern CMake isms. * More $<COMPILE_LANGUAGE> generator expressions instead of CMAKE_CXX_FLAGS. * Use $<COMPILE_LANGUAGE:CXX> for all -fpermissive usage * Fix generator expression that generates multiple flags * Fix invalid use of CMAKE_CXX_FLAGS instead of CMAKE_C_FLAGS. * Treat AppleClang as though it is Clang (match pre-3.0 behavior). * Update our build system to understand that AppleClang is distinct from Clang and remove CMP0025 policy setting. * PR Feedback.
2019-06-02Improve fatal err msg (#24390)Dan Moseley1-1/+1
* Improve fatal err msg * Match SO format * a * Remove dead define * More adjustments to ex msg * And PAL * Remove special case for SOE * Remove excess Debug.Assert newline * Remove excess newline * typo * New format * Remove DebugProvider redundancy * Adjustments * Remove preceding newline * Make other SOE and OOM consistent * Tidy up assertion msg * Fix missing newline after inner exception divider * CR when no inner exception * ToString never CR terminated * disable corefx tests temporarily
2019-05-29Use /proc/<pid>/mem to read memory in remote DBI data target. It makes the ↵Mike McLaughlin1-0/+3
test case run at (#24844) least 4 to 5 times faster than before. Fallback to old transport ReadMemory if /proc/<pid>/mem can't be opened. This happens on attach because of permissions/access, but works fine on the launch (the most important case).
2019-05-29Refactor native build to remove the compiler-override files (#23897)Jeremy Koritzinsky1-3/+2
* On systems that have both cmake 2 and cmake 3, use cmake 3. Move CMAKE_EXPORT_COMPILE_COMMANDS to top level instead of in gen-buildsys-*. Define the CMake install prefix in gen-buildsys-* instead of pulling from an environment variable. Define C++ standard as CMake property instead of as flag. Move CLR_DEFINES_*_INIT out of overrides and into configurecompiler.cmake Move flags that generate debug info into configurecompiler.cmake Remove the CMAKE_USER_RULES_OVERRIDE files. Add cmake version output for determining what cmake versions each CI system has. Fix syntax in gen-buildsys-clang. Change add_compile_definitions back to add_definitions Add -D prefix for adding definitions via add_definitions Remove extraneous double-quote Change default config definition adding to the syntax in master Switch back to old CMAKE_<LANG>_FLAGS way of setting the language standards and try to go back to 2.8.12 minimum Switch back setting compile definitions for non-Windows branch too. Use SET with CMAKE_<LANG>_FLAGS. Convert some usages of appending to CMAKE_<LANG>_FLAGS to add_compile_options where possible. Set CMAKE_<LANG>_FLAGS_INIT instead of CMAKE_<LANG>_FLAGS Make sure configureopimitzation.cmake is included correctly in test build. Try to add brackets to get the Linux ARM compilation working correctly. Define standard language version in configurecompiler.cmake instead of root CMakeLists (so tests get it) Try to move langauge standard check to configure.cmake define language standard in each root CMakeLists.txt Fix off-Windows test build. Set CMAKE_EXPORT_COMPILE_COMMANDS after the project() call * Set CMAKE_USER_MAKE_RULES_OVERRIDE to "" to not break incremental builds after building on a branch that had it set to a path. * Remove CMake version output. * Move comment outside of multiline command. * Retry setting CMAKE_USER_MAKE_RULES_OVERRIDE * Remove unnecessary variable wrappers. * Simplify cmake 3 resolution. * Explicitly use CMAKE_CXX_FLAGS for C++-only flags that GCC complains about on C files. * Set -Wall via CMAKE_<LANG>_FLAGS until we can move all flag settings to add_compile_options * Fix typos * Another temporary precedence issue. * include configureoptimization.cmake in configurecompiler.cmake * Move setting CMAKE_EXPORT_COMPILE_COMMANDS to configurecompiler.cmake. * Rename configure.cmake -> verify_lto.cmake. * Fix path to verify-lto * Try using CMAKE_<LANG>_FLAGS instead of CMAKE_<LANG>_FLAGS_INIT. * Revert name change to configure.camek
2019-05-24Delete FEATURE_USE_LCID (#24767)Jan Kotas1-135/+0
Never defined and obsolete
2019-05-23Profiler attach over the diagnostics pipe (#24670)David Mason2-6/+0
Remove the old windows only profiler attach mechanism and replace it with a cross plat implementation over the diagnostics pipe
2019-05-21Fix loading libcoreclrtraceptprovider.soMike McLaughlin1-0/+2
2019-05-15Delete unicode API emulator (#24581)Michal Strehovský1-2/+0
2019-05-14Add explicit cmake dependency between clretwrc and eventing_headers. (#24575)Jeremy Koritzinsky1-1/+3
2019-05-08Specify version.dll and add notification hook for delay load (#24449)Elinor Fung3-0/+31
Mitigates an issue with hijacking of version.dll. This is particularly an issue for self-contained and single-file-exe apps, as the hijacking in those cases does not require access to a machine-wide .NET Core install.
2019-05-06Handle E_NOTIMPL return from CoInitializeEx. (#24387)Jeremy Koritzinsky2-0/+3
* Handle E_NOTIMPL return from CoInitializeEx. * Remove unneeded STA attributes.
2019-05-03Use our local-built instances of tools from ↵Jeremy Koritzinsky1-4/+11
Microsoft.DotNet.BuildTools.CoreClr instead of using the package. (#24347) * Use our local-built instances of tools from Microsoft.DotNet.BuildTools.CoreClr instead of using the package. * Fix const-correctness in InjectResource. * Build cross-arch native components before building native components for target arch. * Build InjectResource and GenClrDebugResource for the host arch when cross-building and import the targets into the cross-build. * install(EXPORT) in the directory where the target is created
2019-04-19Block usage of default interfaces feature in COM scenarios (#23970)Aaron Robinson2-2/+3
* Block default interface usage in COM scenarios Add additional test cases and move some CCW functions to a more consolidated layout.
2019-04-12Fix OSX debugging (#23924)Jan Vorlicek1-0/+4
A recent change has incorrectly added dependency on libcoreclrpal.a to libutilcodenohost.a. This in turn, due to the transitive propagation of dependencies, caused the libmscordbi to be linked with libcoreclrpal.a. So libmscordbi contained its own PAL after that change, which is wrong. libmscordbi should depend on PAL APIs through libmscordaccore that exports the symbols it needs for it in order to keep just one PAL in the process. The fix is to remove the libcoreclrpal.a dependency and export few new symbols from libmscordaccore instead.
2019-04-09Fix several issuesJan Vorlicek1-1/+0
* Fix build on OSX and Linux machines without NUMA installed - there were couple of places where I was missing ifdefs * Fix bug in nodeMaskLength computation * Remove testing change in eeconfig.cpp that has leaked into the PR * Fix GCToOSInterface::GetTotalProcessorCount for embedded GC to return all processors on the system, not just the ones enabled for the current process.
2019-04-08Allow reabstraction of default interface methods (#23313)Michal Strehovský2-0/+2
Allow the runtime to load types with incomplete interface implementations. With this change, we allow (in pseudo-C#): ```csharp interface IFoo { void Frob() { } } interface IBar : IFoo { abstract void IFoo.Frob() } class Fooer : IBar { } ``` Calling IFoo.Frob on an instance of `Fooer` will result in new exception being thrown because the default implementation of `IFoo.Frob` was re-abstracted by `IBar`.
2019-04-04Disable marshalling delegates as _Delegate and enable marshalling delegates ↵Jeremy Koritzinsky2-1/+3
as IDispatch. (#23738) * Disable marshalling delegates as _Delegate and enable marshalling delegates as IDispatch. * ifdef out the new IDispatch marshalling on non-COM-supporting platforms. * PR feedback.
2019-03-25Disable loading IJW assemblies into collectible ALCJan Vorlicek2-0/+2
2019-03-19Implement support for copy constructors when marshalling in IJW (#22805)Jeremy Koritzinsky2-0/+4
Fixes #22219. I decided to try simplifying the code when bringing this feature over from .NET Framework. The .NETFX x86 implementation of this marshaler adds a lot of extra code-paths, and intercepts the calling stub to enable it to exactly replicate the behavior of what would be the native code by copy-constructing an object in-place where it goes on the stack for the native call. Instead of adding all of that extra goo, I decided to keep the implementation much more similar to the non-x86 implementation from .NETFX. Instead of intercepting the call and adding bookkeeping helper stubs, the marshaler just copies to a local in the IL stub, just like non-x86. When calling the native function, it just loads the local onto the IL stack and calls the native function as a normal function. There is a difference there, but I cannot think of a way that the difference is observable to the user. The non-x86 implementation is identical to the .NETFX implementation.
2019-03-07Update error message for when a parent is marked as COMVisible(false) (#23092)Aaron Robinson1-1/+1
* Update message to include type and parent type marked as COMVisible(false)
2019-03-02Revert "Revert "Improve coreclrhost.h header" (#22955)" (#22973)Jarret Shook1-4/+4
This reverts commit 831cb13f1432aac09e66a8543831d3ed55b4bddf.
2019-03-02Revert "Improve coreclrhost.h header" (#22955)Jarret Shook1-4/+4
2019-03-01Merge pull request #22801 from janvorli/improve-coreclrhost-headerJan Vorlicek1-4/+4
Improve coreclrhost.h header
2019-02-26GCC compatibility fixes #7 (#22810)Sinan Kaya1-1/+1
* Use thread_local for thread local storage on non MSVC targets * Use local copy of visitor rather than function parameter * Remove extra class qualifier * Replace hex number representation in ASM files * Reorder STDAPI and DLLEXPORT * Suppress conversion Suppress warning during hash add casting * Remove anonymous struct src/vm/codeversion.h:112:16: warning: ‘struct NativeCodeVersion::<anonymous union>::SyntheticStorage’ invalid; an anonymous union can only have non-static data members [-fpermissive] struct SyntheticStorage * Remove class declaration Remove extra class declaration * Remove extern C * Add implicit paranthesis src/vm/amd64/virtualcallstubcpu.hpp:735:103: warning: suggest parentheses around ‘-’ in operand of ‘&’ [-Wparentheses] resolveInit.toMiss1 = offsetof(ResolveStub,miss)-(offsetof(ResolveStub,toMiss1)+1) & 0xFF; ^ src/vm/amd64/virtualcallstubcpu.hpp:741:103: warning: suggest parentheses around ‘-’ in operand of ‘&’ [-Wparentheses] resolveInit.toMiss2 = offsetof(ResolveStub,miss)-(offsetof(ResolveStub,toMiss2)+1) & 0xFF; Add parenthesis src/vm/dataimage.cpp:631:55: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses] previousRvaInfo->rva == rvaInfo->rva && previousRvaInfo->size >= rvaInfo->size Add parenthesis src/debug/daccess/daccess.cpp:6871:29: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses] _ASSERTE(peFile == NULL && reflectionModule != NULL || peFile != NULL && reflectionModule == NULL); Add parenthesis src/vm/dataimage.cpp:631:57: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses] (previousRvaInfo->rva == rvaInfo->rva) && (previousRvaInfo->size >= rvaInfo->size) * Initialize member 1 src/ilasm/method.cpp:35:36: warning: operation on ‘((Method*)this)->Method::m_ulColumns[0]’ may be undefined [-Wsequence-point] m_ulColumns[0]=m_ulColumns[0]=0; * Remove unknown compiler option * Abstract DLLEXPORT
2019-02-25Use function pointer term in the coreclr_create_delegate docJan Vorlicek1-2/+2
2019-02-22Remove 'from HRESULT' (#22782)Dan Moseley2-2/+0
2019-02-22Improve coreclrhost.h headerJan Vorlicek1-2/+2
The header didn't contain comments on the APIs, which was pointed out in Also, the function declarations and pointers didn't include __stdcall and so it caused crashes when someone developing his own host on x86 Windows used __cdecl as the default calling convention (#22217)
2019-02-22More GNUC Fixes (#22687)Sinan Kaya3-8/+11
* Replace __sync_swap with __atomic_exchange_n __sync_swap() is a clang specific function. * Remove multiline comment * Add paranthesis around sum src/md/hotdata/../inc/streamutil.h:73:34: warning: suggest parentheses around ‘+’ in operand of ‘&’ [-Wparentheses] UINT32 aligned = *totalBytes + 3 & ~3; * Define __int64 * Define windows types for tests * Remove undefined has_builtin defines and define alloca and inline for GNUC * Remove __clang__ where possible * Add implicit casting to help compiler find WCHAR* variant src/binder/assembly.cpp:294:73: error: no matching function for call to ‘SString::SString(SString)’ return (pAsmName == nullptr ? nullptr : pAsmName->GetSimpleName()); ^ In file included from src/inc/sstring.h:1082:0, from src/inc/ex.h:19, from src/inc/stgpool.h:28, from src/inc/../md/inc/metamodel.h:18, from src/inc/../md/inc/metamodelro.h:19, from src/inc/metadata.h:17, from src/binder/../vm/util.hpp:19, from src/binder/../vm/common.h:110, from src/binder/assembly.cpp:14: src/inc/sstring.inl:73:8: note: candidate: SString::SString(void*, COUNT_T) inline SString::SString(void *buffer, COUNT_T size) ^ src/inc/sstring.inl:73:8: note: candidate expects 2 arguments, 1 provided src/inc/sstring.inl:436:8: note: candidate: SString::SString(SString::tagLiteral, const WCHAR*, COUNT_T) inline SString::SString(tagLiteral dummytag, const WCHAR *literal, COUNT_T count) ^ src/inc/sstring.inl:436:8: note: candidate expects 3 arguments, 1 provided src/inc/sstring.inl:418:8: note: candidate: SString::SString(SString::tagLiteral, const WCHAR*) inline SString::SString(tagLiteral dummytag, const WCHAR *literal) ^ src/inc/sstring.inl:418:8: note: candidate expects 2 arguments, 1 provided src/inc/sstring.inl:401:8: note: candidate: SString::SString(SString::tagUTF8Literal, const UTF8*) inline SString::SString(tagUTF8Literal dummytag, const UTF8 *literal) ^ src/inc/sstring.inl:401:8: note: candidate expects 2 arguments, 1 provided src/inc/sstring.inl:382:8: note: candidate: SString::SString(SString::tagLiteral, const CHAR*) inline SString::SString(tagLiteral dummytag, const ASCII *literal) * Reorder DLLEXPORT and STDAPI GNUC wants extern "C" <attribute> format. * Abstract __FUNCSIG__ * Abstract __debugbreak() * Move common compiler options out of clang and add Wno-unused-value * Add paranthesis around || and && src/gc/gc.cpp:9084:38: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses] (!chosen_power2) && (i < free_space_count)); * Set Wno-delete-non-virtual-dtor for CXX files only * Don't warn on unterminated endif labels * Suppress unused functions * Use 0x syntax rather than h syntax on GNU asm files * Correct constructor call directly src/ToolBox/superpmi/superpmi-shared/logging.cpp:301:27: required from here src/inc/clr_std/string:58:9: error: cannot call constructor ‘std::basic_string<char>::basic_string’ directly this->basic_string::basic_string(_Ptr, c_len(_Ptr)); * Suppress NULL used in arithmetic warnings
2019-02-19Fix CLRDataCreateInstance export. This was breaking SOS. (#22701)Mike McLaughlin2-19/+3
Fix CLRDataCreateInstance export. This was breaking SOS. Added the right cmake magic so the function is exported properly.
2019-02-11Support building with VS2019 Preview (#22525)Tanner Gooding1-5/+0
* Support building with VS2019 Preview * Fixing gen-buildsys-win to only set the architecture for the VS generator * Refactoring Dev11/147911/fpcw.cpp so that it compiles under VS2019 * Removing the remaining traces of VS2015 build support
2019-02-11Delete mda.cs and related dead code (#22535)Stephen Toub2-36/+0
2019-02-10Cleanup DLL exports (#22500)Jan Kotas3-19/+14
2019-02-09Set visibility option to hidden (#21924)Adeel Mujahid6-19/+45
2019-02-07Cleanup LLVM assumption (#22456)Sinan Kaya1-2/+2
We want to support GNU compilation for CoreCLR. Luckily both LLVM and GNU compilers define __GNUC__ and there are a lot of things they can share.
2019-02-06Throw an exception when passing strings by-value as out parameters. (#21513)Jeremy Koritzinsky2-2/+2
* Throw an exception when passing strings by-value as out parameters. * Fix encoding * Don't use override in this PR. * Clean up Marshal_In Marshal_In was copied back into existence from Marshal_InOut. Clean it up a bit. * Remove extraneous whitespace. * Fix failing test. * Remove out attribute in COM string tests. * Add back attribute and check for exception thow in COM tests. * Add block comment to explain the implementation of Reverse_LPWStr_OutAttr in the NETServer. * Only throw in a CLR->Native marshalling situation. * Fix asserts from changed code-paths used in ILWSTRMarshaler. * Add comment and explicitly load in a null value (instead of leaving it uninitialized). * Apply suggestions from code review Co-Authored-By: jkoritzinsky <jkoritzinsky@gmail.com> Co-authored-by: Jan Vorlicek <janvorli@microsoft.com>
2019-01-23Remove all traces of FEATURE_STACK_PROBE. (#22149)Filip Navara2-26/+0
2019-01-20Cleanup array related FCalls (#22097)Jan Kotas2-2/+1
* Cleanup Array FCalls * Disable outdated CoreFX tests https://github.com/dotnet/corefx/pull/34700
2019-01-18Handle complex constrained calls with default interface methods (#21978)Michal Strehovský2-0/+2
This adds handling for the interface dispatch corner case where: * We have a constrained callsite to a method on a generic interface in shared code * The callsite cannot be statically resolved because the result of dispatch depends on the generic context * At runtime, the dispatch resolves to a default interface method This would require us to have infrastructure to build "boxing thunks" - thunks that would box their first argument before dispatching to the default interface method implementation. Since this is a corner case and the fix is actually quite involved, we're making the runtime just throw in this situation. The test is written so that it should pass both if the runtime chooses to throw, or if the runtime makes the boxing thunk (we're not hardcoding the implementation limitation).
2019-01-08Fix issue #20585 createdump explicitly uses /tmp. (#21866)Mike McLaughlin1-0/+1
Changed to PAL's GetTempPathA to get the temp path.
2019-01-03Adds portable version of EncodingTable (#21735)Marek Safar1-1/+0
* Adds portable version of EncodingTable Most of the implementation is extracted from CoreRT * Use string comparer directly * Remove no longer used COMNlsInfo * Adds localization support * Removes FeatureCoreFxGlobalization configuration * Remove redudant encodings look up from GetEncoding * Keep Hashtable for nameToCodePage as it does not lock on read * Replace locked dictionary lookup with short switch * Include comment with msbuild task link used to generate the data file
2019-01-02Delete lstrlen from Unix PAL (#21745)Jan Kotas2-5/+3
strlen/wcslen works just fine.
2018-12-12Added support for debugging a sandboxed app on Mac (#21068)Oded Hanson6-31/+157
* Fixed bug in StackString where the size is not initialized correctly to STACK_COUNT * Added CharString and WCharString template classes and a generic CharStringFromLPCWSTR method * Added support for debugging a sandboxed app on Mac This change fixes the usage of IPC while debugging while running in a sandbox. When running in a sandbox, the temporary folder for each process will be different. Thus the pipes being created in TwoWayPipe right now would be created in different directories in the debugger process and the process being debugged. This change configures the folder to be used based on the application group ID that the sandboxed app belongs to. For the same reasons, the names sempahores being used to synchronize the debugger attach need to be prefixed with the application group ID. This change was abit more involved since the name of the semaphore is limited to 31 characters, so we had to encode the semaphore names differently to make them shorter. Last, new APIs to the debugger shim were added to support this new feature. This change only handles the runtime side and the dbgshim. An additional change to vsdbg needs to be done to use the new APIs. fixes #21066 * Fixed build breaks on non Mac Unix platforms * Fixed usage of gApplicationGroupId in non apple environments * Fixed bug in semaphore names * Got rid of usage of StackString * Made PAL_GetApplicationGroupId Apple specific * Added comment about pragma pack * Fixed comment * Added exported symbols * Duplicated applicationGroupId so it can be used from another thread during register complete callback * Renamed BitNum2ByteNum to GetExtraEncodedAreaSize to make intent clearer * Fixed nit comments * Removed redundant changes in StackString * Fixed windows build break * Fixed compilation switch from __APPLE to __APPLE__ * Added missing exports
2018-11-21Introduce Marshall.LoadLibrary API (#20871)Swaroop Sridhar2-0/+7
Implement Native LoadLibrary API This change commits the following changes: 1) Refactoring DllImport code to reuse LodLibrary by search for pInvoke and LoadLibrary cases 2) Implement the new Native Library API in System.Runtime.Interop.Marshall 3) Add tests for the new APIs
2018-11-12Allow jit to examine type of initonly static ref typed fields (#20886)Andy Ayers2-0/+4
The jit incorporates the value of integer and float typed initonly static fields into its codegen, if the class initializer has already run. The jit can't incorporate the values of ref typed initonly static fields, but the types of those values can't change, and the jit can use this knowledge to enable type based optimizations like devirtualization. In particular for static fields initialized by complex class factory logic the jit can now see the end result of that logic instead of having to try and deduce the type of object that will initialize or did initialize the field. Examples of this factory pattern in include `EqualityComparer<T>.Default` and `Comparer<T>.Default`. The former is already optimized in some cases by via special-purpose modelling in the framework, jit, and runtime (see #14125) but the latter is not. With this change calls through `Comparer<T>.Default` may now also devirtualize (though won't yet inline as the devirtualization happens late). Also update the reflection code to throw an exception instead of changing the value of a fully initialized static readonly field. Closes #4108.