I recently updated my FW/1 app to version 3.5 and now the controllers functions aren't being called.
<!---# Version History: 11 July 2011, Created by James Mohler --->
<!---# Version History: 31 May 2013, Converted to Component by James Mohler --->
component accessors=true {
property framework;
property beanFactory;
property reportService;
property historyService;
property uiService;
property payService;
property supportService;
void function before(required struct rc) {
param rc.BossEID = "all";
Dump of variables
Note that there are no functions on the controllers. No error message is shown.
The ColdFusion style comments seems to change how the file is processed.
component accessors=true {
doesn't do anything because the file is not in automatic <cfscript> mode.
Related
I am following the BookStore data binding example, documented at XAML controls; bind to a C++/WinRT property, up to and including the "Bind the button to the Title property" section.
My starting point is a new "Blank App, Packaged (WinUI 3 in Desktop)" project in Visual Studio.
[EDIT] Starting from a "Blank App (C++/WinRT)" project, which is for UWP apps, works perfectly. The problem persists with "WinUI 3 in Desktop" projects.
The initial data binding works and the button content L"Atticus" is read from the BookSku title property. However calling MainViewModel().BookSku().Title(L"To Kill a Mockingbird"); in the click handler, as directed in article, throws the exception
Exception thrown at 0x00007FFC801B4ED9 (KernelBase.dll) in BookStore.exe: WinRT originate error - 0x8001010E : 'The application called an interface that was marshalled for a different thread.'.
Stepping through the code, the call
m_propertyChanged(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"Title" });
in void BookSku::Title(hstring const& value) is where the exception is thrown from within.
I can change the button content manually, not through the binding property.
The first example in the Data binding in depth article describes a very similar, though slightly less complicated, data binding scenario. It throws the same exception.
I am using latest Microsoft.Windows.CppWinRT version 2.0.210825.3 and Windows App SDK version 0.8.3
This issue #4547 was the key to figuring out the solution. You need to use the Microsoft namespace, not Windows. For documentation purposes this is what the BookSku.idl file should look like:
// BookSku.idl
namespace Bookstore
{
runtimeclass BookSku : Microsoft.UI.Xaml.Data.INotifyPropertyChanged
{
BookSku(String title);
String Title;
}
}
The application called an interface that was marshalled for a different thread
The problem is you update the property in the no-uithread, so it will throw the above exception, you could use the following to go back to ui-thread before updating the property.
co_await winrt::resume_foreground(Dispatcher(), CoreDispatcherPriority::Normal);
For more detail please refer to document here.
I made a plugin for bukkit 1.2.5 (to used on a tekkit server) that alerted players when someone (for example) tried to place down some tnt which is why I using block IDs.
Now that I'm trying to use an updated version of bukkit (1.7.2-R0.3 to be exact) it seems that the getTypeId() method is no longer working. I've googling/searching in the javadoc for a solution but I can't find one.
// Checks if the block placed has the id of 46 / tnt
if (e.getBlock().getTypeId() == 46) {
e.setCancelled(true);
Server server = Bukkit.getServer();
server.broadcastMessage("Someone tried to place some tnt down");
}
How do I get it to work in 1.7.2 now that getTypeId() is deprecated
You can still use the getTypeId() method for Blocks or the getId() method for the Block Material despite the fact that they are deprecated. If you add the #SuppressWarnings("deprecation") annotation to your listener method your IDE should not complain about using the deprecated methods. You can also alternatively use the non-deprecated Material enum directly with event.getBlock().getType() == Material.TNT.
Using QtIFW-1.5.0, so far I'm able to generate an online installer for my Qt application on Windows. The installer downloads the appropriate package from my web server and performs some operations defined in the control script installscript.qs, e.g. writing some keys into registry and creating a desktop shortcut with an icon:
installscript.qs:
Component.prototype.createOperations = function()
{
try
{
// call the base create operations function
component.createOperations();
// Add some keys to registry;
var userProfile = installer.environmentVariable("USERPROFILE");
installer.setValue("UserProfile", userProfile);
var reg = installer.environmentVariable("SystemRoot") + "\\System32\\reg.exe";
var key= "HKCU\\Software\\Company\\Product";
component.addOperation("Execute", reg, "ADD", key, "/f");
component.addOperation("Execute", reg, "ADD", key, "/v", "productId", "/t", "REG_BINARY");
// Add a desktop shortcut with icon:
component.addOperation("CreateShortcut",
"#TargetDir#\\MyExecutable.exe",
"#UserProfile#\\Desktop\\MyExecutable.lnk",
"workingDirectory=#TargetDir#",
"iconPath=#TargetDir#\\MyIcon.ico");
}
catch (e)
{
print(e);
}
}
All right, but another key I need to write into registry is the package VERSION NUMBER, defined in the installer configuration file config.xml in tag
<Version></Version>
How can I get this value from installscript.qs ? I read --I'd said more: studied-- the docs component QML Type and installer QML Type and I have not found any reference to version, except:
installer QML type:
boolean versionMatches(string version, string requirement)
which is useless for me, because you have to know the version, which is precisely what I find.
So any help would be appreciated.
You can call
var version = installer.value("ProductVersion");
to get the version specified in the config.xml file.
I am using Sitecore Glass Mapper for a new project I'm setting up.
We are using Sitecore 7.2, latest version of Team Development for Sitecore (TDS) code generation and the latest version of glass.
The code I am trying to execute:
var b = new SitecoreContext();
var c = b.GetCurrentItem<T01_Homepage>();
b is not null. c is null.
var d = b.GetItem<T01_Homepage>("path")
d is null.
I added my assembly in GlassMapperScCustom:
public static IConfigurationLoader[] GlassLoaders(){
var attributes = new AttributeConfigurationLoader(new[] { "Company.Framework.Websites.Corporate", "Company.Framework.Core", "Company.Framework.Common" });
return new IConfigurationLoader[] { attributes };
}
When I look into b.GlassContext.TypeConfigurations all my models are there.
I figured it could be a language issue because the site is in dutch and maybe the wrong language would be resolved incorrectly. This was also not the case.
I disabled WebActivator and added the GlassMapperSc.Start() in my Global.asax Application_Start method.
We are also using Autofac as DI framework. But without it, it still isn't working as you can see above. Also when I create my own custom models without TDS code generation the result of GetCurrentItem<T> is null.
Does anyone have an idea how I can fix this?
Did you check your Sites.config and the default language for this website? There could be a difference between the language which is defined in your Sitecore languages folder and your configuration.
I had a similar problem with one of my projects where I changed the Sitecore.Context.Language to "nl" instead of "nl-NL". The glass mapper will return null, but Sitecore.Context.Database.GetItem will return an object in this case.
Most of the times it is a language issue. The mapper returns a null object when you do not have versions in the current or given language.
What can be confusing is that Sitecore.Context.Database.GetItem returns an object, even if it does not have a version in the current language. Be sure to check that item.Versions has any.
Some things you may try (this didn't fit in the comments field)
1) Confirm that the related fields in the Sitecore Item object contain values (so Sitecore.Context.Item for your "c" var and Sitecore.Context.Database.GetItem("path") for your "d" var)
2) Try to encapsulate the GetItem/GetCurrentItem call in a VersionCountDisabler, like this:
T01_Homepage model = null;
using (new VersionCountDisabler())
{
var context = new SitecoreContext();
model = context.GetItem<T01_Homepage>("path");
}
// Do you have data in model now?
3) Try to encapsulate the same call with a SecurityDisabler. Just to confirm it's not a security issue.
4) If you still don't know what it is, please update your question with some (simplified) code for your model.
I can't figure out why this exception was threw...
I have a unit test:
[Test]
public void Should_return_status_ok_when_route_exists()
{
// Given
var bootstrapper = new DefaultNancyBootstrapper();
var browser = new Browser(bootstrapper);
// When
var result = browser.Get("/", with =>
{
with.HttpRequest();
});
// Then
Assert.AreEqual(HttpStatusCode.OK, result.StatusCode);
}
While browser variable was assigning, the exception threw in Nancy Bootstrapper Base class with follow stack trace
System.InvalidOperationException : Sequence contains more than one element
at System.Linq.Enumerable.SingleOrDefault(IEnumerable`1 source)
at Nancy.Bootstrapper.NancyBootstrapperBase`1.GetRootPathProvider() in NancyBootstrapperBase.cs: line 558
at Nancy.Bootstrapper.NancyBootstrapperBase`1.get_RootPathProvider() in NancyBootstrapperBase.cs: line 172
at Nancy.Bootstrapper.NancyBootstrapperBase`1.GetAdditionalInstances() in NancyBootstrapperBase.cs: line 514
at Nancy.Bootstrapper.NancyBootstrapperBase`1.Initialise() in NancyBootstrapperBase.cs: line 242
at Nancy.Testing.Browser..ctor(INancyBootstrapper bootstrapper) in Browser.cs: line 39
at Tests.Tests.Should_return_status_ok_when_route_exists() in Tests.cs: line 34
I've had the same problem recently. I was testing my bootstrapper by trying to resolve the Nancy module like this:
[Test]
public void PushModule_Is_Resolvable()
{
var pushModule = mUnderTest.GetModule(typeof (PushModule), new NancyContext());
Assert.That(pushModule, Is.Not.Null);
}
This yielded the exception described in the question. After reading Chris' answer I just configured that dll not to be copied to the output folder in Visual Studio:
Find the Nancy.Hosting.Self reference in the project that is tested.
Right-click the reference and choose "Properties".
Set Copy Local to false.
Clean and rebuild your solution.
This solved the issue for me.
I would have posted this as a comment to Chris' answer but since this is my very first post I can only post answers.
I've seen this with Nancy 0.16.1 on a fresh test assembly which references Nancy, Nancy.Testing and a project reference (in VS2010) to the main service assembly which contains my Modules.
The service assembly references Nancy.Hosting.Self.
The build for the test assembly pulls in Nancy.Hosting.Self.dll to the build folder and the test fails with the error you describe.
Removing the Hosting dll from the build folder by hand resolves the error and the test goes green e.g. delete MyTests\bin\Debug\Nancy.Hosting.Self.dll
I've experienced the same when testing with a project that refers to Nancy.Hosting.Self.
My workaround is to create a CustomBootstrapper and override RootPathProvider property.
class TestBootStrapper : DefaultNancyBootstrapper{
protected override IRootPathProvider RootPathProvider {
get {
return new FakeRootPathProvider();
}
}
}