csla icon indicating copy to clipboard operation
csla copied to clipboard

Analyzer: ReadOnlyListBase subclass must be serializable

Open rockfordlhotka opened this issue 5 years ago • 2 comments

Describe the bug There's an analyzer to make sure business types are marked as Serializable. I would expect that a ReadOnlyListBase subclass would trigger this rule.

Version and Platform CSLA version: 5.2.0 OS: n/a Platform: n/a

Code that Fails

namespace GameMechanics
{
  public class SkillList : ReadOnlyListBase<SkillList, SkillInfo>
  {
  }
}

I declared this code, and even compiled it, and there was no warning or error that this type isn't Serializable.

rockfordlhotka avatar Apr 28 '20 05:04 rockfordlhotka

ReadOnlyListBase implements IReadOnlyListBase, which derives from IMobileObject. The IsMobileObject() extension method should pick this up, but obviously it's not. That's probably where the problem lies.

JasonBock avatar Feb 24 '21 13:02 JasonBock

This is already fixed. But I added a test for this case in an upcoming PR from me.

StefanOssendorf avatar Mar 01 '24 21:03 StefanOssendorf

@StefanOssendorf I appreciate you picking up this issue.

My one observation is that #3687 will probably entirely remove the Serializable attribute analyzer entirely 🫢

rockfordlhotka avatar Mar 03 '24 19:03 rockfordlhotka

That's okay and I saw that. I think for people who will be using 8/7.x this will be okay. (I plan on porting it to 7.x if there's nothing against that). Furthermore I'm learning source gen/analyzer stuff so this is a nice practice :)

Rockford Lhotka @.***> schrieb am So., 3. März 2024, 20:33:

@StefanOssendorf https://github.com/StefanOssendorf I appreciate you picking up this issue.

My one observation is that #3687 https://github.com/MarimerLLC/csla/issues/3687 will probably entirely remove the Serializable attribute analyzer entirely 🫢

— Reply to this email directly, view it on GitHub https://github.com/MarimerLLC/csla/issues/1588#issuecomment-1975273548, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJCZOJWZ7SLQQZNEWZWHHTYWN3IBAVCNFSM4MSP6NS2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJXGUZDOMZVGQ4A . You are receiving this because you were mentioned.Message ID: @.***>

StefanOssendorf avatar Mar 03 '24 19:03 StefanOssendorf