I'm trying to setup Glass Mapper to generate my Sitecore items. I've followed every tutorial I could find, but receive this error when attempting to generate the code:
"Loading the include file 'Helpers.tt' returned a null or empty string. The transformation will not be run."
A file is generated but repeats the word "ErrorGeneratingOutput" over and over.
Screenshots:
As well as what Ehab has suggested, you may also have to remove the empty line at the end of GlassV3Header.tt otherwise you will get a error:
An error occured while generating code for item '/sitecore/templates'.
T4 Template: D:\Project\XYZ\TDS.Master\Code Generation Templates\GlassV3Item.tt
Errors:
Compiling transformation: Invalid token 'this' in class, struct, or interface member declaration
Compiling transformation: Method must have a return type
Compiling transformation: Type expected
Crytic, but deleting the extra line solves the issue.
Have you tried to click the unblock button in the properties window of the file?
Related
I am new to C++ and need some help with the following:
If i have no namespace this works fine as soon as i have this i get a error :
(active) E0109 expression preceding parentheses of apparent call must have (pointer-to-)
I am attaching a solution where i have implemented this code to show the error.
What i am tryng to achive is to use this map to call my menu options a user can select, it has a header file as well as the cpp implemtation file in it.
I have attached the source code with the error showing when trying to compile this.
I would greatly appreciate some help - sample attached done in visual studio Sample Code
https://www.dropbox.com/s/j5nkxabjah313wz/SampleMenu.zip?dl=0
I want to define a custom set of rules to be checked at compile time. But it seems not to work.
Example:
I choose one rule directly and I'll get the expected warning.
But when I instead create a custom ruleset containing the exact same rule then I won't get the expected warning.
What could be wrong?
Edit:
void f(std::string& i) {
std::string s = i;
cout << s;
}
int main()
{
std::string s ("abc");
f(s);
}
This gives me the expected warning Warnung C26460 The reference argument 'i' for function 'f' can be marked as const (con.3). in the first case.
Even if I create a custom ruleset including all available rules, I won't get any warnings.
Here you see me selecting the custom ruleset:
Edit: The ruleset action must change one time to enable it.
When I create a new ruleset containing only the const-checks then I will get a .ruleset that does not work and look like this:
In the ruleset editor it looks like this:
When I then change its action from Warning to Error:
Then the .ruleset gets additional lines for each test case:
When I change the action back to warning it looks like this:
Now it is working as expected.
I've been able to reproduce your error with Visual Studio 2017. I don't know exactly what I changed (or if I changed anything at all), but I am able to see the code analysis warning you expect with a custom rule set.
Things I would try:
Double check the Error List window is visible and not hiding somewhere.
Open the rule set file, change the Action to Error and then back to Warning and save it. I wouldn't expect this to be the problem but it's one of the things I did and after which I started seeing the Error List window.
I am trying to run a facedetection application and I get the following error:
Unexpected Standard exception from MEX file.
What() is:..\..\..\..\opencv\modules\core\src\persistence.cpp:2697: error: (-27)
NULL or empty buffer in function cvOpenFileStorage
If you're using haarcascade_frontalface_default.xml, check the xml file content.
The first 3 lines should be:
<?xml version="1.0"?>
<!--
Stump-based 24x24 discrete(?) adaboost frontal face detector.
I inadvertently downloaded the html that linked to the haarcascade_frontalface_default.xml file instead of the xml itself and got the same error you did.
You should provide some code and information.Nevertheless the error indicates that it can not access the haarcascade file. I suggest you make sure you have the "xml" in the same folder as your code (e.g. "ViewController.mm") and check permissions. additionally Assuming you are using Objective-c or swift:
1-check the file is in your Xcode project; and, if it is,
2-check it's included in the 'Copy Bundle Resources' phase underneath your selected Target (in the project tree view on the left in the normal Xcode window layout) and, if it is,
3-look inside the generated application bundle (find your product, right click, select 'Reveal in Finder', from Finder right click on the app and select 'Show Package Contents', then look for your file in there) to make sure that it's there.
I've got the same problem, and then I figure out what's the problem
First
Add file haarcascade_frontalface_default.xml to xcode project
make sure when you add the xml file with option below:
Destination: Copy items if need [check]
Added Folder: Create Folder References [check]
Add to targets: Your Project target [check]
Second
in you Wrapper.mm file add this code to your obj-c function:
const NSString* cascadePath = [[NSBundle mainBundle]pathForResource:#"haarcascade_frontalface_default" ofType:#"xml"];
or in case you wanna load the xml file, use this code:
cv::CascadeClassifier classifier;
const NSString* cascadePath = [[NSBundle mainBundle]pathForResource:#"haarcascade_frontalface_default" ofType:#"xml"];
classifier.load([cascadePath UTF8String]);
this actually fixes my problem, anywaythis question has been questioned for a long time but I hope someone face this problem can come to this answer and help them solve their problem like mine, cheer.
I'm trying to create my RKEntityMapping outside of my UnitTest. The problem I have is it only works if I create it inside my test. For example, this works:
RKEntityMapping *accountListMapping = [RKEntityMapping mappingForEntityForName:#"CustomerListResponse" inManagedObjectStore:_sut.managedObjectStore];
[accountListMapping addAttributeMappingsFromDictionary:#{#"count": #"pageCount",
#"page": #"currentPage",
#"pages": #"pages"}];
While the following does now work. The all to accoutListMapping returns exactly what is shown above using the same managed object store:
RKEntityMapping *accountListMapping = [_sut accountListMapping];
When the RKEntityMapping is created in _sut I get this error:
<unknown>:0: error: -[SBAccountTests testAccountListFetch] : 0x9e9cd10: failed with error:
Error Domain=org.restkit.RestKit.ErrorDomain Code=1007 "Cannot perform a mapping operation
with a nil destination object." UserInfo=0x8c64490 {NSLocalizedDescription=Cannot perform
a mapping operation with a nil destination object.}
I'm assuming the nil destination object it is referring to is destinationObject:nil.
RKMappingTest *maptest = [RKMappingTest testForMapping:accountListMapping
sourceObject:_parsedJSON
destinationObject:nil];
Make sure that the file you have created has a target membership of both your main target, and your test target. You can find this by:
clicking on the .m file of your class
open the utilities toolbar (the one on the right)
in the target membership section tick both targets.
This is because if your class does not have target membership to your test target, the test target actually creates a copy of the class that you have created, meaning it has a different binary file to the main target. This leads to that class using the test's version of the RestKit binary, rather than the main projects RestKit. This will lead to the isKindOfClass method failing when it tries to see if the mapping you have passed is of type RKObjectMapping from the main project, because it is of type RKObjectMapping from the test projects version of RestKit, so your mapping doesn't get used, and you get your crash.
At least this is my understanding of how the LLVM compiler works. I'm new to iOS dev so please feel free to correct if I got something wrong.
This problem may also be caused by duplicated class definitions, when including RestKit components for multiple targets individually when using Cocoapods.
For more information on this have a look at this answer.
I used a category on the Mapped object for example
RestKitMappings+SomeClass
+ (RKObjectMapping*)responsemappings {
return mappings;
}
now this category has to be included in the test target as well otherwise the mapping will not be passed.
When you're running a test you aren't using the entire mapping infrastructure, so RestKit isn't going to create a destination object for you. It's only going to test the mapping itself. So you need to provide all three pieces of information to the test method or it can't work.
I've written a unit test for a map which has XML as the source and a flat file schema as the target.
I can set the "TestMap Output" property of the map to XML or native. When I then right-click the map in solution explorer and select Test Map, it works great, I get either an XML file or a flat file depending in the value I selected for the "TestMap Output" property. In both cases all expected fields are populated with the correct value from the input XML document.
My problem comes when I execute a unit test using the TestMap method of the class Microsoft.BizTalk.TestTools.Mapper.TestableMapBase. I am getting the error "Object reference not set to an instance of an object", here is the stack trace:
at Microsoft.BizTalk.TOM.CXSDSchemaTree.CreateNativeInstance(String strXMLInstFileName, String strNativeInstanceOutputFileName, InstanceGenerationOptions options, ITOMErrorInfo[]& errInstanceCreationErrors)
at Microsoft.BizTalk.TOM.CXSDSchemaTree.CreateNativeInstanceFromXMLInstance(String strXMLInstFileName, String strNativeInstFileName, ITOMErrorInfo[]& errInstCreationErrors)
at Microsoft.BizTalk.TestTools.Mapper.TestableMapBase.TestMap(String inputInstanceFilename, InputInstanceType inputType, String outputInstanceFilename, OutputInstanceType outputType)
at x.Int.WMS.Testing.Unit.UnitTests.FromAx.UnitTest_CanonicalCustomer_2_MLS_MRE.CallMap(TestableMapBase target) in C:\Development\x.Int.WMS\Dev\V1.0\Src\Solutions\WMS\x.Int.WMS.Testing.Unit\UnitTests\FromCanonical\UnitTest_CanonicalCustomer_2_MLS_MRE.cs:line 68
at x.Int.WMS.Testing.Unit.UnitTests.FromAx.UnitTest_CanonicalCustomer_2_MLS_MRE.SetupTest() in C:\Development\x.Int.WMS\Dev\V1.0\Src\Solutions\WMS\x.Int.WMS.Testing.Unit\UnitTests\FromCanonical\UnitTest_CanonicalCustomer_2_MLS_MRE.cs:line 33
at x.Int.WMS.Testing.Unit.UnitTests.FromAx.UnitTest_CanonicalCustomer_2_MLS_MRE.RecordID_IsMapped() in C:\Development\x.Int.WMS\Dev\V1.0\Src\Solutions\WMS\x.Int.WMS.Testing.Unit\UnitTests\FromCanonical\UnitTest_CanonicalCustomer_2_MLS_MRE.cs:line 45
Any ideas?
Problem was caused by old assembly in the GAC.