Open mirogrg1 opened 6 years ago
@mirogrg1 , did you find what was causing the problem? I just tried to include Gorilla Player in one of our projects and I'm stuck with this error.
@salgiza I can't exactly remember but the error was only happening on pages that were using strings from App.Resources.resx file. Then I think I played around with that file and changed the AppResources class to be public. You can do that by right clicking on AppResources.resx file and selecting PublicResXFileCodeGenerator for CustomTool property.
I did reset my emulator a few times at the time but not sure if that was part of the solution.
Yep, it definitely has something to do with the translations, but I don't know why.
This is my Gorilla.json file:
{
"navigationPage": {
"all": true
},
"localization": {
"markupExtension": {
"name": "TranslateExtension",
"namespace": "MyApp.Helpers",
"assembly": "MyApp",
"keyPropertyName": "Text"
},
"resources": {
"resourceId": "MyApp.Resources.MyAppStrings",
"assembly": "MyApp",
"defaultCulture": "es"
}
}
}
If configured as that, I get the "Cannot read property 'project' of undefined" error. If I change the name of the markupExtension tag into something different (such as "xxx"), the error goes away, and the TranslateExtension actually is applied (so I get the translations, which is not bad), but it would be nice to be able to use the option to change between Translations in Gorilla Player.
I tried to play with the resx and downloaded the project in a Windows machine to be update the designer.cs file (I'm using Visual Studio for Mac, so I don't have a resx editor), but it did little difference.
Any ideas?
FWIW, I'm using the TranslateExtension as defined in the Xamarin docs:
using System; using System.Reflection; using System.Resources; using Xamarin.Forms; using Xamarin.Forms.Xaml;
namespace MyApp.Helpers
{
[ContentProperty("Text")]
public class TranslateExtension : IMarkupExtension
{
const string ResourceId = "MyApp.Resources.MyAppStrings";
private static readonly Lazy<ResourceManager> ResMgr = new Lazy<ResourceManager>(() => new ResourceManager(ResourceId, typeof(TranslateExtension).GetTypeInfo().Assembly));
public string Text { get; set; }
public object ProvideValue(IServiceProvider serviceProvider)
{
if (Text == null)
return "";
ResourceManager resmgr = new ResourceManager(ResourceId, typeof(TranslateExtension).GetTypeInfo().Assembly);
var translation = resmgr.GetString(Text, Warehouse.Settings.ActiveCultureInfo);
if (translation == null)
{
translation = Text;
}
return translation;
}
}
}
How about your DesignTimeData.son file? Does it have all the data for the page you're previewing?
Did you find the solution for this. I am facing the same problem.
@thegeox On my part, I finally gave up on using Gorilla Player. This was just one of several issues when trying to use it in a pre-existing project.
I'm waiting for Hot Reload to be released, to see if we have a bit more luck with that.
I keep getting this on any XAML page. I didn't have issues before with the same pages. Not sure changed but the logs are a bit cryptic:
{"processingIssue":true,"issueType":"error","position":null,"area":"Xaml","scope":"Req","error":{"name":"TypeError","message":"Cannot read property 'project' of undefined","stack":"TypeError: Cannot read property 'project' of undefined\n at Object.result.collectLanguages (C:\Users\MirosHPLaptop\AppData\Local\Programs\Gorilla Player\1.2.2\resources\DependencyManager.js.jx:1472:35)\n at Object.result.processResxUsage (C:\Users\MirosHPLaptop\AppData\Local\Programs\Gorilla Player\1.2.2\resources\DependencyManager.js.jx:1409:71)\n at Object.result.processXamlObject (C:\Users\MirosHPLaptop\AppData\Local\Programs\Gorilla Player\1.2.2\resources\DependencyManager.js.jx:194:33)\n at Object. (C:\Users\MirosHPLaptop\AppData\Local\Programs\Gorilla Player\1.2.2\resources\DependencyManager.js.jx:140:26)\n at Object. (C:\Users\MirosHPLaptop\AppData\Local\Programs\Gorilla Player\1.2.2\resources\XamlStore.js.jx:34:25)\n at Object.tryCatcher (C:\Users\MirosHPLaptop\AppData\Local\Programs\Gorilla Player\1.2.2\resources\node_modules\bluebird\js\main\util.js.jx:25:23)\n at Promise._settlePromiseFromHandler (C:\Users\MirosHPLaptop\AppData\Local\Programs\Gorilla Player\1.2.2\resources\node_modules\bluebird\js\main\promise.js.jx:509:31)\n at Promise._settlePromiseAt (C:\Users\MirosHPLaptop\AppData\Local\Programs\Gorilla Player\1.2.2\resources\node_modules\bluebird\js\main\promise.js.jx:583:18)\n at Async._drainQueue (C:\Users\MirosHPLaptop\AppData\Local\Programs\Gorilla Player\1.2.2\resources\node_modules\bluebird\js\main\async.js.jx:127:12)\n at Async._drainQueues (C:\Users\MirosHPLaptop\AppData\Local\Programs\Gorilla Player\1.2.2\resources\node_modules\bluebird\js\main\async.js.jx:132:10)\n at Async.drainQueues (C:\Users\MirosHPLaptop\AppData\Local\Programs\Gorilla Player\1.2.2\resources\node_modules\bluebird\js\main\async.js.jx:14:14)\n at process._tickCallback (node.js:803:1)"},"contextInstanceId":8,"targetId":4,"sampleDataId":2,"level":"error","message":"Xaml processing error Summary:\"Error loading DashboardWithImagesPage.xaml (Target XAML).\"; Message:\"Error occurred while loading C:\Users\MirosHPLaptop\Source\Repos\Trellise\Trellise\Trellise\Views\Dashboards\DashboardWithImagesPage.xaml (error message: Cannot read property 'project' of undefined).\"","timestamp":"2018-08-05T15:34:13.782Z"}