Issue Tracker
Commented Issue: Force CompilerParameters.TreatWarningsAsErrors = false in BatchCompiler.Compile() [3873]
By default TreatWarningsAsErrors = (WarningLevel > 0).
I don't want to touch WarningLevel in my system.codedom section, and <providerOption name="WarnAsError" value="false" /> is taken into account only for Web Forms compilation.
So it will be nice to to set TreatWarningsAsErrors = false in code. Or at least read the provider <providerOption name="WarnAsError" value="false" /> (unfortunately it is internal so read is only possible via reflection).
Issue is actual only for later versions of Spark, in 1.0release compiler parameters were created via new CompilerParameters().
Comments: ** Comment from web user: tgmayfield **
Actually, depending on the warning you may have to drop it lower. Mea culpa.
Commented Issue: Force CompilerParameters.TreatWarningsAsErrors = false in BatchCompiler.Compile() [3873]
By default TreatWarningsAsErrors = (WarningLevel > 0).
I don't want to touch WarningLevel in my system.codedom section, and <providerOption name="WarnAsError" value="false" /> is taken into account only for Web Forms compilation.
So it will be nice to to set TreatWarningsAsErrors = false in code. Or at least read the provider <providerOption name="WarnAsError" value="false" /> (unfortunately it is internal so read is only possible via reflection).
Issue is actual only for later versions of Spark, in 1.0release compiler parameters were created via new CompilerParameters().
Comments: ** Comment from web user: tgmayfield **
Note to people getting these errors: Check your web.config system.codedom section for warningLevel="4", which equates to telling the compiler to treat all warnings as errors. Drop it down to 3.
Commented Issue: SparkSense throws an exception whenever it runs [6846]
279 ERROR System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at SparkSense.Parsing.ProjectExplorer.ScanProjectItemForViews(ProjectItem projectItem) at SparkSense.Parsing.ProjectExplorer.ScanProjectItemForViews(ProjectItem projectItem) at SparkSense.Parsing.ProjectExplorer.ScanProjectItemForViews(ProjectItem projectItem) at SparkSense.Parsing.ProjectExplorer.BuildViewMapFromProjectEnvironment() at SparkSense.Parsing.ProjectExplorer.get_ProjectViewFolder() at SparkSense.Parsing.ProjectExplorer.GetViewFolder() at SparkSense.Parsing.ViewExplorer.InitCurrentView() at SparkSense.Parsing.ViewExplorer..ctor(IProjectExplorer projectExplorer) at SparkSense.StatementCompletion.CompletionSource..ctor(ITextBuffer textBuffer, IProjectExplorer projectExplorer) at SparkSense.StatementCompletion.CompletionListener.TryCreateCompletionSource(ITextBuffer textBuffer) at Microsoft.VisualStudio.Language.Intellisense.Implementation.CompletionBroker.<>c__DisplayClass1.<CreateSourcesForBuffer>b__0(ICompletionSourceProvider provider) at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.InvokeMatchingFactories[TExtensionInstance,TExtensionFactory,TMetadataView](IEnumerable`1 lazyFactories, Func`2 getter, IContentType dataContentType, Object errorSource) Editor or Editor Extension 2010/08/10 15:49:12.712
Comments: ** Comment from web user: alex_clark **
I had this problem - I fixed it by doing the following:
Go through each View folder in the solution and check that Studio hasn't added the same spark file twice to the solution. In my case, it had doubled up a file called details.spark. The solution would compile fine, but the sparksense threw the error.
Commented Issue: SparkSense throws an exception whenever it runs [6846]
279 ERROR System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at SparkSense.Parsing.ProjectExplorer.ScanProjectItemForViews(ProjectItem projectItem) at SparkSense.Parsing.ProjectExplorer.ScanProjectItemForViews(ProjectItem projectItem) at SparkSense.Parsing.ProjectExplorer.ScanProjectItemForViews(ProjectItem projectItem) at SparkSense.Parsing.ProjectExplorer.BuildViewMapFromProjectEnvironment() at SparkSense.Parsing.ProjectExplorer.get_ProjectViewFolder() at SparkSense.Parsing.ProjectExplorer.GetViewFolder() at SparkSense.Parsing.ViewExplorer.InitCurrentView() at SparkSense.Parsing.ViewExplorer..ctor(IProjectExplorer projectExplorer) at SparkSense.StatementCompletion.CompletionSource..ctor(ITextBuffer textBuffer, IProjectExplorer projectExplorer) at SparkSense.StatementCompletion.CompletionListener.TryCreateCompletionSource(ITextBuffer textBuffer) at Microsoft.VisualStudio.Language.Intellisense.Implementation.CompletionBroker.<>c__DisplayClass1.<CreateSourcesForBuffer>b__0(ICompletionSourceProvider provider) at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.InvokeMatchingFactories[TExtensionInstance,TExtensionFactory,TMetadataView](IEnumerable`1 lazyFactories, Func`2 getter, IContentType dataContentType, Object errorSource) Editor or Editor Extension 2010/08/10 15:49:12.712
Comments: ** Comment from web user: Rohland **
I just realised that I attempted to use the plugin on a webforms project that was recently integrated with MVC. There was a 'Views' folder but I noticed that the folder name was all lowercase. I haven't re-attempted to use the plugin on this specific project, but that may be the issue.
Commented Issue: SparkSense throws an exception whenever it runs [6846]
279 ERROR System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at SparkSense.Parsing.ProjectExplorer.ScanProjectItemForViews(ProjectItem projectItem) at SparkSense.Parsing.ProjectExplorer.ScanProjectItemForViews(ProjectItem projectItem) at SparkSense.Parsing.ProjectExplorer.ScanProjectItemForViews(ProjectItem projectItem) at SparkSense.Parsing.ProjectExplorer.BuildViewMapFromProjectEnvironment() at SparkSense.Parsing.ProjectExplorer.get_ProjectViewFolder() at SparkSense.Parsing.ProjectExplorer.GetViewFolder() at SparkSense.Parsing.ViewExplorer.InitCurrentView() at SparkSense.Parsing.ViewExplorer..ctor(IProjectExplorer projectExplorer) at SparkSense.StatementCompletion.CompletionSource..ctor(ITextBuffer textBuffer, IProjectExplorer projectExplorer) at SparkSense.StatementCompletion.CompletionListener.TryCreateCompletionSource(ITextBuffer textBuffer) at Microsoft.VisualStudio.Language.Intellisense.Implementation.CompletionBroker.<>c__DisplayClass1.<CreateSourcesForBuffer>b__0(ICompletionSourceProvider provider) at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.InvokeMatchingFactories[TExtensionInstance,TExtensionFactory,TMetadataView](IEnumerable`1 lazyFactories, Func`2 getter, IContentType dataContentType, Object errorSource) Editor or Editor Extension 2010/08/10 15:49:12.712
Comments: ** Comment from web user: RobertGreyling **
I've fixed the bug in my local build for the original issue. This will be released soon, but you can get it from source if you're desperate. @Rohland, I don't think yours is the same issue, it's happening in an entirely different area of the code and I think it might be because you don't have your views in a "Views" folder in the solution. Just guessing, but I'll look into it anyway, I don't want the exception thrown, I'd rather have the IntelliSense just *not* work.
Commented Issue: SparkSense throws an exception whenever it runs [6846]
279 ERROR System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at SparkSense.Parsing.ProjectExplorer.ScanProjectItemForViews(ProjectItem projectItem) at SparkSense.Parsing.ProjectExplorer.ScanProjectItemForViews(ProjectItem projectItem) at SparkSense.Parsing.ProjectExplorer.ScanProjectItemForViews(ProjectItem projectItem) at SparkSense.Parsing.ProjectExplorer.BuildViewMapFromProjectEnvironment() at SparkSense.Parsing.ProjectExplorer.get_ProjectViewFolder() at SparkSense.Parsing.ProjectExplorer.GetViewFolder() at SparkSense.Parsing.ViewExplorer.InitCurrentView() at SparkSense.Parsing.ViewExplorer..ctor(IProjectExplorer projectExplorer) at SparkSense.StatementCompletion.CompletionSource..ctor(ITextBuffer textBuffer, IProjectExplorer projectExplorer) at SparkSense.StatementCompletion.CompletionListener.TryCreateCompletionSource(ITextBuffer textBuffer) at Microsoft.VisualStudio.Language.Intellisense.Implementation.CompletionBroker.<>c__DisplayClass1.<CreateSourcesForBuffer>b__0(ICompletionSourceProvider provider) at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.InvokeMatchingFactories[TExtensionInstance,TExtensionFactory,TMetadataView](IEnumerable`1 lazyFactories, Func`2 getter, IContentType dataContentType, Object errorSource) Editor or Editor Extension 2010/08/10 15:49:12.712
Comments: ** Comment from web user: Rohland **
I am getting a similar result. As soon as I open a spark file and attempt to invoke the intellisense the extension crashes. After reviewing the log file, I found the following exception:
System.ArgumentNullException: Value cannot be null.
Parameter name: oldValue
 at System.String.Replace(String oldValue, String newValue)
 at SparkSense.Parsing.ProjectExplorer.GetCurrentViewPath()
 at SparkSense.Parsing.ViewExplorer.InitCurrentView()
 at SparkSense.Parsing.ViewExplorer..ctor(IProjectExplorer projectExplorer)
 at SparkSense.StatementCompletion.CompletionSource..ctor(ITextBuffer textBuffer, IProjectExplorer projectExplorer)
 at SparkSense.StatementCompletion.CompletionListener.TryCreateCompletionSource(ITextBuffer textBuffer)
 at Microsoft.VisualStudio.Language.Intellisense.Implementation.CompletionBroker.<>c__DisplayClass1.<CreateSourcesForBuffer>b__0(ICompletionSourceProvider provider)
 at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.InvokeMatchingFactories[TExtensionInstance,TExtensionFactory,TMetadataView](IEnumerable`1 lazyFactories, Func`2 getter, IContentType dataContentType, Object errorSource)
