Skip to content

Commit

Permalink
Merge pull request #19436 from unoplatform/dev/jela/ios-hr-workaround
Browse files Browse the repository at this point in the history
fix(hr): Add dummy class at the end of the generated file
  • Loading branch information
jeromelaban authored Feb 4, 2025
2 parents 6ad9bc1 + 96a9879 commit 61d6e4b
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,26 @@ private SourceText InnerGenerateFile()
BuildXBindTryGetDeclarations(writer);
}
}

if (_isHotReloadEnabled && Generation.IOSViewSymbol.Value is not null)
{
// Workaround for HR behaving incorrectly on iOS
// https://github.com/xamarin/xamarin-macios/issues/22102

using (writer.BlockInvariant($"namespace __internal"))
{
writer.AppendLineIndented("/// <remarks>Internal Use for iOS only.</remarks>");
writer.AppendLineIndented("[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]");
writer.AppendLineIndented("[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]");
using (writer.BlockInvariant($"static partial class __{_xClassName.ClassName}_Dummy"))
{
using (writer.BlockInvariant("private static class Dummy_Bindings"))
{
writer.AppendLineIndented("private static object Owner { get; set; }");
}
}
}
}
}
}

Expand Down

0 comments on commit 61d6e4b

Please sign in to comment.