Linha 76: |
Linha 76: |
| | | |
| ===This implicitly converts...=== | | ===This implicitly converts...=== |
− | 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.''"
| + | Exemplo do alerta: "''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 [[Modding:Modder Guide/Game Fundamentals#Net fields|net field]], which can cause subtle bugs. This field has an equivalent non-net property, like <samp>monster.Health</samp> (<samp>int</samp>) instead of <samp>monster.health</samp> (<samp>NetBool</samp>). Change your code to use the suggested property instead.
| + | Seu código está referenciando um [[Modding:Modder Guide/Game Fundamentals#Net fields|net field]], na qual pode causar alguns bugs sutis. Esse campo tem uma propriedade não-net equivalente, Como <samp>monster.Health</samp> (<samp>int</samp>) Ao invés de <samp>monster.health</samp> (<samp>NetBool</samp>). Altere seu código para usar a propriedade sugerida ao invés disso. |
| | | |
| ===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.''"
| + | Exemplo do alerta: "'''{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 [[Modding:Modder Guide/Game Fundamentals#Net fields|net field]], which can cause subtle bugs. You should access the underlying value instead:
| + | Seu código está referenciando um [[Modding:Modder Guide/Game Fundamentals#Net fields|net field]], na qual pode causar alguns bugs sutis. Você deveria acessar o valor base ao invés. |
| <ul> | | <ul> |
− | <li>For a reference type (''i.e.,'' one that can contain <samp>null</samp>), you can use the <samp>.Value</samp> property (or <samp>.FieldDict</samp> for a <samp>NetDictionary</samp>): | + | <li>Para um tipo de referencia (''ex.,'' aquele que pode conter <samp>null</samp>), você pode usar a propriedade <samp>.Value</samp> (ou <samp>.FieldDict</samp> para um <samp>NetDictionary</samp>): |
| <syntaxhighlight lang="c#"> | | <syntaxhighlight lang="c#"> |
| if (building.indoors.Value == null) | | if (building.indoors.Value == null) |
| </syntaxhighlight> | | </syntaxhighlight> |
| | | |
− | Or convert the value before comparison:
| + | Ou converta o valor antes da comparação: |
| <syntaxhighlight lang="c#"> | | <syntaxhighlight lang="c#"> |
| GameLocation indoors = building.indoors.Value; | | GameLocation indoors = building.indoors.Value; |
Linha 96: |
Linha 96: |
| // ... | | // ... |
| </syntaxhighlight></li> | | </syntaxhighlight></li> |
− | <li>For a value type (''i.e.,'' one that can't contain <samp>null</samp>), check if the parent is null (if needed) and compare with <samp>.Value</samp>: | + | <li>Para um tipo value (''i.e.,'' aquele que não pode conter <samp>null</samp>), verifique se o pai é nulo (se necessário) e compare com <samp>.Value</samp>: |
| <syntaxhighlight lang="c#"> | | <syntaxhighlight lang="c#"> |
| if (item != null && item.category.Value == 0) | | if (item != null && item.category.Value == 0) |
Linha 103: |
Linha 103: |
| | | |
| ===The FieldName field is obsolete...=== | | ===The FieldName field is obsolete...=== |
− | Sample warning: "''The 'Character.friendships' field is obsolete and should be replaced with 'friendshipData'. See https://smapi.io/buildmsg/avoid-obsolete-field for details.''"
| + | Exemplo de alerta: "''The 'Character.friendships' field is obsolete and should be replaced with 'friendshipData'. See https://smapi.io/buildmsg/avoid-obsolete-field for details.''" |
| | | |
− | You're referencing a field which should no longer be used. Use the suggested field name instead to fix it.
| + | Você está referenciando um campo que não deverá mais ser usado. Use o nome do campo sugerido ao invés para conserta-lo. |
| | | |
| ===An instance of analyzer ... cannot be created=== | | ===An instance of analyzer ... cannot be created=== |
| Update to the latest [https://visualstudio.microsoft.com/vs/community/ Visual Studio]; the NuGet package uses a recent feature that isn't available in older versions. | | Update to the latest [https://visualstudio.microsoft.com/vs/community/ Visual Studio]; the NuGet package uses a recent feature that isn't available in older versions. |
| + | Atualize para o último [https://visualstudio.microsoft.com/vs/community/ Visual Studio]; o pacote NuGet usa um recurso recente que não está disponível em versões antigas. |
| | | |
| ==Outras problemas== | | ==Outras problemas== |