Please error, or at least warn, when a managed type is included in INetworkSerializeByMemcpy
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- csharp
- 领域
- networking
调研方向
首先定位 INetworkSerializeByMemcpy 的定义及其验证或序列化测试。跟踪实现该接口的类型在编译期间或运行时如何受到检查,然后为 string 字段和其他托管字段添加覆盖;当此类类型产生构建错误或警告,而不是进行不安全的 memcpy 序列化时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Is your feature request related to a problem? Please describe.
My coworker was unfamiliar with INetworkSerializeByMemcpy and the FixedStringNNNBytes types, and added a string field to an existing INetworkSerializeByMemcpy struct. This caused me great headaches (it made it into a publicly released patch), trying to track down segfault heap corruption that only showed up in very specific multiplayer circumstances (the string was normally null, which probably masked the issue).
Describe the solution you'd like
Please cause a build error when a managed type (a class, a string, or the like) is included in an INetworkSerializeByMemcpy type. I cannot think of any use case where it would be valid or intended to serialize a managed GC pointer by memcpy. At least a warning if nothing else.
It doesn't have to be perfect, even just checking for string would be lovely - string specifically is such a massive footgun, it's so easy to accidentally include and think it'll work fine. The fact it crashes later on via unrelated segfault heap corruption bringing down the editor, instead of a C# Exception, is especially rough.
- 主要语言
- C#
- 星标
- 2.3k
- 派生
- 461
- 平均合并
- 3 天 16 小时
- 30 天内合并 PR
- 20
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Unity-Technologies/com.unity.netcode.gameobjects 的其他 Issue
-
stat:awaiting-response stat:imported type:bug
难度 4/5 3-5 天 新手友好度 68/100
Unity-Technologies/com.unity.netcode.gameobjects#4159 · 3 条评论 ·
-
stat:reply-needed type:support
难度 4/5 3-5 天 新手友好度 55/100
Unity-Technologies/com.unity.netcode.gameobjects#4095 · 10 条评论 ·
-
stat:awaiting-triage stat:Investigating type:bug
Unity-Technologies/com.unity.netcode.gameobjects#3912 · 5 条评论 · 已指派 1 人 ·
-
Tracking type:feature-2.x
难度 5/5 一周以上 新手友好度 35/100
Unity-Technologies/com.unity.netcode.gameobjects#3870 · 5 条评论 ·
-
stat:awaiting-response stat:imported type:bug
难度 4/5 3-5 天 新手友好度 38/100
Unity-Technologies/com.unity.netcode.gameobjects#3802 · 2 条评论 ·
查看 Unity-Technologies/com.unity.netcode.gameobjects 的全部 Issue
相似的 Issue
-
Status: Waiting triage Type: Bug
难度 2/5 1-3 小时 新手友好度 84/100
nanoframework/Home#1857 ·
-
kind/bug kind/regression
难度 2/5 1-3 小时 新手友好度 78/100
unoplatform/uno.toolkit.ui#1646 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
nightscout/nocturne#1379 ·
-
难度 2/5 1-3 小时 新手友好度 86/100
elastic/esql-dotnet#47 ·
-
难度 1/5 1 小时以内 新手友好度 85/100