Created Issue: SparkSense throws an exception whenever it runs [6846]
279 ERROR System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at SparkSense.Parsing.ProjectExplorer.ScanProjectItemForViews(ProjectItem projectItem) at SparkSense.Parsing.ProjectExplorer.ScanProjectItemForViews(ProjectItem projectItem) at SparkSense.Parsing.ProjectExplorer.ScanProjectItemForViews(ProjectItem projectItem) at SparkSense.Parsing.ProjectExplorer.BuildViewMapFromProjectEnvironment() at SparkSense.Parsing.ProjectExplorer.get_ProjectViewFolder() at SparkSense.Parsing.ProjectExplorer.GetViewFolder() at SparkSense.Parsing.ViewExplorer.InitCurrentView() at SparkSense.Parsing.ViewExplorer..ctor(IProjectExplorer projectExplorer) at SparkSense.StatementCompletion.CompletionSource..ctor(ITextBuffer textBuffer, IProjectExplorer projectExplorer) at SparkSense.StatementCompletion.CompletionListener.TryCreateCompletionSource(ITextBuffer textBuffer) at Microsoft.VisualStudio.Language.Intellisense.Implementation.CompletionBroker.<>c__DisplayClass1.<CreateSourcesForBuffer>b__0(ICompletionSourceProvider provider) at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.InvokeMatchingFactories[TExtensionInstance,TExtensionFactory,TMetadataView](IEnumerable`1 lazyFactories, Func`2 getter, IContentType dataContentType, Object errorSource) Editor or Editor Extension 2010/08/10 15:49:12.712
Commented Issue: Content within HTML conditional comments is ignored [6373]
What's expected: Content within an HTML conditional comment should be evaluated by Spark.
Example code to reproduce:
<!--[if IE 6]>
<link type="text/css" rel="stylesheet" media="screen" href="~/css/ie.6.css">
<![endif]-->
Expected Output:
<!--[if IE 6]>
<link type="text/css" rel="stylesheet" media="screen" href="http://mysiteroot.com/css/ie.6.css">
<![endif]-->
Actual Output:
<!--[if IE 6]>
<link type="text/css" rel="stylesheet" media="screen" href="~/css/ie.6.css">
<![endif]-->
I appreciate why this is happening - commented content should be ignored, but conditional comment should ideally be handled as a special case.
Further Information:
* Conditional Comments - http://en.wikipedia.org/wiki/Conditional_comment and http://www.quirksmode.org/css/condcom.html
Comments: ** Comment from web user: mattdotson **
You can work around this issue by putting the starting comment tag in a code block.
!{ "<!--[if IE 6]>" }
It would be nice if spark knew about this, but it's not that hard to work around.
Created Issue: JavaScriptView works slightly difference [6462]
this.Write = function(arg) {this._parts.push(arg.toString());};
It seems the Writer is invoked with arg = ${Product.Barcode} (null) and null reference exception is thrown.
I would expect the both compiled views (C# and JavaScript) should accept the same parameters and produce the same results.
Created Issue: Content within HTML conditional comments is ignored [6373]
What's expected: Content within an HTML conditional comment should be evaluated by Spark.
Example code to reproduce:
<!--[if IE 6]>
<link type="text/css" rel="stylesheet" media="screen" href="~/css/ie.6.css">
<![endif]-->
Expected Output:
<!--[if IE 6]>
<link type="text/css" rel="stylesheet" media="screen" href="http://mysiteroot.com/css/ie.6.css">
<![endif]-->
Actual Output:
<!--[if IE 6]>
<link type="text/css" rel="stylesheet" media="screen" href="~/css/ie.6.css">
<![endif]-->
I appreciate why this is happening - commented content should be ignored, but conditional comment should ideally be handled as a special case.
Further Information:
* Conditional Comments - http://en.wikipedia.org/wiki/Conditional_comment and http://www.quirksmode.org/css/condcom.html
Commented Issue: HTML 5 and Spark view engine - Naming conflict 'section' [5625]
[CompilerException: Section cannot be used at this location]
Spark.Compiler.NodeVisitors.ChunkBuilderVisitor.VisitSection(SpecialNode node, SpecialNodeInspector inspector) +800
Spark.Compiler.NodeVisitors.ChunkBuilderVisitor.Visit(SpecialNode specialNode) +132
Spark.Compiler.NodeVisitors.AbstractNodeVisitor.Accept(IList`1 nodes) +101
....
I'm not sure if there are any other naming conflicts between html 5 and spark but this is a serious one as section is an important new tag.
Comments: ** Comment from web user: DigiKev **
There is nothing elegant about this work around but it solves the problem for anyone who wishes to use the section tag now.
Commented Issue: HTML 5 and Spark view engine - Naming conflict 'section' [5625]
[CompilerException: Section cannot be used at this location]
Spark.Compiler.NodeVisitors.ChunkBuilderVisitor.VisitSection(SpecialNode node, SpecialNodeInspector inspector) +800
Spark.Compiler.NodeVisitors.ChunkBuilderVisitor.Visit(SpecialNode specialNode) +132
Spark.Compiler.NodeVisitors.AbstractNodeVisitor.Accept(IList`1 nodes) +101
....
I'm not sure if there are any other naming conflicts between html 5 and spark but this is a serious one as section is an important new tag.
Comments: ** Comment from web user: gatapia **
That is super ugly
Commented Issue: HTML 5 and Spark view engine - Naming conflict 'section' [5625]
[CompilerException: Section cannot be used at this location]
Spark.Compiler.NodeVisitors.ChunkBuilderVisitor.VisitSection(SpecialNode node, SpecialNodeInspector inspector) +800
Spark.Compiler.NodeVisitors.ChunkBuilderVisitor.Visit(SpecialNode specialNode) +132
Spark.Compiler.NodeVisitors.AbstractNodeVisitor.Accept(IList`1 nodes) +101
....
I'm not sure if there are any other naming conflicts between html 5 and spark but this is a serious one as section is an important new tag.
Comments: ** Comment from web user: DigiKev **
Where there is a will there is a way, just spit out the section tags as string literals like so:
!{"<section id='page-content'>"}
!{"</section>"}
Commented Issue: Spark generated .cs failes when the view is a generic class [6068]
This causes compilation errors because the reference to the generic class is not correct
extract:
public abstract class GenericView<T> : AbstractSparkView
where T : class
{
public class ViewDataContainer
{
private Dictionary<String, Object> store = new Dictionary<string, object>();
public object Eval(string expression)
{
return store[expression];
}
public void Add(string expression, object result)
{
store.Add(expression, result);
}
}
public GenericView()
{
ViewData = new ViewDataContainer();
}
public T Model { get; set; }
public ViewDataContainer ViewData { get; private set; }
}
Than using this like the following code:
var settings = new SparkSettings().SetPageBaseType(typeof(GenericView<T>));
var templates = new InMemoryViewFolder();
var engine = new SparkViewEngine(settings)
{
ViewFolder = templates
};
var templates.Add("template.spark", File.ReadAllText(sparkTemplate));
var descriptor = new SparkViewDescriptor().AddTemplate("template.spark");
var view = (GenericView<T>)engine.CreateInstance(descriptor); // exception here
causes exceptions due to the following file being generated:
public class View985cb5903412401d80854c30ff9b0761 : GeneratePDFFromTemplate.GenericView`1[[generic class description]
Just thought I should report the bug, although it is a very unusual usage.
keep up the good work :)
Comments: ** Comment from web user: DavyLandman **
Hi Matt,
Yes, dynamic could work, but does imply C# 4... while if the generator would recognize generic classes and rebuild them correctly this wouldn't be a problem.
Commented Issue: Spark generated .cs failes when the view is a generic class [6068]
This causes compilation errors because the reference to the generic class is not correct
extract:
public abstract class GenericView<T> : AbstractSparkView
where T : class
{
public class ViewDataContainer
{
private Dictionary<String, Object> store = new Dictionary<string, object>();
public object Eval(string expression)
{
return store[expression];
}
public void Add(string expression, object result)
{
store.Add(expression, result);
}
}
public GenericView()
{
ViewData = new ViewDataContainer();
}
public T Model { get; set; }
public ViewDataContainer ViewData { get; private set; }
}
Than using this like the following code:
var settings = new SparkSettings().SetPageBaseType(typeof(GenericView<T>));
var templates = new InMemoryViewFolder();
var engine = new SparkViewEngine(settings)
{
ViewFolder = templates
};
var templates.Add("template.spark", File.ReadAllText(sparkTemplate));
var descriptor = new SparkViewDescriptor().AddTemplate("template.spark");
var view = (GenericView<T>)engine.CreateInstance(descriptor); // exception here
causes exceptions due to the following file being generated:
public class View985cb5903412401d80854c30ff9b0761 : GeneratePDFFromTemplate.GenericView`1[[generic class description]
Just thought I should report the bug, although it is a very unusual usage.
keep up the good work :)
Comments: ** Comment from web user: mattdotson **
@davy ... By the way. I was able to work around your generic issue using a dynamic type
public abstract class GenericView : AbstractSparkView
{
public dynamic Model { get; set; }
}
Commented Issue: Spark generated .cs failes when the view is a generic class [6068]
This causes compilation errors because the reference to the generic class is not correct
extract:
public abstract class GenericView<T> : AbstractSparkView
where T : class
{
public class ViewDataContainer
{
private Dictionary<String, Object> store = new Dictionary<string, object>();
public object Eval(string expression)
{
return store[expression];
}
public void Add(string expression, object result)
{
store.Add(expression, result);
}
}
public GenericView()
{
ViewData = new ViewDataContainer();
}
public T Model { get; set; }
public ViewDataContainer ViewData { get; private set; }
}
Than using this like the following code:
var settings = new SparkSettings().SetPageBaseType(typeof(GenericView<T>));
var templates = new InMemoryViewFolder();
var engine = new SparkViewEngine(settings)
{
ViewFolder = templates
};
var templates.Add("template.spark", File.ReadAllText(sparkTemplate));
var descriptor = new SparkViewDescriptor().AddTemplate("template.spark");
var view = (GenericView<T>)engine.CreateInstance(descriptor); // exception here
causes exceptions due to the following file being generated:
public class View985cb5903412401d80854c30ff9b0761 : GeneratePDFFromTemplate.GenericView`1[[generic class description]
Just thought I should report the bug, although it is a very unusual usage.
keep up the good work :)
Comments: ** Comment from web user: mattdotson **
I got something similar where my implementation of a AbstractSparkView was a nested class.
public class MyParentClass
{
public class MySparkView : AbstractSparkView { ... }
}
Spark failed because it doesn't expect a + in the class name. (i.e. MyParentClass+MySparkView)
Also low priority, but just giving more info
Commented Issue: Force CompilerParameters.TreatWarningsAsErrors = false in BatchCompiler.Compile() [3873]
By default TreatWarningsAsErrors = (WarningLevel > 0).
I don't want to touch WarningLevel in my system.codedom section, and <providerOption name="WarnAsError" value="false" /> is taken into account only for Web Forms compilation.
So it will be nice to to set TreatWarningsAsErrors = false in code. Or at least read the provider <providerOption name="WarnAsError" value="false" /> (unfortunately it is internal so read is only possible via reflection).
Issue is actual only for later versions of Spark, in 1.0release compiler parameters were created via new CompilerParameters().
Comments: ** Comment from web user: aloker **
I totally agree. Treating warnings as errors causes compilation of the following to fail because the compiler detects unreachable code (if(false)...):
<script type="text/javascript" src="~/Scripts/jquery-1.4.1.min.js" if="false"></script>
(useful to get jquery intellisense)
