I am having the strangest error and it's driving me up the wall. At the moment I have the following two bundles...
var jquery = new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"
, "~/Scripts/jquery-ui-{version}.js"
, "~/Scripts/materialize/materialize.js"
, "~/Scripts/knockout-{version}.debug.js"
, "~/Scripts/knockout-{version}.js"
, "~/Scripts/jquery.signalR-{version}.js");
var jsfiles = new ScriptBundle("~/bundles/Assets/js")
.IncludeDirectory("~/Assets/js", "*.js", true);
bundles.IgnoreList.Ignore("~/Scripts/knockout-{version}.js", OptimizationMode.WhenDisabled);
Within the ASSETS folder there is the following file
jquery-ui-1.10.3.custom.min.js"
When I debug and run locally everything is fine. However when I turn on following
BundleTable.EnableOptimizations = true;
The jquery-ui file mentioned is throwing the following error...
Uncaught TypeError: Illegal invocation
Which relates to this block of code
return u?n.isFunction(u[e])&&"_"!==e.charAt(0)?(i=u[e].apply(u,o),i!==u&&i!==t?(s=i&&i.jquery?s.pushStack(i.get()):i,!1):t):n.error("no such method '"+e+"' for "+r+" widget instance")
:n.error("cannot call methods on "+r+" prior to initialization; attempted to call method '"+e+"'")})
:this.each(function(){var t=n.data(this,f);});
I don't even know where to start debugging it? Could the minification engine be doing something?
From memory, javascript resourced with .min in the filename are automatically excluded from bundling, so referencing the unminified version of the JQuery UI document should fix it (or alternatively, but not recommended - remove the .min from your existing filename.
Related
when i run my code it show a script error dialog
"Error -Script error ,URL - http://www.bing.com/api/maps/mapcontrol?callback=OnLoad"
OnLoad is function which i call to initialize the map
Url i used to get map in my html file -
<script type='text/javascript' src='http://www.bing.com/api/maps/mapcontrol?callback=OnLoad' async defer></script>
Two things to try. First make sure your network can reach the http://bing.com website. Second, make sure you have a function call OnLoad that is accessible to the map control to call. Verify spelling and that it al control doesn't try and call this function before it is available. Try adding async defer to your script tag and this will allow your other code to load a bit faster.
I'm trying to invoke an image with infobox and infoboxImage. Here is what I have....
|image = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{image_size|}}}|upright= {{{image_upright|1}}}|alt={{{alt|}}}}}
And I get the following error on my index.php?title=Module:InfoboxImage&action=submit#mw-ce-l1 page
Script error: Lua error at line 1: unexpected symbol near '|'.
What do I need to do to get this working?
Here is my LocalSettings.php for Scribunto:
require_once "$IP/extensions/Scribunto/Scribunto.php";
#$wgScribuntoDefaultEngine = "luastandalon"';
So you're adding template syntax like {{{image|}}} in a module page? Why?
I doubt you really need to handle such a Lua module for your wiki. However, if you really want to copy the Lua-powered infobox templates of other wikis, make sure you import them with Special:Import and select the recursive import checkbox.
Hopefully you'll then have all the modules you need without fiddling with them.
I figured out I cannot load one script library from another easily:
module.csx
string SomeFunction() {
return "something";
}
script.csx
ExecuteFile("module.csx");
SomeFunction() <-- causes compile error "SomeFunction" does not exist
This is because the compiler does not know of module.csx at the time it compiles script.csx afaiu. I can add another script to load the two files from that one, and that will work. However thats not that pretty.
Instead I like to make my scripthost check for a special syntax "load module" within my scripts, and execute those modules before actual script execution.
script.csx
// load "module.csx"
SomeFunction()
Now, with some basic string handling, I can figure out which modules to load (lines that contains // load ...) and load that files (gist here https://gist.github.com/4147064):
foreach(var module in scriptModules) {
session.ExecuteFile(module);
}
return session.Execute(script)
But - since we're talking Roslyn, there should be some nice way to parse the script for the syntax I'm looking for, right?
And it might even exist a way to handle module libraries of code?
Currently in Roslyn there is no way to reference another script file. We are considering moving #load from being a host command of the Interactive Window to being a part of the language (like #r), but it isn't currently implemented.
As to how to deal with the strings, you could parse it normally, and then look for pre-processor directives that are of an unknown type and delve into the structure that way.
Support for #load in script files has been added as of https://github.com/dotnet/roslyn/commit/f1702c.
This functionality will be available in Visual Studio 2015 Update 1.
Include the script:
#load "common.csx"
...
And configure the source resolver when you run the scripts:
Script<object> script = CSharpScript.Create(code, ...);
var options = ScriptOptions.Default.WithSourceResolver(new SourceFileResolver(new string[] { }, baseDirectory));
var func = script.WithOptions(options).CreateDelegate()
...
I am currently saving my .NET FX 4.0.1 StateMachine activity like this:
var sb = new StringBuilder();
var xamlWriter = ActivityXamlServices.CreateBuilderWriter(
new XamlXmlWriter(new StringWriter(sb),
new XamlSchemaContext()));
XamlServices.Save(xamlWriter, activityBuilder);
return sb.ToString();
This works fine and the generated XAML looks good. Unfortunately, it is invalid. I can read it back in using ActivityXamlServices.Load but when I execute it, it says that it doesn't know the properties defined in the workflow. Opening it in the Visual Studio designer yields the same errors:
Compiler error(s) encountered processing expression "ActiveCall". "ActiveCall" is not declared. It may be inaccessible due to its protection level.
Through comparing the original XAML with the XAML produced by my code, I found out how to fix this problem. I have to have this tag before the StateMachine tag:
<mva:VisualBasic.Settings>
Assembly references and imported namespaces for internal implementation
</mva:VisualBasic.Settings>
By the way:
The text inside the tag must be exactly like this, otherwise there will be an error when opening the WF in VS:
Failed to create a 'Settings' from the text 'FooBar'
Question:
What do I have to change in my code to have this tag in the generated XAML?
I think I found the answer.
I have to use the following code before calling Save:
VisualBasic.SetSettings(activityBuilder, new VisualBasicSettings());
If the activityBuilder has been created from a DynamicActivity it is even better to use the following code:
VisualBasic.SetSettings(activityBuilder,
VisualBasic.GetSettings(dynamicActivity));
If this is not used, namespaces that are only needed for extension methods are not written to the XAML and will lead to an error when loading and executing the XAML.
I summarized my findings on code project.
I'm new to code contracts. I downloaded the latest build of code contract project (1.4.40314.1) and started to implement it in my project. When i enabled 'Runtume Checking' through Code Contracts Tab in VS2010, i got this Error
Error 1 The command ""C:\Program Files (x86)\Microsoft\Contracts\Bin\ccrewrite" "#Application1ccrewrite.rsp"" exited with code -1.
everytime i build the project. Plz help.
Now it's a major problem for me.
Every project using code contracts is showing same error in VS2010 Errors window and 'Application1ccrewrite.rsp' not found in output window, but it is there.
I tried out everything. I installed both versions (Pro, Std) but the problem persist. Plz help !
I had this problem as well. In my case the problem was that ccrewrite cannot work with files in a network folder but requires the project to be on your local hard disk.
I had this problem. The Assembly name and Default namespace of the class library that causes the problem had the same name as an existing DLL in the destination folder. I had been refactoring my code and whilst the namespaces in the CS files had all be changed to namespace2 the default namespace in the properties file was still namespace1
When I corrected this the files all built successfully...
Sometimes you can get this when your solution path is too long, especially with many projects.
Try moving to c:\temp and building it, it might fix it (although of course, this might not be a solution if you need it in the folder it currently is).
This bug I noticed in earlier CC versions and may now be fixed.
I don't know if you had the same problem as me, but I also saw this error. In my case, I had a method with a switch statement, and depending on the branch taken, different requirements applied:
static ITransaction CreateTransaction(
String transType,
MyType1 parm1,
/* Other params unimportant to this example */
String parm5)
{
switch (transType) {
case Transaction.Type.SOME_TRANSFER:
Contract.Requires<ArgumentNullException>(parm1.Account != null, "Account cannot be null.");
Contract.Requires<ArgumentException>(!String.IsNullOrWhiteSpace(parm5), "parm5 cannot be null or empty.");
// Create instance
return someInst;
case Transaction.Type.SOME_OTHER_TRANSFER:
Contract.Requires<ArgumentException>(!String.IsNullOrWhiteSpace(parm1.Type), "Type cannot be null or empty.");
Contract.Requires<ArgumentException>(!String.IsNullOrWhiteSpace(parm1.Number), "Number cannot be null or empty.");
// Create instance
return someInst;
/* Other cases */
default:
throw new ApplicationException("Invalid or unknown transaction type provided.");
}
}
This was giving me the error you noted in the Errors List when I tried to build. In the output window, I was getting this:
EXEC : Reference Assembly Generator
warning : Something is wrong with
contract number 1 in the method
'TerraCognita.LoanExpress.Domain.Loan.CreateLoanTransaction'
AsmMeta failed with uncaught
exception: Operation is not valid due
to the current state of the object.
I pushed each branch into a method of its own, making Contract.Requires the first lines of code in each method, and I no longer had a compilation problem. It appears that Contract.Requires must be the first lines of code in a method - which makes sense, since they are intended to be used to define pre-conditions.
Hope this helps.
The solution is to put the pre and pos conditions in the first lines. The ccrewrite does not accept that pre and post conditions are below command lines.