When I try to add any kind of Macro (Even if it just includes an empty <Div>) into a RTE, it throws the next error:
Newtonsoft.Json.JsonSerializationException: Error getting value from '***' on 'Umbraco.Web.PublishedModels.***'. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: doc
at Umbraco.Web.Macros.PublishedContentHashtableConverter..ctor(IPublishedContent doc) in D:\a\1\s\src\Umbraco.Web\Macros\PublishedContentHashtableConverter.cs:line 57
at Umbraco.Web.Macros.MacroRenderer.Render(String macroAlias, IPublishedContent content, IDictionary`2 macroParams) in D:\a\1\s\src\Umbraco.Web\Macros\MacroRenderer.cs:line 200
at Umbraco.Web.PropertyEditors.ValueConverters.RteMacroRenderingValueConverter.<>c__DisplayClass4_1.<RenderRteMacros>b__1(String macroAlias, Dictionary`2 macroAttributes) in D:\a\1\s\src\Umbraco.Web\PropertyEditors\ValueConverters\RteMacroRenderingValueConverter.cs:line 57
at Umbraco.Web.Macros.MacroTagParser.ParseMacros(String text, Action`1 textFoundCallback, Action`2 macroFoundCallback) in D:\a\1\s\src\Umbraco.Web\Macros\MacroTagParser.cs:line 196
at Umbraco.Web.PropertyEditors.ValueConverters.RteMacroRenderingValueConverter.RenderRteMacros(String source, Boolean preview) in D:\a\1\s\src\Umbraco.Web\PropertyEditors\ValueConverters\RteMacroRenderingValueConverter.cs:line 63
at Umbraco.Web.PropertyEditors.ValueConverters.RteMacroRenderingValueConverter.Convert(Object source, Boolean preview) in D:\a\1\s\src\Umbraco.Web\PropertyEditors\ValueConverters\RteMacroRenderingValueConverter.cs:line 89
at Umbraco.Web.PropertyEditors.ValueConverters.RteMacroRenderingValueConverter.ConvertIntermediateToObject(IPublishedElement owner, IPublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, Object inter, Boolean preview) in D:\a\1\s\src\Umbraco.Web\PropertyEditors\ValueConverters\RteMacroRenderingValueConverter.cs:line 71
at Umbraco.Core.Models.PublishedContent.PublishedPropertyType.ConvertInterToObject(IPublishedElement owner, PropertyCacheLevel referenceCacheLevel, Object inter, Boolean preview) in D:\a\1\s\src\Umbraco.Core\Models\PublishedContent\PublishedPropertyType.cs:line 219
at Umbraco.Web.PublishedCache.NuCache.Property.GetValue(String culture, String segment) in D:\a\1\s\src\Umbraco.Web\PublishedCache\NuCache\Property.cs:line 211
at Umbraco.Web.PublishedPropertyExtension.Value[T](IPublishedProperty property, String culture, String segment, Fallback fallback, T defaultValue) in D:\a\1\s\src\Umbraco.Web\PublishedPropertyExtension.cs:line 39
at Umbraco.Web.PublishedContentExtensions.Value[T](IPublishedContent content, String alias, String culture, String segment, Fallback fallback, T defaultValue) in D:\a\1\s\src\Umbraco.Web\PublishedContentExtensions.cs:line 163
at Umbraco.Web.PublishedModels.*** in ***\App_Data\Models\all.generated.cs:line 748
at ***
at Newtonsoft.Json.Serialization.DynamicValueProvider.GetValue(Object target) in /_/Src/Newtonsoft.Json/Serialization/DynamicValueProvider.cs:line 110
--- End of inner exception stack trace ---
at Newtonsoft.Json.Serialization.DynamicValueProvider.GetValue(Object target) in /_/Src/Newtonsoft.Json/Serialization/DynamicValueProvider.cs:line 114
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues(JsonWriter writer, Object value, JsonContainerContract contract, JsonProperty member, JsonProperty property, JsonContract& memberContract, Object& memberValue) in /_/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs:line 520
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) in /_/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs:line 469
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType) in /_/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs:line 95
at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType) in /_/Src/Newtonsoft.Json/JsonSerializer.cs:line 1151
at Newtonsoft.Json.JsonConvert.SerializeObjectInternal(Object value, Type type, JsonSerializer jsonSerializer) in /_/Src/Newtonsoft.Json/JsonConvert.cs:line 664
at Newtonsoft.Json.JsonConvert.SerializeObject(Object value, Formatting formatting, JsonSerializerSettings settings) in /_/Src/Newtonsoft.Json/JsonConvert.cs:line 629
Some names and paths are censored.
While debugging my code it shows the next error when trying to serialize IPublishedContent in all.generated.cs:

I don't use Umbraco templates, the client side is separated and retrieves data from Umbraco using HTTP requests to a custom API endpoint that uses UmbracoHelper.
I'm not using MVC.
Has someone faced that issue and knows how to handle that?