497 Commits over 1,369 Days - 0.02cph!
Fixed publishing addons referencing libraries
* Added helper DistinctReferences / DistinctPackageReferences properties to include all system / package references respectively.
* For addon packages, DistinctPackageReferences will include the parent package.
Package reference fixes (#965)
* Use PackageReference for referencing packages, References for referencing assemblies
* Fixed test passing for the wrong reason
* Rename Compiler.PackageReference to PackageReferences
* Don't fast hotload if a referenced assembly has changed
* More assembly / package reference strictness
* Made generic method resolving / comparing stricter
* We need to re-resolve all member references in fast-hotloaded methods
* More precise logic when deciding if a referencing assembly can be fast-hotloaded
* Constructor resolution regression fix
* Some cleanup in ILGeneratorExtensions
* Hotload.GetMethods helper now matches name
* Access control now caches assembly definitions by name + version
* Assert that the correct assembly definition version is resolved
* Keep exactly the outgoing assembly definition cached, but dispose older versions
* Clean up AccessControl.Resolve a bit
* WIP referencing fast-hotloaded assembly fix
* Fixed unloading IsolatedAssemblyContexts during fast hotload
* Remove some logging
* Fix menu breaking after hotload
* WIP force-reload assemblies that depend on a changed package
* Allow resolving newer assembly versions
* PackageLoader.LoadAssemblyFromPackage cleanup
* Only force an assembly reload if dependent package did a full hotload
* Fix exception in ContextTools.DetermineContext in fast hotloaded methods
* Init TypeLibrary in TestUI.Panels.PanelTests
* Description codegen: just allow multiple [Description] instead of being non-deterministic
Test for Assembly.GetExecutingAssembly()
Failing test reproducing #957
Fix variable types
Although this seems to be non-deterministic, with some cache breaking later replacements
Stricter GenericReference2 test
Fixed #957 by clearing MonoMod's reflection cache
Don't sort generated code blocks inside class groups!
Whoops
Failing test involving generics causing EntryPointNotFoundException
Fixed resolving generic methods
Fixed possible stack overflow when fixing references
Expanded GenericReference test to help investigate
Replacing method now thinks it's inside the original assembly
Fixed references to the wrong assembly in fast hotload
Don't need to relink variable types
Added failing test for changing the body of a lambda
Fixed not being able to resolve private nested types
Fixed #947
Failing test for async methods
#947
Fixed #947 for state machine types
Some safety if ILHotload AST processing throws during Parallel.ForEach
Only run ILHotload AST processing when hotload_fast >= 1
Fall back to normal hotload if exception is thrown during FixReferences
Fast method body hotload (#931)
* 0ms hotload fast path poc when only method bodies change using MonoMod
* Print individual changes during compile, show node paths
* WIP check if all changes are in method bodies
* Add attributes to package assemblies describing changed methods
* SupportsILHotloadAttribute is added if only method bodies change
* MethodBodyChangeAttribute is added for each changed method
* ILHotload looks for SupportsILHotload and MethodBodyChange attributes
* Fixed methods with identical IL not being replaced by ILHotload
* ILHotload should never run with a debugger attached
* Clean up dead code
* Detour using a generated dynamic method copy from the replacing method
* Documentation for Compiler.SyntaxTree.cs
* Added CompilerSettings.SourcePathFilter predicate
* Boilerplate for writing ILHotload tests
* Fixed how file changes are emulated in FastPathTest
* A bit more flexibility in fast path test case code preprocessing
* Added failing fast path hotload test for changing method signatures
* ILHotload: changes must be specifically within a BlockSyntax of a method
* Added Compiler.UpdateParseOptions() for tests to use
* Don't use ILHotload if a preprocessor define changed
* Incremental syntax tree parsing
* Throw when trying to debug an ILHotload swap during a test
* Basic incremental compilation
* Make generated code more deterministic, nicer for incremental compile
* Keep track of which assembly types are actually loaded from
* Re-use compiler options where possible
* Changed fast hotload log to a trace
* Make OnlyMethodBodiesChanged multithreaded, fixed multiple changes in one file
* Failing test for property body changes
* Cleanup ILHotload tests, failing test for overloaded method
* Refactor AST processing for ILHotload
* Fixes after refactor, a bit ugly at the moment
* Support fast hotload for property accessors
* NoticeWidget shows ms if duration < 1s
* Call UISystem.OnHotload after an ILHotload
* ILHotload test for nested blocks
* Fixed ILHotload change detection for nested blocks
* Added hotload_fast engine convar to enable / disable IL hotload
* Added failing test of typeof(T) in method body hotloads
* Failing test for static references
* Fix references to members / types in fast-hotloaded method bodies
* Allow debugging ILHotload in Sandbox.Test
* Test for fast-hotloaded methods with parameter / return types defined in the changed module
* Added failing fast hotload test for compiler-generated type changes
* Don't attempt fast hotload if any compiler-generated type definitions change
* Record event when we ILHotload, matches naming of existing hotloads so we can derive % easily
* Remove defunct code about using cecil as the DMDType, not needed since we fix the references ourselves
---------
Co-authored-by: Matt Stevens <matt@mattstevens.co.uk>
Handle encountering MethodBase operands in GetStackDelta
More helpful error message when trying to get default value of new field
Warn rather than throw if a dictionary key becomes null
Failing test reproducing #933
Warn when unable to find a scope method, instead of error
Fixed error delegates causing an error themselves on upgrade
Fixes #933
Added failing test reproducing #929
Stricter test for #929
Fixed #929
Fixed IServerDll hotload not being able to resolve package assemblies
Fixed ReflectionExtensions.ResolveType
Used to not respect the assembly load context of the target module
Disable detailed hotload diagnostics unless hotload_log >= 2
Add some logging to AsyncTasks.TaskCancel2
To help investigate #210
Allow TaskSource async methods to persist, so they can cancel nicely
Use framework methods to find async state machines / tasks
A bit more protected against changes
Bump up max async task cancellation count
Get rid of debug hotload log
Added failing test reproducing #869
Fixed #869, emit a warning when fields change type instead of an error
Fixed sboxgame/issues#3043
Failing test case to reproduce #876
Fixed #876
HOTLOAD_NOCATCH will stop hotload from catching exceptions
Failing test for lambdas implemented as static methods
Split nested scope method delegate tests
Support for lambdas with nested scope methods
Test for block copying List<T> or T[]
Lists of structs can use array block copying again
More direct copy for StructArrayConverter
Fix possible NRE when logging about methods without declaring types
Fixed setting size of block-copied list
Fixed case where TryLoadGameResource<T> throws instead of returns false
Fixed .csproj for tool packages not referencing EditorBase
Support reading / writing Rays as client input
Escape HTML in console messages, only show first line (#819)
* Escape HTML in console messages
Inspecting stuff still works fine
* Only show the first line of console messages
Inspecting them will show the rest
Demote SwappedOutAssemblyReference error to warning
Group hotload result entries with the same message to avoid console spam
Fixed NRE in HotloadResult.ToString()
Log an exception if one type takes over 80% of total hotload, and >500ms
Added failing hotload test for processing a cleared list
Hotload processes all the elements of the inner array, when they could all be skipped
Added ListUpgrader
Helps with cases like #818
Don't use [CanEdit(SomeType, typeName)] for all SomeType properties
Unless typeName is just "sometype"
https://files.facepunch.com/ziks/1b1711b1/5BoYCf6102.png
Use in-place upgrades where possible in static fields
Fixes #790
Some extra safety in DictionaryUpgrader
For handling in-place upgrades if key hashes change
Support for SceneCamera.Ortho
Added way to ignore assemblies by name in hotloads
Ignore Sandbox.Tools during client / server / menu hotloads
Fixes #765
Added failing test for hotloading constructed generic MethodInfos
Fixed hotloading generic MethodInfos
Added extra test for MethodInfos with generic declaring types
Added more delegate hotloading tests, one failing
Fixed hotload case with lambdas in generic declaring type
Fixes #759
Stop watching assemblies swapped with null
More compiler name consistency fixes
Skip assemblies that depend on a swapped assembly
Warn when two versions of the same named assembly are watched
Log all hotload messages if hotload_log >= 2
Include build number in runtime compiled assemblies
To help with debugging
Made Hotload.WatchedAssemblies / Hotload.WatchedInstances private
Clear invalidated cached fields in DefaultUpgrader on hotload start
Hotload logging tweaks, package assembly names include version
Simplify auto-watching logic when replacing assemblies
Fixed failing hotload test, better swapped asm reference check
Unwatch assemblies swapped with null
Added hotload tests for auto-watching assemblies
Check substitute types don't inherit from a swapped-out type
If type substitution fails in DefaultUpgrader, just substitute null
Fixed possible NRE in ReflectionUpgrader.GetMatchingMember
Fixed recompiling addons that reference a changed addon
Use namespace alias operator in hotload tests
Failing test involving resolving method with namespaceless parameter
Fixed resolving methods with namespaceless parameter types
Fixed VarClass sometimes getting stuck rebuilding every frame
NeedsRebuild was getting set to true during the rebuild, so it'd keep doing it every tick
Failing async method test
Better support for parsing generated names with generic parameter count
Hotload generated name refactor, fixing async state machine types
Failing test for lambdas declared in non-swapped generic methods
But with swapped type parameters
Fixed test in 8a2bb255285d1e47c1314b70cd47f5ef92a2b21d
Log error when encountering unhandled generated types
Implemented a simple assembly resolver for Tools
Allows hotload to make more valid substitutions
Cleanup
Failing hotload tests for lambdas in static constructors
Fixed finding scope method ordinals of static constructors
Stop expecting every method to have a scope ordinal
Fixed IsMatchingType(typeRef, type) with nested types
Fixed ResolveMethod() with a static constructor ref
Fix upgrading lambda display class instances that are found in the wild
GetNewType consistency
Now returns null to mean a substitution couldn't be found
Added failing generic delegate test
Organised and documented delegate hotloading tests
Fixed AreEqualTypes when exactly one param is null
AreEquivalentTypes(old, new) refactor
Fixed finding substitutions for generic parameters
Always use addon map list for map leaderboards in menu
Add scrolling to leaderboard list in menu
Limit main menu leaderboard list to 5 items for now
Show all leaderboards in menu again
Basic support for {map} leaderboard name substitution
Only supported for MapSelect.Official
Added hotload_log engine convar
Whitelist TextWriter and StringWriter
StringWriter only writes to memory. I'm leaving StreamWriter forbidden for now.
Allow sending compiled shaders to clients
Added test for adding properties with default values
Support for log value histograms
https://files.facepunch.com/ziks/2022-10-10/sbox-dev_YnroiYzjt5.png
Add Hotload.AssemblyResolver, warn if not assigned when needed
Set HotloadManager.AssemblyResolver for client / menu / server
Fixed some histograms being offset horizontally
Only show histogram markers that are in range
Fall back to fetching top scores if no scores around user
Added Leaderboard.GetHistogram()
Basic leaderboard histogram drawing
Show markers on friend scores in histogram