Errors BC30652 and BC30456 System.Text.Encodings.Web and System.Text.Unicode

I’m running into the errors BC30652 and BC30456. I have only one Invoke Code Activity in the workflow. Please note the code works fine. It runs only into the errors if I add the line
.Encoder = System.Text.Encodings.Web.JavaScriptEncoder.Create(System.Text.Unicode.UnicodeRanges.All)

Here is the source code where I want to transform the dictionary to a JSON file:

 Dim dict As New Dictionary(Of String, String) From { { "VV",
 "Payment
Amount:	1,25 €" }, 
 { "VV_1", 
 "Payment
Amount:	2,11 €" } }
 
Dim options As New System.Text.Json.JsonSerializerOptions With {
        .WriteIndented = True,
		.Encoder =  System.Text.Encodings.Web.JavaScriptEncoder.Create(System.Text.Unicode.UnicodeRanges.All)
    }
    Dim json As String = System.Text.Json.JsonSerializer.Serialize(dict, options)
	
    File.WriteAllText("dictionary.json", json)
    Console.WriteLine("Dictionary has been written to dictionary.json file.")

How do I have to import and reference the assemblies to run the source code?

Hi,

Unfortunately, it seems Studio cannot optimize references to assembly inside InvokeCode.
As workaround, can you try to add Assign activity which has the following expression just before InvokeCode?

o = System.Text.Encodings.Web.JavaScriptEncoder.Create()

Probably, it works without adding other packages.

Regards,

Hello Yoichi,
it works fine now with the Assign Activity. Thank you!
(教えてくださってありがとうございます。)
Kind regards,
Alexander

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.