APSIMInitiative / ApsimX

ApsimX is the next generation of APSIM
http://www.apsim.info
Other
132 stars 161 forks source link

'Experiment' object does not show the list of factorial experiments #3766

Closed BrianCollinss closed 5 years ago

BrianCollinss commented 5 years ago

When I select an Experiment object, it does not show the list of the combinations of factors anymore and I get this error:

Method not found: 'Void Gtk.Builder.Autoconnect(System.Object)'.

image

hol430 commented 5 years ago

I wonder if apsim has found the wrong version of gtk-sharp.dll. In the visual studio debug output window, there should be a line like this:

'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\gtk-sharp\v4.0_2.12.0.0__35e10195dab3c99f\gtk-sharp.dll'. Symbol loading disabled by Include/Exclude setting.

You can search for 'gtk-sharp' (without the quotes) in the output window. What does this line say for you? If you can't find it, just paste the entire contents of the output window and I'll have a look.

BrianCollinss commented 5 years ago

'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\gtk-sharp\v4.0_2.12.0.0__35e10195dab3c99f\gtk-sharp.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

hol430 commented 5 years ago

Yep, that's the line I was thinking of. What happens if you rename that file:

C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\gtk-sharp\v4.0_2.12.0.0__35e10195dab3c99f\gtk-sharp.dll

e.g. rename it to gtk-sharp.dll.bak. Apsim might then use the gtk-sharp.dll which we copy into the bin directory.

BrianCollinss commented 5 years ago

I got this exception:

System.MissingMethodException occurred
  HResult=0x80131513
  Message=Method not found: 'Void GLib.Log.Write(System.String, GLib.LogLevelFlags, System.String, System.Object[])'.
  Source=<Cannot evaluate the exception source>
  StackTrace:
   at Gtk.Application.AssertMainThread()
   at Gtk.Settings.SetLongProperty(String name, Int64 v_long, String origin)
   at UserInterface.UserInterface.Main(String[] args) in C:\Users\uqbababa\UQ\07_Repository\ApsimNextGen\ApsimX\ApsimNG\Main.cs:line 18
hol430 commented 5 years ago

Have you copied the files from DeploymentSupport/Windows/Bin64/ into Bin/?

BrianCollinss commented 5 years ago

Yes. I didn't change anything. Just updated to the latest commit.

hol430 commented 5 years ago

Can you find this line again in your output window? Where is it finding the dll now that you have renamed the old one?

C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\gtk-sharp\v4.0_2.12.0.0__35e10195dab3c99f\gtk-sharp.dll
BrianCollinss commented 5 years ago

When I rename that file, I got that exception. Without renaming: 'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\gtk-sharp\v4.0_2.12.0.0__35e10195dab3c99f\gtk-sharp.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

And the whole output:

'ApsimNG.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ApsimNG.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\uqbababa\UQ\07_Repository\ApsimNextGen\ApsimX\Bin\ApsimNG.exe'. Symbols loaded.
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\Users\uqbababa\UQ\07_Repository\ApsimNextGen\ApsimX\Bin\Models.exe'. Symbols loaded.
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\gtk-sharp\v4.0_2.12.0.0__35e10195dab3c99f\gtk-sharp.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\glib-sharp\v4.0_2.12.0.0__35e10195dab3c99f\glib-sharp.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\atk-sharp\v4.0_2.12.0.0__35e10195dab3c99f\atk-sharp.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\gdk-sharp\v4.0_2.12.0.0__35e10195dab3c99f\gdk-sharp.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\pango-sharp\v4.0_2.12.0.0__35e10195dab3c99f\pango-sharp.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\Users\uqbababa\UQ\07_Repository\ApsimNextGen\ApsimX\Bin\APSIM.Shared.dll'. Symbols loaded.
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'Microsoft.GeneratedCode'. 
hol430 commented 5 years ago

@hol353 out of curiosity, what does this line of code do? This line seems to have appeared during the recent refactor of experiment view, but none of the other views which use glade files seem to call this method.

builder.Autoconnect(this);
hol430 commented 5 years ago

@BenAbabaei did you rename or move that gtk-sharp.dll? We don't want a file called gtk-sharp.dll to exist in that folder, but .net still seems to be finding a file there.

BrianCollinss commented 5 years ago

@hol430 When I rename that file, I got this exception:

System.MissingMethodException occurred
  HResult=0x80131513
  Message=Method not found: 'Void GLib.Log.Write(System.String, GLib.LogLevelFlags, System.String, System.Object[])'.
  Source=<Cannot evaluate the exception source>
  StackTrace:
   at Gtk.Application.AssertMainThread()
   at Gtk.Settings.SetLongProperty(String name, Int64 v_long, String origin)
   at UserInterface.UserInterface.Main(String[] args) in C:\Users\uqbababa\UQ\07_Repository\ApsimNextGen\ApsimX\ApsimNG\Main.cs:line 18
