Line 4: |
Line 4: |
| | | |
| ==Fix common build warnings== | | ==Fix common build warnings== |
− | Make sure you check your Error List pane in Visual Studio (or equivalent in other IDEs) and fix any warnings. Here are some common ones:
| + | After building your project, you can see build warnings via ''Visual Studio > View > Error List'' or ''MonoDevelop > View > Pads > Errors''. Here are some common ones. |
| | | |
| ===Mismatch between the processor architecture...=== | | ===Mismatch between the processor architecture...=== |
Line 14: |
Line 14: |
| Sample warning: "''This implicitly converts '{0}' from Net{1} to {2}, but Net{1} has unintuitive implicit conversion rules. Consider comparing against the actual value instead to avoid bugs. See https://smapi.io/buildmsg/avoid-implicit-net-field-cast for details.''" | | Sample warning: "''This implicitly converts '{0}' from Net{1} to {2}, but Net{1} has unintuitive implicit conversion rules. Consider comparing against the actual value instead to avoid bugs. See https://smapi.io/buildmsg/avoid-implicit-net-field-cast for details.''" |
| | | |
− | Your code is referencing a [[#Net fields|net field]], which can cause subtle bugs. The field you're referencing has an equivalent non-net property, like <tt>monster.Health</tt> (<tt>int</tt>) instead of <tt>monster.health</tt> (<tt>NetBool</tt>). Change your code to use the suggested property instead. | + | Your code is referencing a [[Modding:Modder Guide/Game Fundamentals#Net fields|net field]], which can cause subtle bugs. This field has an equivalent non-net property, like <tt>monster.Health</tt> (<tt>int</tt>) instead of <tt>monster.health</tt> (<tt>NetBool</tt>). Change your code to use the suggested property instead. |
| | | |
| ===FieldName is a Net* field...=== | | ===FieldName is a Net* field...=== |
| Sample warning: "'''{0}' is a Net{1} field; consider using the {2} property instead. See https://smapi.io/buildmsg/avoid-net-field for details.''" | | Sample warning: "'''{0}' is a Net{1} field; consider using the {2} property instead. See https://smapi.io/buildmsg/avoid-net-field for details.''" |
| | | |
− | Your code is referencing a [[#Net fields|net field]], which can cause subtle bugs. You should access the underlying value instead: | + | Your code is referencing a [[Modding:Modder Guide/Game Fundamentals#Net fields|net field]], which can cause subtle bugs. You should access the underlying value instead: |
| <ul> | | <ul> |
| <li>For a reference type (i.e. one that can contain <tt>null</tt>), you can use the <tt>.Value</tt> property (or <tt>.FieldDict</tt> for a <tt>NetDictionary</tt>): | | <li>For a reference type (i.e. one that can contain <tt>null</tt>), you can use the <tt>.Value</tt> property (or <tt>.FieldDict</tt> for a <tt>NetDictionary</tt>): |