dotnet-websharper / core Goto Github PK
View Code? Open in Web Editor NEWWebSharper - Full-stack, functional, reactive web apps and microservices in F# and C#
Home Page: https://websharper.com
License: Apache License 2.0
WebSharper - Full-stack, functional, reactive web apps and microservices in F# and C#
Home Page: https://websharper.com
License: Apache License 2.0
Hi,
Really cool that you made it open source. Made a first attempt to compile it.
I use VS2010, so I only fixed MSBuild Extension Pack and Mono.Cecil.
I used Nuget and added Mono.cecil to 3-4 subprojects.
/mattias
See http://fpish.net/topic/Some/0/74337
See http://fpish.net/topic/Some/0/74359
The solution is to add:
<configuration>
<system.web>
<httpRuntime relaxedUrlToFileSystemMapping="true" />
to Web.config. We should add this in the VS templates.
I've tried running WebSharper on Apache with mod_mono. Most just worked out
of the box, but I have encountered a problem with Sitelets' links.
My sitelet:
Sitelet.Sum [
Sitelet.Content "/" Home HomePage
Sitelet.Content "/About" About AboutPage
]
And I generate such a menu (both in HomePage and AboutPage):
let ( => ) text url =
A [HRef url] -< [Text text]
let Links (ctx: Context<Action>) =
UL [
LI ["Home" => ctx.Link Home]
LI ["About" => ctx.Link About]
]
But both pages have this HTML outputted (only on Apache, IIS version works
just fine):
<ul><li><a href="/">Home</a></li><li><a
href="file:///About">About</a></li></ul
Hello!
I'm attempting to install Websharper on my dev machine. Currently I have installed VS 2010 Shell with latest F#. My OS is Win XP SP3.
I run the installer for Websharper 2.4.35, then choose Install Now (the simple install). It prompts me to open the installer executable again (which seems strange, but ok), then in the Installation Progress window, it gives the error dialog -
"An unexpected error has occurred: Win32Exception. The error report has been written to..."
And here's the text from the error report -
1
2
3
4
5
6
7
System.ComponentModel.Win32Exception: The system cannot find the file specified
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at IntelliFactory.WebSharper.Install.Main.Shell(String executable, String arguments)
at [email protected](Unit unitVar0)
at IntelliFactory.WebSharper.Install.Util.Guard[a](FSharpFunc`2 action)
So I don't know how much that would tell you guys. I suspect the issue is related to using Websharper with VS 2010 Shell, but that could be a red herring.
I also tried downloading a fresh copy of the installer, but the results were the same.
If we can't troubleshoot this successfully, could I download an older version of Websharper in the interim? If so, please let me know where to get a hold of it.
Thanks all!
Bryan Edds
See http://fpish.net/topic/Some/0/74439
Hello,
I downloaded latest version of WebSharper and tried to build it's samples to better understand how it works. Html5 sample works fine, but Basic sample fails to build with the following error:
IntelliFactory\WebSharper\Samples\Basic\WebSharperSiteletsProject\HelloWorld.fs(59,0): error : Failed to translate object creation: IntelliFactory.WebSharper.Web.Control.
If I exclude "HelloWorld.fs" from the project, it builds fine.
Best regards
Vagif Abilov
See http://fpish.net/topic/Some/0/74305
Currently WebSharper installation can proceed without requiring admin rights. I should also be faster.
See attached solution for full source. Error is:
Error 2 Failed to translate a method call: Test(..) [WS.Controls+Base]. c:\users\administrator\documents\visual studio 2010\Projects\Website1\Website1\Website\Controls.fs 21 1 Website
Relevant code is:
[<AbstractClass>]
type Base [<JavaScript>] () =
[<JavaScript>] // This doesn't seem to make a difference, here just in case.
abstract Test : unit -> unit
type Other [<JavaScript>] () =
inherit Base()
[<JavaScript>]
override __.Test() = ignore ()
type Control() =
inherit Web.Control()
[<JavaScript>]
override __.Body =
let c = Other() :> Base
c.Test()
Div [] :> _
Project file contains ToolsVersion="4.5". This toolset is unknown or missing. You may be able to resolve this by installing the appropriate .NET Framework for this t
In addition to the built-in "scripts" variable that expands to WebSharper resource imports, it would be helpful to have a "root" variable that would expand to the ApplicationPath. Such a variable would allow templates to work regardless of the deployment path, in both root and virtual-directory deployments. A common situation is the need to reference a CSS file, which could then be accomplished thus:
#!html
<link href="${root}/themes/site.css" rel="stylesheet" type="text/css" />
When using mobile or offline templates, having invalid XML in the HTML template files does not produce a graceful error message, failing with Null exception instead. This is confusing to the user.
Right now, there isn't a fully automated way to embed "extra" files/artifacts in mobile applications - the tooling only packages the generated scripts and HTML content.
To accommodate this at the moment, one has to do the following:
Do a clean
Create bin/html manually in the F# mobile project
Copy files/folders there
Do a build on the mobile project to get the rest of the files and the final packages.
Now, we would like to eliminate steps 2/3 above. One solution is to modify ws_mobile.exe to copy extra files before it applies the packaging step.
Proposal: add an extra.files to the mobile projects to be processed by ws_mobile.exe to perform this extra copying.
Here is a proposal format for extra.files:
<project-name> {
<file-pattern>*
}
...
where is any project name in the same solution. Example to copy some artifacts from the associated web project called WebProject:
WebProject {
css/*
images/*
}
The use of async in Remote/Rpc methods on the server invokes Async.RunSynchronously which is costly and does not exploit asynchrony as efficiently as it could. The proposal is to make Remoting use an async HTTP handler instead.
Instance method calls with > 2 args and static calls with > 3 args are handled by the same code, but it only worked for instance-based calls.
Fix + updated tests in changeset [[https://bitbucket.org/Mickeysg/websharper/changeset/d7737eb03df5]].
Currently samples have a separate repository:
http://bitbucket.org/IntelliFactory/websharper-samples
Ideally, they should be integrated.
To reproduce: create an HTML sitelets project, install one of the extension installers (say BING), and reference it, then try to compile:
System.InvalidCastException: Unable to cast object of type 'IntelliFactory.WebSharper.Bing.Resources.Bing' to type 'IResource'.
at IntelliFactory.WebSharper.Core.Metadata.activate(Resource resource)
at [email protected](Resource r)
at Microsoft.FSharp.Primitives.Basics.List.map[T,TResult](FSharpFunc`2 mapping, FSharpList`1 x)
at IntelliFactory.WebSharper.Core.Metadata.Info.Create(IEnumerable`1 infos)
at IntelliFactory.WebSharper.Sitelets.Offline.Output.WriteSite[Action](WriteSiteConfiguration`1 conf)
at [email protected](Unit _arg1)
at IntelliFactory.WebSharper.Sitelets.Offline.Main.guard(FSharpFunc`2 action)
Because of incorrect subscription of the WebSharper HTTP module in the IIS pipeline System.Web.HttpContext.Current.Session is null.
Currently the contents get escaped, per HTML standard they should not. Current workaround: use CDATA
The issue seems to be with loading BuildTemplatesTask on machines that only have the latest .NET and FSharp.Core installed.
Starting a website in VS 2011 sometimes produces this error:
HTTP Error 500.22 - Internal Server Error
An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.
Most likely causes:
This application defines configuration in the system.web/httpModules section.
The error disappears when the following is removed from Web.config:
#!xml
<httpModules>
<add name="WebSharper.Remoting" type="IntelliFactory.WebSharper.Web.RpcModule, IntelliFactory.WebSharper.Web" />
<add name="WebSharper.Sitelets" type="IntelliFactory.WebSharper.Sitelets.HttpModule, IntelliFactory.WebSharper.Sitelets" />
</httpModules>
</system.web>
Quote from http://fpish.net/topic/Some/0/74488 :
When I switch to .Net 4.5 and add a reference to F# 3.0, I get the following error:
Method not found: 'Microsoft.FSharp.Collections.FSharpList1<!0> IntelliFactory.WebSharper.Sitelets.IWebsite
1.get_Actions()'.
Switching back to F# 2.0 clears the error.
let e = new Event<int>()
let d = e.Publish.Subscribe(ignore).Dispose()
This error comes intermittently when testing and recently brought FPish down consistently.
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: chunkLength
ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: chunkLength]
System.Text.StringBuilder.ToString() +12681331
[email protected](Object value) in lliFactory.WebSharper.Sitelets\UrlEncoding.fs:352
[email protected](Action act) in lliFactory.WebSharper.Sitelets\Router.fs:161
<StartupCode$IntelliFactory-WebSharper-Sitelets>[email protected](Action action) in lliFactory.WebSharper.Sitelets\Router.fs:79
[email protected](Action x) in lliFactory.WebSharper.Sitelets\Router.fs:218
<StartupCode$IntelliFactory-WebSharper-Sitelets>[email protected](Object action) in lliFactory.WebSharper.Sitelets\HttpModule.fs:135
[email protected](IEnumerable`1& next) in D:\if-web-trainings\WebSharperSiteletsProject\Layout.fs:408
Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.MoveNextImpl() +76
Microsoft.FSharp.Collections.SeqModule.ToList(IEnumerable`1 source) +297
[email protected](IEnumerable`1& next) in D:\if-web-trainings\WebSharperSiteletsProject\Layout.fs:403
Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.MoveNextImpl() +76
Microsoft.FSharp.Collections.SeqModule.ToList(IEnumerable`1 source) +297
IntelliFactory.Trainings.Layout.DefaultHeader(Action action, Context`1 ctx)
[email protected](Context`1 ctx) in IntelliFactory.Trainings.Templates.Magnifico.MagnificoBody(Context`1 context, MagnificoArgs`1 args) in
[email protected](Context`1 context) in
[email protected](Context`1 context) in lliFactory.WebSharper.Sitelets\Controller.fs:144
<StartupCode$IntelliFactory-WebSharper-Sitelets>[email protected](Object sender, EventArgs e) in lliFactory.WebSharper.Sitelets\HttpModule.fs:147
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +270
Current WebSocket API stubs rely on Blob interface which comes from HTML5 File API, http://dev.w3.org/2006/webapi/FileAPI/
Suggestion: add these interfaces to the HTML5 assembly.
namespace Website
module CollTest =
open IntelliFactory.WebSharper
open IntelliFactory.WebSharper.Html
open System.Collections.Generic
[<JavaScript>]
let private DictPart () =
// Calling constructors won't include ...Collections.dll.js.
let d = new Dictionary<string,string>()
// Calling module methods (static methods) won't.
let m = [("Aka", "Pizza")] |> Map.ofSeq
// Calling any instance methods will cause the inclusion of ...Collections.dll.js.
// Uncomment to make it work.
// let m = m.Add ("Rosie", "Bagels")
// Another module method.
let result = m |> Map.toSeq |> Seq.map (fun (k,v) -> k + " -> " + v)
Div [
result
|> Seq.map (fun x -> LI [Text x])
|> OL
]
type CollTestControl () =
inherit Web.Control ()
[<JavaScript>]
override this.Body = DictPart () :> IPagelet
Currently abstract classes are erroneously identified as resources, which leads YUI and YUI formlets to fail.
Seems to be resolved by adding this to wsol.exe.config:
<runtime>
<loadFromRemoteSources enabled="true"/>
</runtime>
Need to copy App.config with appropriate binding redirects during extension generation.
Quote from: https://bugs.intellifactory.com/websharper/show_bug.cgi?id=505
Hello,
I would think Html5.CanvasGradient.AddColorStop should have the following
signature: float * string -> unit
The second parameter being the color, as taken from Dive Into HTML5:
Let’s define a gradient that shades from black to white.
my_gradient.addColorStop(0, "black");
my_gradient.addColorStop(1, "white");
Exception in Chrome 17.0.963.79
Uncaught Error: SYNTAX_ERR: DOM Exception 12
$.Define.Website.Canvas.addStopWebsite.dll.min.js:1
$.Define.Website.Client.App.$.Class.get_Body._Website.dll.min.js:1
$.Define.Website.Client.App.$.Class.get_Body.WWebsite.dll.min.js:1
$.Define.IntelliFactory.WebSharper.Html.Events.JQueryEventSupport.$.Class.OnMouse.eeIntelliFactory.WebSharper.Html.dll.min.js:1
a.event.dispatchWebResource.axd:16
a.event.add.j.handle.f
Quote from: https://bugs.intellifactory.com/websharper/show_bug.cgi?id=505
The following code returns false for an element with the class we were looking
for:
[<JavaScript>]
let (|Class|_|) className (elem : Element) =
if elem.HasAttribute "class" && (elem.GetAttribute "class").Contains
className then Some elem else None
For example, when using "Paste" from the context menu, the formlet is not triggered and still considers the old value is in effect.
The tools version "4.5" is unrecognized.
Published online samples are broken with IE7. Need to also re-test the samples and templates that come with WS.
Line: 17
Error: Object doesn't support property or method 'parse'
File: IntelliFactory.WebSharper.Html.dll.js
The generated script include when IE <= 7.0 fails.
<!--[if lte IE 7.0]>
<script type="text/javascript" src="/r2d2/WebResource.axd?d=oq0oQ09uCt_AlDr2wD1fDTKn3q0T49nzDC9i8U1O_fs5hPRM9JEfljqTCDzBWqs-4DXxgEf7NxFtV3ZrLxgZSaNsNy47Soh5nOvDGiqWRVMnl7xer4lTCCdqX0tzQf790&t=634614713120800000">
</script>
<![endif]-->
with exception:
<title>The resource cannot be found.</title>
...
[HttpException]: This is an invalid webresource request.
at System.Web.Handlers.AssemblyResourceLoader.System.Web.IHttpHandler.ProcessRequest(HttpContext context)
Investigation suggests a WebResource attribute is missing on the IntelliFactory.WebSharper assembly where Json.js and Json.min.js are embedded.
They work after conversion, but it is an annoyance.
There are issues with routers in the latest published version, in particular when a default sitelet project is deployed in a virtual directory /foo, the links stop working correctly.
Expected: ScrollTop : unit -> int
Actual: ScrollTop : unit -> JQuery
WebSharper functions (JavaScript, Remote) defined in modules without a namespace do not work as expected when called from a different assembly, stating "Failed to translate a method call." Adding a namespace is a workaround for now.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.