I am learning how to use WebSharper. Actually, I am failing to learn how to use WebSharper.
I wanted to learn how to build a simple SPA so I followed this tutorial from the WebSharper page. I am able to create the SPA with Visual Studio and Zafir (the codename for WebSharper 4.0 that is in beta). I followed every step in the tutorial. I have created a repo on github that is everything in the SPA.
The project won't build. More specifically, in the Client.fs file, I get compiler error
The value or constructor P is not found
in line 10 with the P, in line 11 the same error with the Div, and in line 18 I get the error
Namesapces cannot contain values. Consider using a module to hold your value declrations.
with Run(), yet when I try to move the [<SPAEntryPoint>] information into the module HelloWorld, I get the error
Lookup on object of indeterminate type based on information prior to this program point. A type annotation...
As a result, when I try to build this project, the build fails.
Why am I getting these errors? Is the tutorial out of date with the rest of WebSharper? What can I do to get a simple tutorial to work correctly?
EDIT: I get the same errors when I use WebSharper v3.x, too.
Although not mentioned in the tutorial, adding
open WebSharper.Html.Server
eliminated the compiler errors with P and Div, adding
open WebSharper.Html.Client
eliminated a new compiler error of OnClick, and moving the [<SPAEntryPoint>] into the module eliminated that compiler error and allowed me to build the project.
Thanks for the report! I have updated documentation, indeed that page was not updated since a while. I will review it more thoroughly.
The source of the documentations are found at https://github.com/intellifactory/websharper.docs, feel free to add issue there about further questions/problems or also you can submit a PR.
Related
Recently I have installed Xtext and tried to run the default Hello world! code using the tutorials available on youtube. However, when I try to run the code I am getting 44 errors.
I am new to using Xtext as well as eclipse. I have tried to reinstall eclipse a lot of times. I have tried with normal version, enterprise version and DSL tools version. But every time I am getting the same errors. Please help me resolve this issue. I tried to find out what these errors meant and how to resolve them over the eclipse community forums but did not find any solution.
All the errors are repetitions of the following two errors.
Description Resource Path Location Type
Duplicate field InternalMyDslParser.FOLLOW_ InternalMyDslParser.java /org.xtext.example.mydsl.ide/src-gen/org/xtext/example/mydsl/ide/contentassist/antlr/internal line Java Problem
and
Description Resource Path Location Type
Syntax error on token "?", delete this token InternalMyDslParser.java /org.xtext.example.mydsl.ide/src-gen/org/xtext/example/mydsl/ide/contentassist/antlr/internal line Java Problem
Please Help me resolve this issue.
I started messing with the new Visual Studio Code today and I am running into a small "problem"...of sorts.
I have added reference to Npgsql in the project.json of a Web API project and run 'dnu restore' which also updated the project.lock.json to include the proper references. However the code editor highlights an error for every reference to an Npgsql object, giving me the "are you missing a using directive or reference" message for each one, including the 'using Npgsql;'
The really odd part is that the same tooltip that tells me it doesn't recognize the type..also tells me exactly what it is and does. Intellisense still works and if I execute 'dnx: web'...the whole thing runs just fine with no errors.
I am assuming its just a bug in the new editor but who knows, maybe I've not configured something correctly? Anybody else see this?
You might see this when having two frameworks configured in project.json. By default you will have dnx451 and dnxcore50. It might be that the dependency is only available for one of the frameworks but not for the other. Check the error message VSCode gives you - it will include in []-brackets the framework for which the error is valid.
I'm interested in playing around with the MaxSAT/MaxSMT c example (specifically, maxsat.c) provided on the z3 (Microsoft Research) website. Using Visual Studio 2010, I eventually got the example to compile (using a fresh install of z3 4.0). However, I can't get any of my (SMT 2.0) models to run using them. Further, I cannot get the example posted in this question to work either.
In the first case, my compiled program crashes when it tries to call Z3_get_smtlib_num_formulas in get_hard_constraints of the file. I don't know why, instead, I get the standard windows 7 "this program has stopped working" popup.
In the second case, it reports unsupported ;benchmark.
In order to help me to get this work, I was wondering if
(a) Has anyone had similar issues when compiling this code, and if so, how did you resolve them?
or
(b) How can I debug either compilation of the file (assuming it is correct)? Namely, can someone enumerate the correct libraries (and library versions - e.g., z3 4.0?) to include in the compiler options to get this example working?
In either case, information on the error reported in the second case would also be appreciated: what does it mean exactly? The keyword was not valid? That the SMT input is the wrong version? Or something else?
Thanks.
The MaxSAT example has not been updated to SMTLIB 2.0 yet. It uses the function Z3_parse_smtlib_file to parse the input, which means that it supports only SMTLIB 1.0 at the moment.
This example is distributed alongside Z3, i.e., you should have received a copy in Z3-4.0/examples/maxsat/, which also contains compilation and execution scripts.
Compilation should be straight-forward by running build.cmd in a Visual Studio Command Prompt, or build.sh on Linux.
We just set up TFS 11 for the first time. Running a gated check in, it succeeds but returns this message:
'srctool.exe' returned an unexpected exit code: '-1'. An error
occurred when opening a file "CustomDllName.dll": Assembly
"CustomDllName.dll" is not a valid .NET assembly and will be skipped
for analysis.
Well, it's right: that file is a legacy Visual Basic 6 DLL that we don't have much control over. It's included in the project for COM access to some of the methods.
Is there a way to instruct srctool.exe/TFS to skip that file when doing the inspection? Or another way to attack this?
Here is the solution that ultimately worked for me
A member of the TFS 11 team at Microsoft mentioned to me that the problem is due to a change in behavior that the Windows 8 team made to the srctool.exe tool.
By copying this file from the Windows 7 SDK (WinDBG) toolkit and overriding the one included in TFS 11 Beta, I was able to successfully run a build without any errors.
Is this a srctool.exe error from the shipped IndexSources activity? srctool.exe in this activity does one thing, which is to list the source files information in the pdb. I am not a srctool expert so I don't know why it fails in this case. I do know that srctool.exe has some behavioral changes in version 11, most of those are fixes from the previous version.
There is a workaround which requires udpating the build template. It is not very nice but it works. Srctool.exe is run (inside IndexSources activity) for each pdb file in the SymbolFiles collection. Now that you know which pdb fails, you can update the build template to add a RemoveFromCollection activity before the IndexSources activity that remove the troubled pdb from the SymbolFiles collection. This is by far the most straightforward workaround I can think of.
Alternatively, you can edit FindMatchingFiles activity's search pattern to exclude the pdb files you don't want to have sources indexed.
Based on the error message you got, it doesn't seem to be related to the known issue Ed mentioned. We fixed this issue for the next release, so if it's related, it should be fixed :-)
Let me know if you have any issue with VS11 Beta around the build templates.
Thanks.
I've been in the process of attempting to deploy an ASP.NET 4.0 (webform) project on a server that is running an ASP.NET MVC 1.0 application in it's web-root. I was slowly making progress, but hit a wall, so I decided to recompile the MVC app against version 2.0 of the MVC framework and 4.0 of the .NET framework. I used a few tools to do so.
The project appeared to successfully convert, but now it fails to compile. Specifically, it appears that there is a problem with System.Web.HttpContextBase.
For example, if I have the following code:
context.HttpContext.Response.Clear();
I get the following error:
'System.Web.HttpContextBase' does not contain a definition for 'Response' and no extension method 'Response' accepting a first argument of type 'System.Web.HttpContextBase' could be found (are you missing a using directive or an assembly reference?)
I've checked the object explorer just to make sure: HttpContextBase does have a property called Response. This thing is driving me crazy.
I have another big problem, which I believe to be related. Anytime the Request object is queried:
Request["old"];
It says:
Cannot apply indexing with [] to an expression of type 'System.Web.HttpRequestBase'
As far as I can tell, there isn't any reason for this either.
I'm at my wits end. I've checked the breaking changes document for MVC 2.0 but didn't see anything related to this. The references all look good to me; the version numbers all check out.
Further note on the server issue: I do not have any access to the deployment web server except ftp. I cannot go in and mess around with the server configuration. That's why this may sound a little odd to you.
I'm glad that worked for you, here it is again as an answer for everyone else
It's possible your IDE and Runtime are disagreeing over which library
version to use. Try creating a new project and moving your source over
to it and compiling again.