-
-
Notifications
You must be signed in to change notification settings - Fork 408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with CSLA 9 preview #4417
Comments
Note, this is possibly fixed with: The main generic for the interface is now decorated with that PR. I'm not sure if the decorations for the individual generic methods need to flow up as well. I've found I get warnings when I don't propagate those up the stack as well. However, that PR may resolve this issue. |
Re-opening as there is another issue revealed by fixing the first. |
Closing as complete with PR #4417 |
Closing as complete with PR #4417 |
Describe the bug
When running iOS the following error occurs.:
'Generic implementation type 'Csla.DataPortal1' has a DynamicallyAccessedMembers attribute applied to a generic argument type, but the service type 'Csla.IDataPortal1' doesn't have a matching DynamicallyAccessedMembers attribute on its generic argument type.'
When looking at the Main branch we can see in DataPortalT.cs that it is decorated with the DynamicallyAccessedMembers attribute in several locations, however the matching IDataPortalT.cs interface is not similarly decorated.
For example, the DataPortalT.cs DoCreateAsync method has its generic decorated but if we look at methods that call it in the same class; the
async Task<T> CreateAsync(params object[] criteria)
is not decorated, theT Create(params object[] criteria)
also is not but theobject Create(
is decorated. If we look at the IDataPortalT.cs, none of the method signatures for Create are decorated.The DynamicallyAccessedMembers attribute is similar to adding the async keyword, once there it needs to flow up the stack. As Microsoft states:
"To fix this, we must "annotate and propagate" by applying annotations all the way up the call chain until we reach a statically known type (like System.DateTime or System.Tuple), or another annotated value. "
https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/fixing-warnings#dynamicallyaccessedmembers
Right now CSLA 9.0 may not fully work with full trimming because of this. Particularly with aggressive AOT compilation on platforms like iOS.
Version and Platform
CSLA version: 9.0.0-rc1-gb7b53fbc46
OS: iOS
Platform: MAUI
Code that Fails
Sample CSLA project updated to .NET 9, verified issue in CSLA codebase. Errors out before any relevant user code is executed. iOS is more particular with this type of issue.
Stack Trace or Exception Detail
0x38 in UIKit.UIApplication.xamarin_UIApplicationMain C#
0xF in UIKit.UIApplication.UIApplicationMain at /Users/builder/azdo/_work/5/s/xamarin-macios/src/UIKit/UIApplication.cs:61,5 C#
0x4A in UIKit.UIApplication.Main at /Users/builder/azdo/_work/5/s/xamarin-macios/src/UIKit/UIApplication.cs:96,4 C#
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: