Discussion Group

Syndicate content
Development discussion and project notification for Spark view engine
Updated: 8 min 27 sec ago

Commented Issue: SparkSense throws an exception whenever it runs [6846]

Tue, 08/31/2010 - 03:36
Whenever I type "${", or "<s:" or just press Ctrl-Space I get the the exception below:

279 ERROR System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgume ntException(ExceptionResource resource) at System.Collections.Generic.Dic tionary`2.Insert(TKey key, TValue value, Boolean add) at SparkSense.Parsing.ProjectExpl orer.ScanProjectItemForViews(P rojectItem projectItem) at SparkSense.Parsing.ProjectExpl orer.ScanProjectItemForViews(P rojectItem projectItem) at SparkSense.Parsing.ProjectExpl orer.ScanProjectItemForViews(P rojectItem projectItem) at SparkSense.Parsing.ProjectExpl orer.BuildViewMapFromProjectEn vironment() at SparkSense.Parsing.ProjectExpl orer.get_ProjectViewFolder() at SparkSense.Parsing.ProjectExpl orer.GetViewFolder() at SparkSense.Parsing.ViewExplore r.InitCurrentView() at SparkSense.Parsing.ViewExplore r..ctor(IProjectExplorer projectExplorer) at SparkSense.StatementCompletion .CompletionSource..ctor(ITextB uffer textBuffer, IProjectExplorer projectExplorer) at SparkSense.StatementCompletion .CompletionListe

Commented Issue: SparkSense throws an exception whenever it runs [6846]

Tue, 08/31/2010 - 03:36
Whenever I type "${", or "<s:" or just press Ctrl-Space I get the the exception below:

279 ERROR System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgume ntException(ExceptionResource resource) at System.Collections.Generic.Dic tionary`2.Insert(TKey key, TValue value, Boolean add) at SparkSense.Parsing.ProjectExpl orer.ScanProjectItemForViews(P rojectItem projectItem) at SparkSense.Parsing.ProjectExpl orer.ScanProjectItemForViews(P rojectItem projectItem) at SparkSense.Parsing.ProjectExpl orer.ScanProjectItemForViews(P rojectItem projectItem) at SparkSense.Parsing.ProjectExpl orer.BuildViewMapFromProjectEn vironment() at SparkSense.Parsing.ProjectExpl orer.get_ProjectViewFolder() at SparkSense.Parsing.ProjectExpl orer.GetViewFolder() at SparkSense.Parsing.ViewExplore r.InitCurrentView() at SparkSense.Parsing.ViewExplore r..ctor(IProjectExplorer projectExplorer) at SparkSense.StatementCompletion .CompletionSource..ctor(ITextB uffer textBuffer, IProjectExplorer projectExplorer) at SparkSense.StatementCompletion .CompletionListe

Re: Special node use had no understandable attributes

Tue, 08/31/2010 - 02:48
Some further info,

I've made this really simple now, and copied both the
Application.spark and the view into another project and they work
fine.

So it must be something gone weird with the project. One thing worth
mentioning perhaps, I have two MVC2 projects in the same solution, one
of them is working, the other isn't.

Special node use had no understandable attributes

Tue, 08/31/2010 - 02:32
Hello,

I'm getting this error message: "Special node use had no
understandable attributes"

Which suggests to me that I'm using the use tag with some incorrect
attributes.

However, I've swapped the Application.spark for one from another
simple app that works, and edited the view so it only has one line of

RE: HTML method and Html property in SparkView class

Mon, 08/30/2010 - 21:48
D'oh!
The upper-case HTML(x) method is when you have any value 'x' that you're explicitly stating is already html, and shouldn't be encoded.
Like a string Body that is known to contain markup you'd have ${HTML(Body)}
The name came from xhp's HTML() function. See [link] section "Escaping".

HTML method and Html property in SparkView class

Wed, 08/25/2010 - 20:29
Hi,

In the SparkView class from the System.Web.Mvc assembly there is a
property called Html. There is also a method called HTML, which is a
problem if your using a case insensitive language.

I don't suppose the method could be renamed in a future version ?

Cheers,
John

RE: class keyword

Wed, 08/25/2010 - 15:26
That's actually a leftover from a *long* time ago.
There was an question about using spark as a template engine to output csharp source code - but the elements that look natural in an html or xml template look really out of place in a csharp file.
So that was an example of looking into creating an entirely different cs-file-friendly syntax. That syntax wouldn't need to understand elements and attributes at all - probably based more on something that looked like specialized comments.

Re: class keyword

Wed, 08/25/2010 - 08:46
Hi Louis,

Thanks for the suggestions. I went with my own SyntaxProvider which
was a copy of DefaultSyntaxProvider, that allowed me to replace
MarkupGrammer with my own were I removed the .Or(Swap(Ch("class"),
"@class"));