hol430 commented 5 years ago

What was in the debug output window when you get that exception?

BrianCollinss commented 5 years ago
'ApsimNG.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ApsimNG.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\uqbababa\UQ\07_Repository\ApsimNextGen\ApsimX\Bin\ApsimNG.exe'. Symbols loaded.
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\Users\uqbababa\UQ\07_Repository\ApsimNextGen\ApsimX\Bin\Models.exe'. Symbols loaded.
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\Users\uqbababa\UQ\07_Repository\ApsimNextGen\ApsimX\Bin\gtk-sharp.dll'. Module was built without symbols.
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\glib-sharp\v4.0_2.12.0.0__35e10195dab3c99f\glib-sharp.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\atk-sharp\v4.0_2.12.0.0__35e10195dab3c99f\atk-sharp.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\gdk-sharp\v4.0_2.12.0.0__35e10195dab3c99f\gdk-sharp.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Exception thrown: 'System.MissingMethodException' in gtk-sharp.dll
An unhandled exception of type 'System.MissingMethodException' occurred in gtk-sharp.dll
Method not found: 'Void GLib.Log.Write(System.String, GLib.LogLevelFlags, System.String, System.Object[])'.
hol430 commented 5 years ago

Can you move or rename those other files as well?

C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\glib-sharp\v4.0_2.12.0.0__35e10195dab3c99f\glib-sharp.dll
C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\atk-sharp\v4.0_2.12.0.0__35e10195dab3c99f\atk-sharp.dll
C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\gdk-sharp\v4.0_2.12.0.0__35e10195dab3c99f\gdk-sharp.dll

If this doesn't work, I think I'll just see if I can remove that line of code from the experiment view which was causing you problems in the first place.

BrianCollinss commented 5 years ago

I did. When I open the interface and try to load an APSIM file (no matter which one), the interface is closed without an exception. Should I change the file names back? Am I the only one that has trouble?

'ApsimNG.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ApsimNG.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\uqbababa\UQ\07_Repository\ApsimNextGen\ApsimX\Bin\ApsimNG.exe'. Symbols loaded.
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\Users\uqbababa\UQ\07_Repository\ApsimNextGen\ApsimX\Bin\Models.exe'. Symbols loaded.
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\Users\uqbababa\UQ\07_Repository\ApsimNextGen\ApsimX\Bin\gtk-sharp.dll'. Module was built without symbols.
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\Users\uqbababa\UQ\07_Repository\ApsimNextGen\ApsimX\Bin\glib-sharp.dll'. Module was built without symbols.
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\Users\uqbababa\UQ\07_Repository\ApsimNextGen\ApsimX\Bin\atk-sharp.dll'. Module was built without symbols.
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\Users\uqbababa\UQ\07_Repository\ApsimNextGen\ApsimX\Bin\gdk-sharp.dll'. Module was built without symbols.
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'Anonymously Hosted DynamicMethods Assembly'. 
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\pango-sharp\v4.0_2.12.0.0__35e10195dab3c99f\pango-sharp.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\Users\uqbababa\UQ\07_Repository\ApsimNextGen\ApsimX\Bin\APSIM.Shared.dll'. Symbols loaded.
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ApsimNG.exe' (CLR v4.0.30319: ApsimNG.exe): Loaded 'Microsoft.GeneratedCode'. 
hol430 commented 5 years ago

Immediately after it crashes, there should be a file ApsimX/Bin/errors.txt. Can you paste the contents of this file? Apsim deletes this whenever it starts up, so you will need to check it immediately after apsim crashes.

If you can't find the errors.txt then yeah, change those dll filenames back to the way they were, and I'll just remove this line of code (or wrap it in a try-catch at the very least).

BrianCollinss commented 5 years ago

Yeah, I searched for it before your comment. There is no such a file in Bin. Sorry.

hol430 commented 5 years ago

No worries. I'm not sure why you're getting the missing method exception. It seems like the easiest solution will be to remove the call to the missing method, as I'm pretty sure it's not needed in any case.

You'll probably need to reset those .dll filenames. That should get apsim (mostly!) working again.

zur003 commented 5 years ago

Get rid of the call to AutoConnect. I remember having this problem when I was first setting up Gtk stuff. AutoConnect can be used to automatically connect Gtk# objects with controls, but it's much safer to use GetObject to explicitly make these associations. It's a problem because only relatively recent versions of version 2 Gtk# support this call (version 3 would be a different story). Many people will already have Gtk# DLLs in their assembly caches, and if they have a slightly older version that gets pulled in, you'll see this error.