大网数据广告活动
网络与域名解析

Examples of Incompatible Changes

· 52CE 我爱测

When dealing with incompatible changes, the unfortunate rule of thumb is as follows any change can be backward incompatible, unless it is very well understood.

When dealing with incompatible changes, the unfortunate rule of thumb is as follows: any change can be backward incompatible, unless it is very well understood. This rule requires knowledge of NDR rules. If you do not know what the NDR is, do not make modifications. Examples of changes that typically result in an access violation in the application, or a BAD_STUB_DATA_EXCEPTION raised by the marshaling engine, are as follows:

  • Adding a new method in the middle of old methods.
  • Adding or removing parameters from a method.
  • Changing an attribute, for example a pointer attribute: changing [ref] to [unique] or [ptr] or vice versa. Each pointer type has a different wire representation.
  • Changing the size of the data: from short to long, from char to wchar_t (unicode), adding a field to a structure, changing the size of a fixed size array.
  • Adding union arms to a union with a default clause.

Some insidious changes or unintended mismatches between a client and a server may occur as follows:

  • Modifying a member of a compound type, like a structure or an array. For example, if a CLIENT_ID changes from an integral to a GUID, a CLIENT_RECORD structure with the CLIENT_ID field becomes incompatible. This may be difficult to detect if cascaded through several levels of embedding to an actual remote parameter type.
  • Modifying an imported type. The type may be coming from a different component that does not remote directly, hence the change was thought to be compatible.
  • Using #ifdef in an IDL file is a bad idea to ifdef type definitions in an IDL file—it is disaster waiting to happen. Inevitably, due to build or other glitches, a client is compiled with a different set of defines than the server, and they end up being incompatible.

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。