You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add AOT reflection warnings for .NET 6+ methods (#4085)
<!-- Please be sure to read the
[Contribute](https://github.com/reactiveui/reactiveui#contribute)
section of the README -->
**What kind of change does this PR introduce?**
<!-- Bug fix, feature, docs update, ... -->
update
**What is the current behavior?**
<!-- You can also link to an open issue here. -->
Some AOT markup is applied to broadly
**What is the new behavior?**
<!-- If this is a feature change -->
Added [RequiresDynamicCode] and [RequiresUnreferencedCode] attributes to
methods and interfaces that use reflection and are not compatible with
AOT environments in .NET 6 or greater. This change improves
compatibility and provides clearer warnings for developers targeting AOT
scenarios.
**What might this PR break?**
AOT requirements updated
**Please check if the PR fulfills these requirements**
- [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been added / updated (for bug fixes / features)
**Other information**:
@@ -127,6 +135,10 @@ public static IDisposable AutoPersist<T, TDontCare>(this T @this, Func<T, IObser
127
135
/// it is possible that it will never be saved.
128
136
/// </param>
129
137
/// <returns>A Disposable to disable automatic persistence.</returns>
138
+
#if NET6_0_OR_GREATER
139
+
[RequiresDynamicCode("The method uses reflection and will not work in AOT environments.")]
140
+
[RequiresUnreferencedCode("The method uses reflection and will not work in AOT environments.")]
141
+
#endif
130
142
publicstaticIDisposableAutoPersistCollection<TItem>(thisObservableCollection<TItem>@this,Func<TItem,IObservable<Unit>>doPersist,TimeSpan?interval=null)// TODO: Create Test
@@ -175,6 +191,10 @@ public static IDisposable AutoPersistCollection<TItem, TDontCare>(this Observabl
175
191
/// it is possible that it will never be saved.
176
192
/// </param>
177
193
/// <returns>A Disposable to disable automatic persistence.</returns>
194
+
#if NET6_0_OR_GREATER
195
+
[RequiresDynamicCode("The method uses reflection and will not work in AOT environments.")]
196
+
[RequiresUnreferencedCode("The method uses reflection and will not work in AOT environments.")]
197
+
#endif
178
198
publicstaticIDisposableAutoPersistCollection<TItem,TDontCare>(thisReadOnlyObservableCollection<TItem>@this,Func<TItem,IObservable<Unit>>doPersist,IObservable<TDontCare>manualSaveSignal,TimeSpan?interval=null)// TODO: Create Test
@@ -200,6 +220,10 @@ public static IDisposable AutoPersistCollection<TItem, TDontCare>(this ReadOnlyO
200
220
/// it is possible that it will never be saved.
201
221
/// </param>
202
222
/// <returns>A Disposable to disable automatic persistence.</returns>
223
+
#if NET6_0_OR_GREATER
224
+
[RequiresDynamicCode("The method uses reflection and will not work in AOT environments.")]
225
+
[RequiresUnreferencedCode("The method uses reflection and will not work in AOT environments.")]
226
+
#endif
203
227
publicstaticIDisposableAutoPersistCollection<TItem,TCollection,TDontCare>(thisTCollection@this,Func<TItem,IObservable<Unit>>doPersist,IObservable<TDontCare>manualSaveSignal,TimeSpan?interval=null)// TODO: Create Test
0 commit comments