Skip to content

Commit 6c9a743

Browse files
[release/8.0] [browser] Add link to docs to interop error messages (#92182)
* JS part * C# part --------- Co-authored-by: Marek Fišera <mara@neptuo.com>
1 parent ae998eb commit 6c9a743

File tree

4 files changed

+48
-47
lines changed

4 files changed

+48
-47
lines changed

src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Resources/Strings.resx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -136,29 +136,29 @@
136136
<value>Specified type is not supported by source-generated JavaScript interop.</value>
137137
</data>
138138
<data name="TypeNotSupportedMessageReturnWithDetails" xml:space="preserve">
139-
<value>{0} The generated source will not handle marshalling of the return value of method '{1}'.</value>
139+
<value>{0} The generated source will not handle marshalling of the return value of method '{1}'. For more information see https://aka.ms/dotnet-wasm-jsinterop</value>
140140
<comment>{0} is a message containing additional details about what is not supported
141141
{1} is the name of the method</comment>
142142
</data>
143143
<data name="TypeNotSupportedDescription" xml:space="preserve">
144144
<value>Type is not supported by source-generated JavaScript interop.</value>
145145
</data>
146146
<data name="TypeNotSupportedMessageParameter" xml:space="preserve">
147-
<value>The type '{0}' is not supported by source-generated JavaScript interop. The generated source will not handle marshalling of parameter '{1}'.</value>
147+
<value>The type '{0}' is not supported by source-generated JavaScript interop. The generated source will not handle marshalling of parameter '{1}'. For more information see https://aka.ms/dotnet-wasm-jsinterop</value>
148148
</data>
149149
<data name="TypeNotSupportedMessageReturn" xml:space="preserve">
150-
<value>The type '{0}' is not supported by source-generated JavaScript interop. The generated source will not handle marshalling of the return value of method '{1}'.</value>
150+
<value>The type '{0}' is not supported by source-generated JavaScript interop. The generated source will not handle marshalling of the return value of method '{1}'. For more information see https://aka.ms/dotnet-wasm-jsinterop</value>
151151
</data>
152152
<data name="TypeNotSupportedMessageParameterWithDetails" xml:space="preserve">
153-
<value>{0} The generated source will not handle marshalling of parameter '{1}'.</value>
153+
<value>{0} The generated source will not handle marshalling of parameter '{1}'. For more information see https://aka.ms/dotnet-wasm-jsinterop</value>
154154
<comment>{0} is a message containing additional details about what is not supported
155155
{1} is the name of the parameter</comment>
156156
</data>
157157
<data name="ConfigurationNotSupportedMessageReturn" xml:space="preserve">
158-
<value>The specified '{0}' configuration for the return value of method '{1}' is not supported by source-generated JavaScript interop.</value>
158+
<value>The specified '{0}' configuration for the return value of method '{1}' is not supported by source-generated JavaScript interop. For more information see https://aka.ms/dotnet-wasm-jsinterop</value>
159159
</data>
160160
<data name="ConfigurationNotSupportedMessageParameter" xml:space="preserve">
161-
<value>The specified '{0}' configuration for parameter '{1}' is not supported by source-generated JavaScript interop.</value>
161+
<value>The specified '{0}' configuration for parameter '{1}' is not supported by source-generated JavaScript interop. For more information see https://aka.ms/dotnet-wasm-jsinterop</value>
162162
</data>
163163
<data name="InvalidJSImportAttributeUsageTitle" xml:space="preserve">
164164
<value>Invalid 'JSImportAttribute' usage</value>
@@ -167,10 +167,10 @@
167167
<value>Invalid 'JSExportAttribute' usage</value>
168168
</data>
169169
<data name="InvalidJSImportAttributedMethodSignatureMessage" xml:space="preserve">
170-
<value>Method '{0}' should be 'static', 'partial', and non-generic when marked with 'JSImportAttribute'. JavaScript interop source generation will ignore method '{0}'.</value>
170+
<value>Method '{0}' should be 'static', 'partial', and non-generic when marked with 'JSImportAttribute'. JavaScript interop source generation will ignore method '{0}'. For more information see https://aka.ms/dotnet-wasm-jsinterop</value>
171171
</data>
172172
<data name="InvalidJSExportAttributedMethodSignatureMessage" xml:space="preserve">
173-
<value>Method '{0}' should be 'static', non-partial and non-generic when marked with 'JSExportAttribute'. JavaScript interop source generation will ignore method '{0}'.</value>
173+
<value>Method '{0}' should be 'static', non-partial and non-generic when marked with 'JSExportAttribute'. JavaScript interop source generation will ignore method '{0}'. For more information see https://aka.ms/dotnet-wasm-jsinterop</value>
174174
</data>
175175
<data name="InvalidJSImportAttributedMethodDescription" xml:space="preserve">
176176
<value>Methods marked with 'JSImportAttribute' should be 'static', 'partial', and non-generic. JavaScript interop source generation will ignore methods that are non-'static', non-'partial', or generic.</value>
@@ -179,7 +179,7 @@
179179
<value>Methods marked with 'JSImportAttribute' should be 'static', non-partial, and non-generic. JavaScript interop source generation will ignore methods that are non-'static', 'partial', or generic.</value>
180180
</data>
181181
<data name="InvalidAttributedMethodContainingTypeMissingModifiersMessage" xml:space="preserve">
182-
<value>Method '{0}' is contained in a type '{1}' that is not marked 'partial'. JavaScript interop source generation will ignore method '{0}'.</value>
182+
<value>Method '{0}' is contained in a type '{1}' that is not marked 'partial'. JavaScript interop source generation will ignore method '{0}'. For more information see https://aka.ms/dotnet-wasm-jsinterop</value>
183183
</data>
184184
<data name="DiscardOnlyVoid" xml:space="preserve">
185185
<value>'JSType.Discard' could be only used with void return argument.</value>
@@ -212,18 +212,18 @@
212212
<value>JSImportAttribute requires unsafe code. Project must be updated with '&lt;AllowUnsafeBlocks&gt;true&lt;/AllowUnsafeBlocks&gt;'.</value>
213213
</data>
214214
<data name="JSImportRequiresAllowUnsafeBlocksMessage" xml:space="preserve">
215-
<value>JSImportAttribute requires unsafe code. Project must be updated with '&lt;AllowUnsafeBlocks&gt;true&lt;/AllowUnsafeBlocks&gt;'.</value>
215+
<value>JSImportAttribute requires unsafe code. Project must be updated with '&lt;AllowUnsafeBlocks&gt;true&lt;/AllowUnsafeBlocks&gt;'. For more information see https://aka.ms/dotnet-wasm-jsinterop</value>
216216
</data>
217217
<data name="JSImportRequiresAllowUnsafeBlocksTitle" xml:space="preserve">
218-
<value>JSImportAttribute requires unsafe code.</value>
218+
<value>JSImportAttribute requires unsafe code. For more information see https://aka.ms/dotnet-wasm-jsinterop</value>
219219
</data>
220220
<data name="JSExportRequiresAllowUnsafeBlocksDescription" xml:space="preserve">
221221
<value>JSExportAttribute requires unsafe code. Project must be updated with '&lt;AllowUnsafeBlocks&gt;true&lt;/AllowUnsafeBlocks&gt;'.</value>
222222
</data>
223223
<data name="JSExportRequiresAllowUnsafeBlocksMessage" xml:space="preserve">
224-
<value>JSExportAttribute requires unsafe code. Project must be updated with '&lt;AllowUnsafeBlocks&gt;true&lt;/AllowUnsafeBlocks&gt;'.</value>
224+
<value>JSExportAttribute requires unsafe code. Project must be updated with '&lt;AllowUnsafeBlocks&gt;true&lt;/AllowUnsafeBlocks&gt;'. For more information see https://aka.ms/dotnet-wasm-jsinterop</value>
225225
</data>
226226
<data name="JSExportRequiresAllowUnsafeBlocksTitle" xml:space="preserve">
227-
<value>JSExportAttribute requires unsafe code.</value>
227+
<value>JSExportAttribute requires unsafe code. For more information see https://aka.ms/dotnet-wasm-jsinterop</value>
228228
</data>
229229
</root>

src/libraries/System.Runtime.InteropServices.JavaScript/tests/JSImportGenerator.UnitTest/Fails.cs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,39 +15,39 @@ public class Fails
1515
public static IEnumerable<object?[]> CodeSnippetsToFail()
1616
{
1717
yield return new object?[] { CodeSnippets.DefaultReturnMarshaler<long>(), new string[] {
18-
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of long. The generated source will not handle marshalling of the return value of method 'Import1'.",
19-
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of long. The generated source will not handle marshalling of the return value of method 'Export1'.",
18+
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of long. The generated source will not handle marshalling of the return value of method 'Import1'. For more information see https://aka.ms/dotnet-wasm-jsinterop",
19+
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of long. The generated source will not handle marshalling of the return value of method 'Export1'. For more information see https://aka.ms/dotnet-wasm-jsinterop",
2020
},null };
2121
yield return new object?[] { CodeSnippets.DefaultReturnMarshaler<object>(), null, null };
2222
yield return new object?[] { CodeSnippets.DefaultReturnMarshaler("System.Func<string>"), null, null };
2323
yield return new object?[] { CodeSnippets.DefaultReturnMarshaler("System.Action"), new string[] {
24-
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.Action. The generated source will not handle marshalling of the return value of method 'Import1'.",
25-
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.Action. The generated source will not handle marshalling of the return value of method 'Export1'.",
24+
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.Action. The generated source will not handle marshalling of the return value of method 'Import1'. For more information see https://aka.ms/dotnet-wasm-jsinterop",
25+
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.Action. The generated source will not handle marshalling of the return value of method 'Export1'. For more information see https://aka.ms/dotnet-wasm-jsinterop",
2626
},null };
2727
yield return new object?[] { CodeSnippets.DefaultReturnMarshaler("System.Span<byte>"), null, null };
2828
yield return new object?[] { CodeSnippets.DefaultReturnMarshaler("System.Span<long>"), null, null };
2929
yield return new object?[] { CodeSnippets.DefaultReturnMarshaler("System.ArraySegment<byte>"), null, null };
3030
yield return new object?[] { CodeSnippets.AllMissing, new string[] {
31-
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of object. The generated source will not handle marshalling of parameter 'a1'.",
32-
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of long. The generated source will not handle marshalling of parameter 'a2'.",
33-
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of long. The generated source will not handle marshalling of parameter 'a3'.",
34-
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.Action. The generated source will not handle marshalling of parameter 'a4'.",
35-
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.Func<int>. The generated source will not handle marshalling of parameter 'a5'.",
36-
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.Span<byte>. The generated source will not handle marshalling of parameter 'a6'.",
37-
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.ArraySegment<byte>. The generated source will not handle marshalling of parameter 'a7'.",
38-
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.Threading.Tasks.Task<object>. The generated source will not handle marshalling of parameter 'a8'.",
39-
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of object[]. The generated source will not handle marshalling of parameter 'a9'.",
40-
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.DateTime. The generated source will not handle marshalling of parameter 'a10'.",
41-
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.DateTimeOffset. The generated source will not handle marshalling of parameter 'a11'.",
42-
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.Threading.Tasks.Task<global::System.DateTime>. The generated source will not handle marshalling of parameter 'a12'.",
43-
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.Threading.Tasks.Task<global::System.DateTimeOffset>. The generated source will not handle marshalling of parameter 'a13'.",
44-
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.Threading.Tasks.Task<long>. The generated source will not handle marshalling of parameter 'a14'.",
45-
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.Threading.Tasks.Task<long>. The generated source will not handle marshalling of parameter 'a15'.",
31+
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of object. The generated source will not handle marshalling of parameter 'a1'. For more information see https://aka.ms/dotnet-wasm-jsinterop",
32+
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of long. The generated source will not handle marshalling of parameter 'a2'. For more information see https://aka.ms/dotnet-wasm-jsinterop",
33+
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of long. The generated source will not handle marshalling of parameter 'a3'. For more information see https://aka.ms/dotnet-wasm-jsinterop",
34+
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.Action. The generated source will not handle marshalling of parameter 'a4'. For more information see https://aka.ms/dotnet-wasm-jsinterop",
35+
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.Func<int>. The generated source will not handle marshalling of parameter 'a5'. For more information see https://aka.ms/dotnet-wasm-jsinterop",
36+
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.Span<byte>. The generated source will not handle marshalling of parameter 'a6'. For more information see https://aka.ms/dotnet-wasm-jsinterop",
37+
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.ArraySegment<byte>. The generated source will not handle marshalling of parameter 'a7'. For more information see https://aka.ms/dotnet-wasm-jsinterop",
38+
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.Threading.Tasks.Task<object>. The generated source will not handle marshalling of parameter 'a8'. For more information see https://aka.ms/dotnet-wasm-jsinterop",
39+
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of object[]. The generated source will not handle marshalling of parameter 'a9'. For more information see https://aka.ms/dotnet-wasm-jsinterop",
40+
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.DateTime. The generated source will not handle marshalling of parameter 'a10'. For more information see https://aka.ms/dotnet-wasm-jsinterop",
41+
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.DateTimeOffset. The generated source will not handle marshalling of parameter 'a11'. For more information see https://aka.ms/dotnet-wasm-jsinterop",
42+
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.Threading.Tasks.Task<global::System.DateTime>. The generated source will not handle marshalling of parameter 'a12'. For more information see https://aka.ms/dotnet-wasm-jsinterop",
43+
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.Threading.Tasks.Task<global::System.DateTimeOffset>. The generated source will not handle marshalling of parameter 'a13'. For more information see https://aka.ms/dotnet-wasm-jsinterop",
44+
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.Threading.Tasks.Task<long>. The generated source will not handle marshalling of parameter 'a14'. For more information see https://aka.ms/dotnet-wasm-jsinterop",
45+
"Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.Threading.Tasks.Task<long>. The generated source will not handle marshalling of parameter 'a15'. For more information see https://aka.ms/dotnet-wasm-jsinterop",
4646
},null };
4747
yield return new object?[] { CodeSnippets.InOutRef, new string[] {
48-
"Parameters with 'in', 'out' and 'ref' modifiers are not supported by source-generated JavaScript interop. The generated source will not handle marshalling of parameter 'a1'.",
49-
"Parameters with 'in', 'out' and 'ref' modifiers are not supported by source-generated JavaScript interop. The generated source will not handle marshalling of parameter 'a2'.",
50-
"Parameters with 'in', 'out' and 'ref' modifiers are not supported by source-generated JavaScript interop. The generated source will not handle marshalling of parameter 'a3'.",
48+
"Parameters with 'in', 'out' and 'ref' modifiers are not supported by source-generated JavaScript interop. The generated source will not handle marshalling of parameter 'a1'. For more information see https://aka.ms/dotnet-wasm-jsinterop",
49+
"Parameters with 'in', 'out' and 'ref' modifiers are not supported by source-generated JavaScript interop. The generated source will not handle marshalling of parameter 'a2'. For more information see https://aka.ms/dotnet-wasm-jsinterop",
50+
"Parameters with 'in', 'out' and 'ref' modifiers are not supported by source-generated JavaScript interop. The generated source will not handle marshalling of parameter 'a3'. For more information see https://aka.ms/dotnet-wasm-jsinterop",
5151
}, null };
5252
}
5353

0 commit comments

Comments
 (0)