Already using item flagged as deprecated?

Copied some older code from another app into a new project. Analyzing I get a bunch of strange deprecation warnings. Anyone know what I am missing?

SharedModule.JSONSave, line 3
FolderItem is deprecated. You should use FolderItem instead
Var f As FolderItem = SpecialFolder.Documents.Child(“units.json”)

SharedModule.JSONSave, line 3
SpecialFolder is deprecated. You should use SpecialFolder instead
Var f As FolderItem = SpecialFolder.Documents.Child(“units.json”)

SharedModule.JSONSave, line 3
SpecialFolder is deprecated. You should use SpecialFolder instead
Var f As FolderItem = SpecialFolder.Documents.Child(“units.json”)

SharedModule.JSONSave, line 5
Dictionary is deprecated. You should use Dictionary instead
Var alldata() As Dictionary

SharedModule.JSONSave, line 7
Dictionary is deprecated. You should use Dictionary instead
Var attr As New Dictionary

SharedModule.JSONSave, line 23
Dictionary is deprecated. You should use Dictionary instead
Var ships() As Dictionary

SharedModule.JSONSave, line 25
Dictionary is deprecated. You should use Dictionary instead
Var sh As New Dictionary

SharedModule.JSONSave, line 50
Dictionary is deprecated. You should use Dictionary instead
Var unitdata As New Dictionary

SharedModule.JSONSave, line 59
GenerateJSON is deprecated. You should use GenerateJSON instead
json = GenerateJSON(alldata)

SharedModule.JSONSave, line 62
TextOutputStream is deprecated. You should use TextOutputStream instead
Dim t As TextOutputStream =TextOutputStream.Create(f, TextEncoding.UTF8)

SharedModule.JSONSave, line 62
TextOutputStream is deprecated. You should use TextOutputStream instead
Dim t As TextOutputStream =TextOutputStream.Create(f, TextEncoding.UTF8)

SharedModule.JSONSave, line 62
TextOutputStream is deprecated. You should use TextOutputStream instead
Dim t As TextOutputStream =TextOutputStream.Create(f, TextEncoding.UTF8)

All of these depreciations come from using the namespaced versions of those classes. So for instance in your JSONSave method, I suspect that you are using a Xojo.IO.Folderitem.

1 Like

Thanks, Greg. That seems to be the case. If I change:

Dim t As TextOutputStream =TextOutputStream.Create(f, TextEncoding.UTF8)

to:

Dim t As TextOutputStream =TextOutputStream.Create(f)

I get a Not Enough Arguments error.

The thing is that I don’t have a “Using” statement anywhere in my app so I don’t know how to fix this. Why would it think I’m using Xojo.IO?

Try to set “Simple References” in the Inspector of “Shared Build Settings” .

To supplement Martin’s suggestion, the setting only appears in 2020r2 for projects created before 2020r2. Change the switch to off.

1 Like

That did it. Thanks everyone!