Commit Graph

154 Commits

Author SHA1 Message Date
Sergio Pedri 186ff01aeb Remove unnecessary constructor 2022-04-06 22:48:54 +02:00
Sergio Pedri 257250dc70 Add IReadOnlyObservableGroup<out TKey> 2022-04-06 22:48:54 +02:00
Sergio Pedri 5a8fd0bf1e Update [ICommand] generator for Task<T> returns 2022-03-25 22:28:38 +01:00
Sergio Pedri bf4b5f6f43
Merge pull request #152 from CommunityToolkit/dev/also-broadcast-change-attribute
Add new [AlsoBroadcastChange] attribute
2022-03-25 22:23:04 +01:00
Sergio Pedri 54519726d9 Rename files 2022-03-16 15:30:15 +01:00
Sergio Pedri 69a9a69b7f Change namespace to .Mvvm 2022-03-16 15:30:15 +01:00
Sergio Pedri 317241bb83 Move collection types to MVVM Toolkit 2022-03-16 15:30:15 +01:00
Sergio Pedri 32a17cf5b5 Add AlsoBroadcastChangeAttribute type 2022-03-16 15:30:03 +01:00
Sergio Pedri b632429c15 Add diagnostics for invalid [ObservableProperty] containing type 2022-03-13 19:37:15 +01:00
Sergio Pedri a3c55276a8 Fix async relay command CanExecute raised with no concurrency 2022-03-12 00:44:54 +01:00
Sergio Pedri 7a4eccbc10 Remove CanExecute checks from Execute logic 2022-03-09 22:14:51 +01:00
Sergio Pedri 0aa38c5e8a Remove ArrayPoolBufferWriter<T> explicit constructor
This fixes a build error with .NET Native
2022-03-05 20:29:07 +01:00
Sergio Pedri 5afbbdf6f8 Improve XML docs for ICommandAttribute.IncludeCancelCommand 2022-03-01 21:35:42 +01:00
Sergio Pedri 63a6676790 Add IncludeCancelCommand option to generator model 2022-03-01 17:22:37 +01:00
Sergio Pedri 8ae1006b4d Add IAsyncRelayCommandExtensions.CreateCancelCommand 2022-03-01 17:08:02 +01:00
Sergio Pedri 9c0a1b36cb Minor bug fixes, add more unit tests 2022-03-01 00:00:52 +01:00
Sergio Pedri c9f5b9fe42 Fix async command event notifications 2022-02-28 23:35:26 +01:00
Sergio Pedri 3c71d4b401 Notify CanExecute when invoking an async command 2022-02-28 22:57:49 +01:00
Sergio Pedri 33c58e3eda Remove try/catch when awaiting tasks, ignore exceptions
This allows exceptions to remain unobserved and propagate to TaskScheduler.UnobservedTaskException. It will also be more efficient, as there is no longer an exception being thrown and handled if there's one.
2022-02-28 22:37:26 +01:00
Sergio Pedri 98fc90732a Add __TaskExtensions.GetAwaitableWithoutEndValidation 2022-02-28 22:37:26 +01:00
Sergio Pedri 0e26a29a57 Update async commands XML docs 2022-02-27 18:55:12 +01:00
Sergio Pedri f6ca1f0bc4 Switch default async command concurrency to false 2022-02-27 18:53:07 +01:00
Sergio Pedri bc6f26f118 Improve ILLinker analyzer suppression 2022-02-22 19:37:36 +01:00
Sergio Pedri ee30d3129c Add temporary workaround for AD0001 warning 2022-02-22 19:17:02 +01:00
Sergio Pedri 9b1596d453 Refactor conditional logic into separate target
This works around <Choose> not supporting <Target> parents
2022-01-14 13:34:22 +01:00
Sergio Pedri 0d894ea7c9 Minor tweaks to MSBuild checks 2022-01-14 13:01:33 +01:00
Sergio Pedri 408c44b4a5 Simplify Roslyn assembly resolution logic 2022-01-14 00:34:53 +01:00
Sergio Pedri 861beea017 Update .targets for MVVM Toolkit to fix .wapproj issues 2022-01-14 00:24:41 +01:00
Sergio Pedri bd4f365f01 Bump NuGet package reference versions 2022-01-13 21:53:49 +01:00
Sergio Pedri 99cf8cb072 Minor code style tweaks, add more XML comments 2022-01-13 18:17:42 +01:00
Jonathon Marolf 914fc275e7
Calculate the current C# compiler version
This change allows us to calculate the current C# compiler version in a way that will work on all platforms and only relies on the `Microsoft.CSharp.CurrentVersion.targets` target (specifically [this line](https://github.com/dotnet/msbuild/blob/main/src/Tasks/Microsoft.CSharp.CurrentVersion.targets#L315)) being imported. `Microsoft.CSharp.CurrentVersion.targets` is the core msbuild logic for finding the C# compiler and is used universally so this fix should work everywhere there is a C# compiler to be found.
2022-01-12 20:51:59 -08:00
Sergio Pedri 6f20b2611c Switch attribute property setters to init-only 2022-01-01 19:53:50 +01:00
Sergio Pedri f81cf4b4f9 Switch to target-type new() for direct return values 2022-01-01 17:02:31 +01:00
Sergio Pedri 57f4c3d97d Add [SkipLocalsInit] to missing assemblies 2022-01-01 16:54:47 +01:00
Sergio Pedri 350c2374f5 Strip source generator attributes by default
Define "MVVMTOOLKIT_KEEP_SOURCE_GENERATOR_ATTRIBUTES" to keep them
2021-12-31 20:10:02 +01:00
Sergio Pedri 704e5073f1 Enable implementing OnActivated/OnDeactivated with [ObservableRecipient] 2021-12-31 17:58:12 +01:00
Sergio Pedri cc3205a362 Move RequiresUnreferencedCodeAttribute to correct folder 2021-12-31 16:47:10 +01:00
Sergio Pedri 8e7c48fab1 Move MVVM Toolkit internals tests to separate project 2021-12-31 16:47:10 +01:00
Sergio Pedri a7e0f2c370 Enable trimming support in the MVVM Toolkit
Also added linker annotations where needed
2021-12-29 19:26:37 +01:00
Sergio Pedri cb4e418ad3 Refactor remaining partial type declarations 2021-12-29 18:56:14 +01:00
Sergio Pedri 0ae955d297 Add .targets file to disable source generators on Roslyn 3.x
Still a bit experimental, needs more testing and validation
2021-12-29 18:31:48 +01:00
Sergio Pedri af82fe95ba Fix a small typo in XML docs
This closes #58
2021-12-29 18:31:47 +01:00
Sergio Pedri 6fb377baee Remove cached delegate from ObservableObject 2021-12-29 18:31:11 +01:00
Sergio Pedri 3e61aeb3c1 Remove [Pure] attribute usages 2021-12-29 18:06:54 +01:00
Sergio Pedri f6b604a824 Add dot to exception messages in remaining call sites 2021-12-20 13:15:20 +01:00
Sergio Pedri 68b715f688 Remove unnecessary null warning suppressions 2021-12-14 10:40:18 +01:00
Sergio Pedri aee23b8935 Add unit tests for ComponentModel checks 2021-12-14 10:35:14 +01:00
Sergio Pedri 5fef9ab55f Add parameter null validation to Messaging APIs 2021-12-14 10:35:13 +01:00
Sergio Pedri 61f92f309c Move MessageHandler to separate file 2021-12-14 10:33:06 +01:00
Sergio Pedri 113d1a2134 Add parameter null validation to Input APIs 2021-12-14 10:33:06 +01:00
Sergio Pedri d18998a054 Add parameter null validation to DependencyInjection API 2021-12-14 10:33:06 +01:00
Sergio Pedri 9af66c4a8d Add parameter null validation to ComponentModel APIs 2021-12-14 10:33:06 +01:00
Sergio Pedri 796c1e218b Add polyfill for ArgumentNullException.ThrowIfNull 2021-12-14 10:33:05 +01:00
Sergio Pedri c010ca5f11 Minor code refactoring 2021-12-14 10:33:05 +01:00
Sergio Pedri 216b403759 Add more documentation to unsupported paths 2021-12-13 13:36:29 +01:00
Sergio Pedri aa560fe256 Break down documentation into paragraphs 2021-12-13 13:36:29 +01:00
Sergio Pedri 56fb755f14 Fix a bug in StrongReferenceMessenger.IsRegistered 2021-12-13 13:36:29 +01:00
Sergio Pedri 3d59fd019b Remove unnecessary generic type parameters 2021-12-13 13:36:29 +01:00
Sergio Pedri fa7042fd80 Update StrongReferenceMessenger internal documentation 2021-12-13 13:36:28 +01:00
Sergio Pedri 8b2cad51f8 Add Unit type specialization to StrongReferenceMessenger 2021-12-13 13:36:28 +01:00
Sergio Pedri 6b02f86f0a Enable IRecipient<TMessage> optimization for StrongReferenceMessenger 2021-12-13 13:36:28 +01:00
Sergio Pedri 48ae66cdd7 Use MessageHandlerDispatcher handlers in StrongReferenceMessenger 2021-12-13 13:36:28 +01:00
Sergio Pedri 96dee08dc6
Merge pull request #48 from CommunityToolkit/dev/appcontext-switches
Enable INotifyPropertyChanging AppContext switch
2021-12-13 13:35:48 +01:00
Sergio Pedri 32a27ee157
Merge pull request #44 from CommunityToolkit/dev/weak-messenger-opts
Optimize WeakReferenceMessenger
2021-12-10 01:12:28 +01:00
Sergio Pedri b26db77f48 Enable IsINotifyPropertyChangingDisabled switch in ObservableObject 2021-12-10 01:03:19 +01:00
Sergio Pedri ffaacbad9f Add Configuration type 2021-12-10 01:03:19 +01:00
Sergio Pedri 75c51164b3 Add concurrency control setting to [ICommand] attribute 2021-12-10 00:08:12 +01:00
Sergio Pedri a6160f2126 Remove unnecessary async state machine allocations 2021-12-10 00:02:22 +01:00
Sergio Pedri 01d7102ea9 Add cancellation support to AsyncRelayCommand<T> 2021-12-10 00:02:22 +01:00
Sergio Pedri 03989131d1 Add cancellation support to AsyncRelayCommand 2021-12-10 00:02:22 +01:00
Sergio Pedri 5dc526aa10 Add [AlsoNotifyCanExecuteFor] attribute type 2021-12-09 21:01:30 +01:00
Sergio Pedri 7046476d51 Minor codegen improvements
Removed type checks from guarded devirtualization when broadcasting
2021-12-09 11:35:26 +01:00
Sergio Pedri 2b690d7f60 Tweak StrongReferenceMessenger.Send to remove null suppression 2021-12-09 11:01:17 +01:00
Sergio Pedri 1b66760d67 Add initial support for [ICommand] CanExecute property 2021-12-09 10:49:58 +01:00
Sergio Pedri 6cb7e571d4 Add more comments and XML docs 2021-12-02 18:04:04 +01:00
Sergio Pedri 27ed92db88 Skip array covariance checks in ArrayPoolBufferWriter<T> 2021-12-02 18:04:04 +01:00
Sergio Pedri 39388b1c1e Optimize ConditionalWeakTable2<,>.Enumerator
Also done some refactoring to streamline code across targets
2021-12-02 18:04:04 +01:00
Sergio Pedri 75869de313 Optimize WeakReferenceMessenger broadcast loop 2021-12-02 18:04:04 +01:00
Sergio Pedri 96606f208d Enable fast paths for IRecipient<TMessage> recipients 2021-12-02 18:04:04 +01:00
Sergio Pedri c0f1704aed Remove Unsafe.As<T>(object) delegate type aliasing 2021-12-02 18:04:04 +01:00
Sergio Pedri 416653a2aa Enable Unit type specialization for WeakReferenceMessenger 2021-12-02 18:04:03 +01:00
Sergio Pedri 316557b683 Fix a bug in Dictionary2<TKey, TValue>.Enumerator.MoveNext() 2021-12-02 18:04:03 +01:00
Sergio Pedri dd2a827694 Switch messengers to new dictionary, code refactoring 2021-12-02 18:04:03 +01:00
Sergio Pedri 622be37d5c Specialize Dictionary<TKey, TValue> for the messenger types 2021-12-02 18:04:03 +01:00
Sergio Pedri 7c2bc7f0ed Port Dictionary<TKey, TValue> from .NET 6 2021-12-02 18:04:03 +01:00
Sergio Pedri a86eb44474 Hoist enumeration lock for custom conditional table 2021-12-02 18:04:03 +01:00
Sergio Pedri a6f5dc5ff2 Remove tracking of multiple active enumerators 2021-12-02 18:04:03 +01:00
Sergio Pedri c2a8731452 Switch .NET table GetEnumerator() to ref struct enumerator 2021-12-02 18:04:02 +01:00
Sergio Pedri 03032c7a1a Moved .NET Stadard 2.0 ConditionalWeakTable type 2021-12-02 18:04:02 +01:00
Sergio Pedri 65e6746c57 Initial refactor pass for .NET 6 ConditionalWeakTable 2021-12-02 18:04:02 +01:00
Sergio Pedri aaecb7176b Port ConditionalWeakTable<TKey, TValue> from .NET 6 2021-12-02 18:04:02 +01:00
Sergio Pedri 35b034fc62 Fix StrongReferenceMessenger.Unregister, add concurrent unit tests 2021-11-29 14:21:08 +01:00
Sergio Pedri 32c23450f9 Fix some bugs in StrongReferenceMessenger.Unregister[All] APIs 2021-11-29 13:31:49 +01:00
Sergio Pedri 1910995151 Update CommunityToolkit.Mvvm to .NET 6 2021-11-22 17:37:34 +01:00
Sergio Pedri e2b336184f Fix app domain unloading issue on .NET Framework 2021-11-02 02:36:45 +01:00
Sergio Pedri 6afdd81742 Refactor multiline variable declarations 2021-11-01 23:42:45 +01:00
Sergio Pedri 51c7a67c20 More code style improvements and tweaks
- Remove unused namespaces
- Remove unused attributes
- Remove unnecessary #nullable enable directives
- Sort using directives
- Simplify names
2021-11-01 22:29:46 +01:00
Sergio Pedri c176080d37 Switch whole solution to file-scoped namespaces 2021-11-01 20:46:46 +01:00
Sergio Pedri 7a2295b03c Update some code style rules
In particular:
- Use explicit types everywhere to improve clarity
- Use target-typed new() expression when target is explicit
- Use explicit discard for value-returning statements
2021-11-01 20:34:00 +01:00
Sergio Pedri 11ab330e69 Enable nullability annotations in the entire solution 2021-11-01 19:27:55 +01:00