Skip to content
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

Consider enforcing nullable type system in backend #754

Closed
johnthagen opened this issue Oct 9, 2020 · 2 comments · Fixed by #780
Closed

Consider enforcing nullable type system in backend #754

johnthagen opened this issue Oct 9, 2020 · 2 comments · Fixed by #780
Assignees
Labels
backend maintenance Issue that makes it difficult to maintain the software or to upgrade installations post-release. refactor

Comments

@johnthagen
Copy link
Collaborator

Similar to TypeScript where we use types such as string | undefined and the compiler checks/enforces this, we could enable nullable context project-wide on the backend:

This would allow us to express a much finer control over where null is allowed in the backend, and open up for precisely describing which of our model fields can have null.

Example:

        // This attribute can be null, denoted by the ?
        [BsonElement("avatar")]
        public string? Avatar { get; set; }

Turning it on on the current code base results in a lot of errors that would need to be sorted out:

Errors
Models\Project.cs(161,30): error CS8765: Nullability of type of parameter 'obj' doesn't match overridden member (possibly because of nullability attributes). [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Project.cs(272,30): error CS8765: Nullability of type of parameter 'obj' doesn't match overridden member (possibly because of nullability attributes). [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\User.cs(139,30): error CS8765: Nullability of type of parameter 'obj' doesn't match overridden member (possibly because of nullability attributes). [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\UserEdit.cs(54,30): error CS8765: Nullability of type of parameter 'obj' doesn't match overridden member (possibly because of nullability attributes). [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\UserEdit.cs(84,30): error CS8765: Nullability of type of parameter 'obj' doesn't match overridden member (possibly because of nullability attributes). [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\UserEdit.cs(131,30): error CS8765: Nullability of type of parameter 'obj' doesn't match overridden member (possibly because of nullability attributes). [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\UserRole.cs(55,30): error CS8765: Nullability of type of parameter 'obj' doesn't match overridden member (possibly because of nullability attributes). [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Word.cs(250,30): error CS8765: Nullability of type of parameter 'obj' doesn't match overridden member (possibly because of nullability attributes). [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Word.cs(289,30): error CS8765: Nullability of type of parameter 'obj' doesn't match overridden member (possibly because of nullability attributes). [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Word.cs(215,30): error CS8765: Nullability of type of parameter 'obj' doesn't match overridden member (possibly because of nullability attributes). [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Word.cs(136,30): error CS8765: Nullability of type of parameter 'obj' doesn't match overridden member (possibly because of nullability attributes). [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Services\SemDomParser.cs(87,24): error CS8767: Nullability of reference types in type of parameter 'x' of 'int SemDomComparer.Compare(SemanticDomain x, SemanticDomain y)' doesn't match implicitly implemented member 'int IComparer<SemanticDomain>.Compare(SemanticDomain x, SemanticDomain y)' (possibly because
 of nullability attributes). [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Services\SemDomParser.cs(87,24): error CS8767: Nullability of reference types in type of parameter 'y' of 'int SemDomComparer.Compare(SemanticDomain x, SemanticDomain y)' doesn't match implicitly implemented member 'int IComparer<SemanticDomain>.Compare(SemanticDomain x, SemanticDomain y)' (possibly because
 of nullability attributes). [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Word.cs(328,23): error CS8618: Non-nullable field 'SrcWordId' is uninitialized. Consider declaring the field as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Word.cs(329,28): error CS8618: Non-nullable field 'SenseStates' is uninitialized. Consider declaring the field as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Word.cs(319,21): error CS8618: Non-nullable property 'Parent' is uninitialized. Consider declaring the property as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Word.cs(320,38): error CS8618: Non-nullable property 'ChildrenWords' is uninitialized. Consider declaring the property as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Word.cs(321,23): error CS8618: Non-nullable property 'MergedBy' is uninitialized. Consider declaring the property as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Word.cs(322,23): error CS8618: Non-nullable property 'Time' is uninitialized. Consider declaring the property as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Startup.cs(38,27): error CS8618: Non-nullable property 'ConnectionString' is uninitialized. Consider declaring the property as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Startup.cs(39,27): error CS8618: Non-nullable property 'CombineDatabase' is uninitialized. Consider declaring the property as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Startup.cs(40,27): error CS8618: Non-nullable property 'SmtpServer' is uninitialized. Consider declaring the property as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Startup.cs(42,27): error CS8618: Non-nullable property 'SmtpUsername' is uninitialized. Consider declaring the property as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Startup.cs(43,27): error CS8618: Non-nullable property 'SmtpPassword' is uninitialized. Consider declaring the property as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Startup.cs(44,27): error CS8618: Non-nullable property 'SmtpAddress' is uninitialized. Consider declaring the property as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Startup.cs(45,27): error CS8618: Non-nullable property 'SmtpFrom' is uninitialized. Consider declaring the property as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Word.cs(308,26): error CS8618: Non-nullable property 'File' is uninitialized. Consider declaring the property as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Word.cs(309,23): error CS8618: Non-nullable property 'Name' is uninitialized. Consider declaring the property as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Word.cs(310,23): error CS8618: Non-nullable property 'FilePath' is uninitialized. Consider declaring the property as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Project.cs(212,16): error CS8618: Non-nullable property 'Id' is uninitialized. Consider declaring the property as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Project.cs(212,16): error CS8618: Non-nullable property 'Email' is uninitialized. Consider declaring the property as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Project.cs(212,16): error CS8618: Non-nullable property 'Token' is uninitialized. Consider declaring the property as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Project.cs(266,24): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Project.cs(267,25): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Project.cs(268,24): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Project.cs(199,24): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Project.cs(200,24): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Project.cs(241,22): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Project.cs(242,25): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Project.cs(243,25): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Project.cs(192,23): error CS8618: Non-nullable property 'Name' is uninitialized. Consider declaring the property as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Project.cs(193,23): error CS8618: Non-nullable property 'Type' is uninitialized. Consider declaring the property as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Project.cs(313,16): error CS8618: Non-nullable field 'UpdatedUser' is uninitialized. Consider declaring the field as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Word.cs(276,24): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Word.cs(277,22): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Word.cs(278,31): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Project.cs(315,16): error CS8618: Non-nullable field 'UpdatedUser' is uninitialized. Consider declaring the field as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\User.cs(87,22): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\User.cs(88,26): error CS8602: Dereference of a possibly null reference. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\User.cs(90,24): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\User.cs(91,25): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\User.cs(92,25): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\User.cs(93,40): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\User.cs(95,28): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\User.cs(96,28): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\User.cs(97,26): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\User.cs(98,25): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\User.cs(105,42): error CS8604: Possible null reference argument for parameter 'key' in 'void Dictionary<string, string>.Add(string key, string value)'. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\User.cs(105,68): error CS8604: Possible null reference argument for parameter 'value' in 'void Dictionary<string, string>.Add(string key, string value)'. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\User.cs(110,40): error CS8604: Possible null reference argument for parameter 'key' in 'void Dictionary<string, string>.Add(string key, string value)'. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\User.cs(110,66): error CS8604: Possible null reference argument for parameter 'value' in 'void Dictionary<string, string>.Add(string key, string value)'. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Project.cs(79,22): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Project.cs(80,24): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Project.cs(103,43): error CS8604: Possible null reference argument for parameter 'item' in 'void List<string>.Add(string item)'. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Project.cs(107,46): error CS8604: Possible null reference argument for parameter 'item' in 'void List<string>.Add(string item)'. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Project.cs(115,38): error CS8604: Possible null reference argument for parameter 'item' in 'void List<string>.Add(string item)'. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Project.cs(119,41): error CS8604: Possible null reference argument for parameter 'item' in 'void List<string>.Add(string item)'. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Startup.cs(140,48): error CS8625: Cannot convert null literal to non-nullable reference type. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Startup.cs(144,50): error CS8625: Cannot convert null literal to non-nullable reference type. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Startup.cs(146,50): error CS8625: Cannot convert null literal to non-nullable reference type. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Startup.cs(148,49): error CS8625: Cannot convert null literal to non-nullable reference type. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Startup.cs(150,46): error CS8625: Cannot convert null literal to non-nullable reference type. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\User.cs(120,17): error CS8602: Dereference of a possibly null reference. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\User.cs(173,23): error CS8618: Non-nullable property 'Username' is uninitialized. Consider declaring the property as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\User.cs(174,23): error CS8618: Non-nullable property 'Password' is uninitialized. Consider declaring the property as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\User.cs(182,16): error CS8618: Non-nullable field 'UpdatedUser' is uninitialized. Consider declaring the field as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Controllers\UserController.cs(256,27): error CS8618: Non-nullable field 'EmailOrUsername' is uninitialized. Consider declaring the field as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Controllers\UserController.cs(257,27): error CS8618: Non-nullable field 'Token' is uninitialized. Consider declaring the field as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Controllers\UserController.cs(258,27): error CS8618: Non-nullable field 'NewPassword' is uninitialized. Consider declaring the field as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Controllers\UserController.cs(259,27): error CS8618: Non-nullable field 'Domain' is uninitialized. Consider declaring the field as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\UserEdit.cs(33,22): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\UserEdit.cs(34,29): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\UserEdit.cs(125,36): error CS8604: Possible null reference argument for parameter 'item' in 'void List<string>.Add(string item)'. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\UserRole.cs(34,22): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\UserRole.cs(35,29): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Controllers\LiftController.cs(86,47): error CS8604: Possible null reference argument for parameter 'path1' in 'string Path.Combine(string path1, string path2)'. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Controllers\LiftController.cs(92,43): error CS8604: Possible null reference argument for parameter 'path1' in 'string Path.Combine(string path1, string path2)'. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Word.cs(245,28): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Word.cs(246,23): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Word.cs(238,23): error CS8618: Non-nullable property 'Language' is uninitialized. Consider declaring the property as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Word.cs(239,23): error CS8618: Non-nullable property 'Def' is uninitialized. Consider declaring the property as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Word.cs(84,22): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Word.cs(86,30): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Word.cs(87,26): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Word.cs(88,27): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Word.cs(89,28): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Word.cs(90,32): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Word.cs(91,30): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Word.cs(92,29): error CS8601: Possible null reference assignment. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Word.cs(102,33): error CS8604: Possible null reference argument for parameter 'item' in 'void List<string>.Add(string item)'. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Word.cs(106,36): error CS8604: Possible null reference argument for parameter 'item' in 'void List<string>.Add(string item)'. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Word.cs(110,35): error CS8604: Possible null reference argument for parameter 'item' in 'void List<string>.Add(string item)'. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Word.cs(179,28): error CS8618: Non-nullable property 'Glosses' is uninitialized. Consider declaring the property as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Models\Word.cs(182,37): error CS8618: Non-nullable property 'SemanticDomains' is uninitialized. Consider declaring the property as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Controllers\ProjectController.cs(369,27): error CS8618: Non-nullable field 'EmailAddress' is uninitialized. Consider declaring the field as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Controllers\ProjectController.cs(370,27): error CS8618: Non-nullable field 'Message' is uninitialized. Consider declaring the field as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Controllers\ProjectController.cs(371,27): error CS8618: Non-nullable field 'ProjectId' is uninitialized. Consider declaring the field as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Controllers\ProjectController.cs(372,27): error CS8618: Non-nullable field 'Domain' is uninitialized. Consider declaring the field as nullable. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Services\UserApiServices.cs(117,24): error CS8603: Possible null reference return. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Services\UserApiServices.cs(124,20): error CS8603: Possible null reference return. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Services\WordApiServices.cs(87,24): error CS8603: Possible null reference return. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Services\PermissionService.cs(105,20): error CS8603: Possible null reference return. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Services\UserApiServices.cs(132,47): error CS8604: Possible null reference argument for parameter 's' in 'byte[] Encoding.GetBytes(string s)'. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Services\UserApiServices.cs(168,24): error CS8603: Possible null reference return. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Services\LiftApiServices.cs(193,65): error CS8604: Possible null reference argument for parameter 'path2' in 'string Path.Combine(string path1, string path2, string path3)'. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Services\LiftApiServices.cs(216,54): error CS8604: Possible null reference argument for parameter 'stream' in 'StreamReader.StreamReader(Stream stream, Encoding encoding)'. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Services\UserApiServices.cs(210,20): error CS8603: Possible null reference return. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Services\UserApiServices.cs(249,24): error CS8603: Possible null reference return. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Services\UserApiServices.cs(274,29): error CS8625: Cannot convert null literal to non-nullable reference type. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Services\UserApiServices.cs(275,26): error CS8625: Cannot convert null literal to non-nullable reference type. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
Services\LiftApiServices.cs(364,20): error CS8603: Possible null reference return. [C:\Users\User\GitHub\TheCombine\Backend\BackendFramework.csproj]
@johnthagen johnthagen added backend refactor maintenance Issue that makes it difficult to maintain the software or to upgrade installations post-release. labels Oct 9, 2020
@johnthagen
Copy link
Collaborator Author

This would likely allow for a larger refactor where we don't represent "blank" string attributes on Models as "", but use ? to allow the type system (in both the backend and the frontend) to track empty/missing attributes.

@johnthagen johnthagen self-assigned this Oct 23, 2020
@johnthagen
Copy link
Collaborator Author

One of the challenges is dealing with all of the Clone() implementations in the Models.

        public EmailInvite Clone()
        {
            return new EmailInvite
            {
                Id = Id.Clone() as string,
                Email = Email.Clone() as string,
                Token = Token.Clone() as string,
                ExpireTime = ExpireTime
            };
        }

All of the as casts can return null. It would be nice if we could find a better way to Clone() these objects. strings are immutable in C#, so I'm not exactly sure why we need to Clone() in the first place, but there could be some interaction with Mongo I don't understand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend maintenance Issue that makes it difficult to maintain the software or to upgrade installations post-release. refactor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant