QutEcoacoustics / audio-analysis

The audio analysis code (AnalysisPrograms.exe) for the QUT Ecoacoustics Research Group
https://ap.qut.ecoacoustics.info/
Apache License 2.0
52 stars 12 forks source link

Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Cannot convert type `YamlDotNet.Dynamic.DynamicYaml' to `double' #30

Closed cofiem closed 7 years ago

cofiem commented 9 years ago
ubuntu@worker-1:~/bioacoustics/workers/worker-dummy/AP$ mono --debug "/home/ubuntu/bioacoustics/workers/worker-dummy/AP/AnalysisPrograms.exe" audio2csv /source:"/home/ubuntu/bioacoustics/workers/worker-dummy/_original_audio/5d/5d6280ce-0f64-4f0c-9628-c2c10d57d959_100815-1200.mp3" /config:"/home/ubuntu/bioacoustics/workers/worker-dummy/AP/ConfigFiles/Towsey.Acoustic.yml" /tempdir:"/home/ubuntu/bioacoustics/workers/worker-dummy/tmp/5d6280ce-0f64-4_2014_11_20t05_30_50z" /output:"/home/ubuntu/bioacoustics/workers/worker-dummy/_cached_analysis_jobs/5d/5d6280ce-0f64-4f0c-9628-c2c10d57d959"
QUT Bioacoustic Analysis Program - version 14.11.0.0 (DEBUG build, 11/16/2014 10:42 PM) 
Copyright QUT 2014
Do you wish to debug? Attach now or press [Y] to attach. Press any key other key to continue.
# PROCESS LONG RECORDING
# DATE AND TIME: 11/20/2014 7:38:07 AM
# Recording file:      5d6280ce-0f64-4f0c-9628-c2c10d57d959_100815-1200.mp3
# Configuration file:  /home/ubuntu/bioacoustics/workers/worker-dummy/AP/ConfigFiles/Towsey.Acoustic.yml
# Output folder:       /home/ubuntu/bioacoustics/workers/worker-dummy/_cached_analysis_jobs/5d/5d6280ce-0f64-4f0c-9628-c2c10d57d959
# Temp File Directory: /home/ubuntu/bioacoustics/workers/worker-dummy/tmp/5d6280ce-0f64-4_2014_11_20t05_30_50z
[2014-11-20T07:38:07.1355220+00:00] WARN  - IndexProperties config can not be found! This will result in an excpetion if it is needed later on.
[2014-11-20T07:38:07.1438150+00:00] FATAL - Unhandled exception ->
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Cannot convert type `YamlDotNet.Dynamic.DynamicYaml' to `double'
at (wrapper dynamic-method) object.CallSite.Target (System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,object) <IL 0x000a2, 0x002ac>
at System.Dynamic.UpdateDelegates.UpdateAndExecute1<object, double> (System.Runtime.CompilerServices.CallSite,object) <IL 0x0012a, 0x00468>
at AnalysisPrograms.AnalyseLongRecordings.AnalyseLongRecording.Execute (AnalysisPrograms.AnalyseLongRecordings.AnalyseLongRecording/Arguments) [0x0064f] in c:\Work\GitHub\audio-analysis\AudioAnalysis\AnalysisPrograms\AnalyseLongRecordings\AnalyseLongRecording.cs:102
at (wrapper dynamic-method) object.CallSite.Target (System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,object,object) <IL 0x00052, 0x000d0>
at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid2<object, object> (System.Runtime.CompilerServices.CallSite,object,object) <0x00500>
at PowerArgs.ArgAction`1<AnalysisPrograms.Production.MainEntryArguments>.Invoke () <0x00484>
at AnalysisPrograms.MainEntry.Execute (PowerArgs.ArgAction`1<AnalysisPrograms.Production.MainEntryArguments>) [0x00055] in c:\Work\GitHub\audio-analysis\AudioAnalysis\AnalysisPrograms\Production\MainEntryUtilities.cs:173
at AnalysisPrograms.MainEntry.Main (string[]) [0x0005e] in c:\Work\GitHub\audio-analysis\AudioAnalysis\AnalysisPrograms\MainEntry.cs:44
cofiem commented 9 years ago

Problems line seems to be here: https://github.com/QutBioacoustics/audio-analysis/blob/master/AudioAnalysis/AnalysisPrograms/AnalyseLongRecordings/AnalyseLongRecording.cs#L102

cofiem commented 9 years ago
[2014-11-21T00:25:47.4428900+00:00] FATAL - Unhandled exception ->
System.InvalidCastException: The result type 'null' of the dynamic binding produced by the object with type 'YamlDotNet.Dynamic.DynamicYaml' for the binder 'Microsoft.CSharp.RuntimeBinder.CSharpConvertBinder' is not compatible with the result type 'System.Nullable`1[System.Double]' expected by the call site.
at (wrapper dynamic-method) object.CallSite.Target (System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,object) <IL 0x0008d, 0x002b6>
at (wrapper delegate-invoke) <Module>.invoke_bound_Nullable`1<double>_Closure_CallSite_object (System.Runtime.CompilerServices.CallSite,object) <IL 0x0003f, 0x00060>
at System.Dynamic.UpdateDelegates.UpdateAndExecute1<object, System.Nullable`1<double>> (System.Runtime.CompilerServices.CallSite,object) <IL 0x0012a, 0x0054d>
at (wrapper delegate-invoke) System.Func`3<System.Runtime.CompilerServices.CallSite, object, System.Nullable`1<double>>.invoke_TResult_T1_T2 (System.Runtime.CompilerServices.CallSite,object) <IL 0x00054, 0x000a1>
at AnalysisPrograms.AnalyseLongRecordings.AnalyseLongRecording.Execute (AnalysisPrograms.AnalyseLongRecordings.AnalyseLongRecording/Arguments) [0x004f5] in c:\Work\Github\audio-analysis\AudioAnalysis\AnalysisPrograms\AnalyseLongRecordings\AnalyseLongRecording.cs:100
at (wrapper dynamic-method) object.CallSite.Target (System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,object,object) <IL 0x00052, 0x000d0>
at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid2<object, object> (System.Runtime.CompilerServices.CallSite,object,object) <0x00500>
at PowerArgs.ArgAction`1<AnalysisPrograms.Production.MainEntryArguments>.Invoke () <0x00484>
at AnalysisPrograms.MainEntry.Execute (PowerArgs.ArgAction`1<AnalysisPrograms.Production.MainEntryArguments>) [0x00045] in c:\Work\Github\audio-analysis\AudioAnalysis\AnalysisPrograms\Production\MainEntryUtilities.cs:173
at AnalysisPrograms.MainEntry.Main (string[]) [0x00058] in c:\Work\Github\audio-analysis\AudioAnalysis\AnalysisPrograms\MainEntry.cs:44
atruskie commented 9 years ago

Looks like there is a problem with mono's support for casting. TODO: write a repo / submit an issue to YamlDotNet.Dynamic

cofiem commented 9 years ago

Results of YamlDotNet.Dynamic tests on mono:

ubuntu@worker-1:~/bioacoustics/yaml-tests$ mono ./xunit/xunit.console.clr4.exe ./YamlDotNet.Dynamic/YamlDotNet.Dynamic.Test/bin/Debug/YamlDotNet.Dynamic.Test.dll 
xUnit.net console test runner (64-bit .NET 4.0.30319.17020)
Copyright (C) 2013 Outercurve Foundation.

xunit.dll:     Version 1.9.1.1600
Test assembly: /home/ubuntu/bioacoustics/yaml-tests/YamlDotNet.Dynamic/YamlDotNet.Dynamic.Test/bin/Debug/YamlDotNet.Dynamic.Test.dll

YamlDotNet.Dynamic.Test.DynamicYamlTest.TestDynamicYamlIsSerializeable [FAIL]
   System.Runtime.Serialization.SerializationException : Type YamlDotNet.RepresentationModel.YamlSequenceNode is not marked as Serializable.
   Stack Trace:
     at System.Runtime.Serialization.Formatters.Binary.BinaryCommon.CheckSerializable (System.Type type, ISurrogateSelector selector, StreamingContext context) [0x00000] in <filename unknown>:0 
     at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteValue (System.IO.BinaryWriter writer, System.Type valueType, System.Object val) [0x00000] in <filename unknown>:0 
     at DynamicYaml__TypeMetadata.WriteObjectData (System.Runtime.Serialization.Formatters.Binary.ObjectWriter , System.IO.BinaryWriter , System.Object ) [0x00000] in <filename unknown>:0 
     at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteObject (System.IO.BinaryWriter writer, Int64 id, System.Object obj) [0x00000] in <filename unknown>:0 
     at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteObjectInstance (System.IO.BinaryWriter writer, System.Object obj, Boolean isValueObject) [0x00000] in <filename unknown>:0 
     at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteQueuedObjects (System.IO.BinaryWriter writer) [0x00000] in <filename unknown>:0 
     at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteObjectGraph (System.IO.BinaryWriter writer, System.Object obj, System.Runtime.Remoting.Messaging.Header[] headers) [0x00000] in <filename unknown>:0 
     at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize (System.IO.Stream serializationStream, System.Object graph, System.Runtime.Remoting.Messaging.Header[] headers) [0x00000] in <filename unknown>:0 
     at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize (System.IO.Stream serializationStream, System.Object graph) [0x00000] in <filename unknown>:0 
     at (wrapper dynamic-method) object:CallSite.Target (System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,System.Runtime.Serialization.Formatters.Binary.BinaryFormatter,System.IO.MemoryStream,object)
     at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid3[BinaryFormatter,MemoryStream,Object] (System.Runtime.CompilerServices.CallSite site, System.Runtime.Serialization.Formatters.Binary.BinaryFormatter arg0, System.IO.MemoryStream arg1, System.Object arg2) [0x00000] in <filename unknown>:0 
     at YamlDotNet.Dynamic.Test.DynamicYamlTest.TestDynamicYamlIsSerializeable () [0x00000] in <filename unknown>:0 
     at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
     at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0

YamlDotNet.Dynamic.Test.DynamicYamlTest.TestNonexistingMember [FAIL]
   System.InvalidCastException : The result type 'null' of the dynamic binding produced by the object with type 'YamlDotNet.Dynamic.DynamicYaml' for the binder 'Microsoft.CSharp.RuntimeBinder.CSharpConvertBinder' is not compatible with the result type 'System.String' expected by the call site.
   Stack Trace:
     at (wrapper dynamic-method) object:CallSite.Target (System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,object)
     at System.Dynamic.UpdateDelegates.UpdateAndExecute1[Object,String] (System.Runtime.CompilerServices.CallSite site, System.Object arg0) [0x00000] in <filename unknown>:0 
     at YamlDotNet.Dynamic.Test.DynamicYamlTest.TestNonexistingMember () [0x00000] in <filename unknown>:0 
     at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
     at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0

18 total, 2 failed, 0 skipped, took 0.601 seconds
atruskie commented 9 years ago

This code is related and causing exceptions if the specified key is not found in the YAML

https://github.com/QutBioacoustics/audio-analysis/blob/master/AudioAnalysis/AnalysisPrograms/AnalyseLongRecordings/AnalyseLongRecording.cs#L102

atruskie commented 7 years ago

Closing as this never got fixed (Dynamic.Yaml is now unsupported, and we're planning to move away from using Dynamic for config files).