I noticed there was also a CSharpSyntaxProvider but that doesn't
appear to be referenced anywhere. Do you think in the future syntax

Re: Visual Studio intellisense

Wed, 08/25/2010 - 00:17
Been using it for a few days. Works great.

Re: Visual Studio intellisense

Wed, 08/25/2010 - 00:01
Yep, I filed the issue (6846) with the exception details :)

Thanks,

Sedat

ISparkExtension and adding attributes to IList<Node> in VisitNode

Tue, 08/24/2010 - 23:13
I am attempt to add a disabled attribute to an input ElementNode from
VisitNode in a custom ISparkExtension. This is code I am currently
trying but after adding the attribute to the tree and called
visitor.Accept(body), the attribute is not being written out at the
time of rendering.

var inputTags = body.Where(n => n is ElementNode && ((ElementNode)

Warning as Error

Tue, 08/24/2010 - 20:33
If I call an Obsolete method from a spark file I get a dynamic view
compilation error:

c:\source\blah.spark(24,205): error CS0618: Warning as Error:
'Foo.Bah(string)' is obsolete: 'use baz.'

This has only happened since upgrading from spark 1.0 and mvc 1 to
spark 1.1 and mvc 2. Does anyone know how to supress the error?

Re: Visual Studio intellisense

Thu, 08/19/2010 - 17:31
Great news Rob. Looking forward to testing it out.

Henning

Re: Visual Studio intellisense

Thu, 08/19/2010 - 17:31
Hi Sedat,
I saw the issue raised and I'll look into it. As I said in the blog post,
custom namespace prefixes are not yet supported but will be very soon.
The activitylog.xml only shows up if you run VS with the /log option from
the command line. But you should have to do that since those exceptions are

Re: Visual Studio intellisense

Thu, 08/19/2010 - 10:53
Awesome job Rob, thanks!

I couldn't get it working though. Whenever I type "${" or "<s:" (our
spark namespace), extension throws an exception. (there is no
"activitylog.xml" generated in the given directory)

I'll try to file a bug :)

Sedat

Created Issue: SparkSense throws an exception whenever it runs [6846]

Wed, 08/18/2010 - 23:42
Whenever I type "${", or "<s:" or just press Ctrl-Space I get the the exception below:

279 ERROR System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgume ntException(ExceptionResource resource) at System.Collections.Generic.Dic tionary`2.Insert(TKey key, TValue value, Boolean add) at SparkSense.Parsing.ProjectExpl orer.ScanProjectItemForViews(P rojectItem projectItem) at SparkSense.Parsing.ProjectExpl orer.ScanProjectItemForViews(P rojectItem projectItem) at SparkSense.Parsing.ProjectExpl orer.ScanProjectItemForViews(P rojectItem projectItem) at SparkSense.Parsing.ProjectExpl orer.BuildViewMapFromProjectEn vironment() at SparkSense.Parsing.ProjectExpl orer.get_ProjectViewFolder() at SparkSense.Parsing.ProjectExpl orer.GetViewFolder() at SparkSense.Parsing.ViewExplore r.InitCurrentView() at SparkSense.Parsing.ViewExplore r..ctor(IProjectExplorer projectExplorer) at SparkSense.StatementCompletion .CompletionSource..ctor(ITextB uffer textBuffer, IProjectExplorer projectExplorer) at SparkSense.StatementCompletion .CompletionListe

Re: Extending spark with custom attributes

Tue, 08/17/2010 - 23:28
Oops! Forgot to add that I wold process the whole view permission not
in markup, but in controller using AuthorizeAttribute or marker
interfaces

On Aug 10, 3:07 pm, "Igor Loginov (aka ilog2000)" <ilog2...@gmail.com>
wrote:

Re: Extending spark with custom attributes

Mon, 08/16/2010 - 22:56
Hi Sean,

I would make the following:
1. I'd make a HtmlHelper extension method, let's say
DivWithPermission(string innerHtml, string permission) with tag
rendering rules inside.
2. I would use a brand new Spark feature "Bindings" to create a
binding for <div> like this:
<element name="div">Html.DivWithPermiss ion('child::*', '@permission')</

Re: Best way to make a grouped foreach

Mon, 08/16/2010 - 22:08
Hi,

If you need each second product in pair on a new line, I'd suggest 1)
to make ViewModel with a list of product pairs, and 2) to put nested
unordered lists. Like this:

<ul>
<for each='var productPair in productPairs'>
<li>
<ul>
<li>$!{productPair.Products[0] }</li>
<li>$!{productPair.Products[1] }</li>

Re: Visual Studio intellisense

Sat, 08/14/2010 - 11:41
It would if Microsoft allowed it - but they don't, so unfortunately, no it
doesn't work.