UrhoSharp "System.InvalidOperationException: 'The application is not configured yet'"

Hi, i'll try to explain shortly.

Console application from scratch, only next code:

namespace UrhoSharpTest
{
    class Program
    {
        static void Main(string[] args)
        {
            new Urho.SimpleApplication(null).Run();
        }
    }
}

Urho surface window appears ok, exiting with "X" close button ok, closing with escape key launch next error:

"System.InvalidOperationException: 'The application is not configured yet'"

Working with Windows 10 x64, Visual Studio Community 2017, Nuget UrhoSharp 1.9.67 (All updated)

Thank you.

Answers

  • LandLuLandLu Member, Xamarin Team Xamurai

    Why do you want to test that on a console application?
    You can check the sample here: https://github.com/xamarin/urho-samples

  • zinczinc ESMember ✭✭

    Hi LandLu,
    i was trying to start coding an app from minimal source code, no winforms nor wpf etc. letting engine to initialize only necessary resources to run an urho app.

    Note:
    With the code shown above, when i call SimpleApplication.Exit() the app shows same error message.

    Thank you.

  • utekaiutekai USMember ✭✭✭

    I thought the SimpleApplication class was added for Xamarin Workbooks.

    There are a number of workbook samples https://github.com/xamarin/Workbooks/tree/master/graphics/urhosharp

    You could always start with a working sample and strip it down bare, and the workbooks run nicely on windows.

  • utekaiutekai USMember ✭✭✭
    edited January 10

    Plus those samples contain a lot of useful details that I've found anywhere else regarding development with Urho3D.

    And most start out with a blank Simple Application, as shown: https://github.com/xamarin/Workbooks/blob/master/graphics/urhosharp/compound-shapes/CreatingUrhoCompoundShapes.workbook/index.workbook

  • zinczinc ESMember ✭✭

    Well, if SimpleApplication is the problem, then watch at this:

    Program.cs:

    namespace MinimalConsoleAppTest
    {
        class Program
        {
            static void Main(string[] args)
            {
                new TestApp(null).Run();
            }
        }
    }
    

    MinimalConsoleAppTest.cs

    using Urho;
    
    namespace MinimalConsoleAppTest
    {
        internal class TestApp : Application
        {
            public TestApp(ApplicationOptions options) : base(options) { }
    
            protected override void Start()
            {
                base.Start();
                Input.KeyUp += (args) => { if (args.Key == Key.Esc) Exit(); };
            }
        }
    }
    

    Same behaviour, if i click on "X" window button closes ok, when i press Escape and the event raises, same error:

    "System.InvalidOperationException: 'The application is not configured yet'"

    The question is, i'm doing something wrong? Perhaps i miss some kind of project configuration?

    This is only a test project, on my real project, although is working well, the same unwanted error is present calling Exit().

    Thank you.

  • utekaiutekai USMember ✭✭✭

    Maybe try x86?

  • utekaiutekai USMember ✭✭✭
    edited January 12

    Or sending in options in the initialization.
    new ApplicationOptions("Data")

    The workbook samples are easy to run.

    https://github.com/xamarin/Workbooks/blob/master/graphics/urhosharp/coordinates/ExploringUrhoCoordinates.workbook/index.workbook#exploring-urho-coordinates

  • lahellerlaheller USMember ✭✭

    For me this is working well:

    using System;
    using Urho;
    using Urho.Shapes;
    
    namespace UrhoConsoleAppTest
    {
        class Program
        {
            static void Main(string[] args)
            {
                Application.UnhandledException += (s1, e1) => {
                    Console.WriteLine(e1.Exception.ToString());
                    e1.Handled = true;
                };
    
                Application.Started += () => {
                    if (Application.HasCurrent)
                    {
                        var app = Application.Current as SimpleApplication;
                        app.Viewport.SetClearColor(Color.Black);
                        app.Viewport.RenderPath.Append(CoreAssets.PostProcess.FXAA2);
                        var box = app.RootNode.GetOrCreateComponent<Box>();
                        box.Material = Material.FromColor(Color.Green);
                        box.Material.LineAntiAlias = true;
                    }
                };
    
                Application.Stopped += () => {
                    Console.WriteLine("Application has stopped...");
                };
    
                var app1 = Application.CreateInstance<SimpleApplication>(new ApplicationOptions() { Width = 1280, Height = 800 });
                app1.Run();
            }
        }
    }
    
  • zinczinc ESMember ✭✭

    @laheller said:
    For me this is working well:

    using System;
    using Urho;
    using Urho.Shapes;
    
    namespace UrhoConsoleAppTest
    {
        class Program
        {
            static void Main(string[] args)
            {
                Application.UnhandledException += (s1, e1) => {
                    Console.WriteLine(e1.Exception.ToString());
                    e1.Handled = true;
                };
    
                Application.Started += () => {
                    if (Application.HasCurrent)
                    {
                        var app = Application.Current as SimpleApplication;
                        app.Viewport.SetClearColor(Color.Black);
                        app.Viewport.RenderPath.Append(CoreAssets.PostProcess.FXAA2);
                        var box = app.RootNode.GetOrCreateComponent<Box>();
                        box.Material = Material.FromColor(Color.Green);
                        box.Material.LineAntiAlias = true;
                    }
                };
    
                Application.Stopped += () => {
                    Console.WriteLine("Application has stopped...");
                };
    
                var app1 = Application.CreateInstance<SimpleApplication>(new ApplicationOptions() { Width = 1280, Height = 800 });
                app1.Run();
            }
        }
    }
    

    Good example, but same error on exit for me, yes i know, capturing exception is a solution (already using in my real project) but i think this is not the best option to undestand what i am doing bad.

    Remembering, original question is, what is bad in my simple example that is launching the error on exit?.

    Changing project to x86 nor adding Data folder and assigning in ApplicationOptions not working for me. Already tested in my real project before asking for the error here.

    Thank you all for your suggestions, but any is working for me.

    (Continue the path of searcher, coder's torture :) )

  • lahellerlaheller USMember ✭✭

    @zinc another thing you can try to add older version of UrhoSharp nuget package to your project instead of the current v1.9.67.

  • zinczinc ESMember ✭✭

    @laheller said:
    @zinc another thing you can try to add older version of UrhoSharp nuget package to your project instead of the current v1.9.67.

    Ok i'll try it as soon as possible, thank you.

  • zinczinc ESMember ✭✭

    Well, downgrading to 1.8.93 the error dissappears..
    Can be this considered as a release bug?
    Must be marked the @laheller answer as solved, or let unresolved to notify developers?
    Thank you all for your suggestions.

    Best regards.

  • lahellerlaheller USMember ✭✭
    > @zinc said:
    > Well, downgrading to 1.8.93 the error dissappears..
    > Can be this considered as a release bug?
    > Must be marked the @laheller answer as solved, or let unresolved to notify developers?
    > Thank you all for your suggestions.
    >
    > Best regards.

    @zinc
    If it solved your problem then just mark it as solved.
  • lahellerlaheller USMember ✭✭
    @EgorBo
    Maybe this is an issue with the latest release of UrhoSharp.
Sign In or Register to comment.