WebSharper 4.2.14
This is a bugfix release for WebSharper 4.2.
Templates for .NET Core SDK: dotnet new -i WebSharper.Templates::4.2.14.240
Templates for Visual Studio 2017: http://websharper.com/installers/WebSharper.4.2.14.240.vsix
Fixes
- #951 Virtual methods do not cause compiler to fail with a duplicate key error if the class also has a static constructor. Also abstract/virtual methods have better name resolution logic, if a subclass defines a member with a fixed name (with the
Name
attribute), and the abstract/virtual method does not have a fixed name, it will be resolved to avoid naming conflicts in JavaScript translation automatically. - #959 A specific error is given if a method marked with the
SPAEntryPoint
attribute is non-static or has arguments. - #961 C# proxy types do not incorrectly warn that they should not be public when they are not public. Also, proxy method resolution has been improved, the member signature can use the proxy type as equivalent to the target type, making casts unnecessary.
Example
This is now a working minimal proxy for StringBuilder
:
[Proxy(typeof(StringBuilder))]
internal class StringBuilderProxy
{
private List<string> b = new List<string>();
public StringBuilderProxy Append(string s)
{
b.Add(s);
return this;
}
public override string ToString()
{
var s = String.Concat(b);
b.Clear();
b.Add(s);
return s;
}
}
Previously the Append
method would have needed to return StringBuilder
, using an unsafe JavaScript cast (WebSharper.JavaScript.Pervasives.As<StringBuilder>
) on the return value.