My app is crashing at this line of code :
await Task.Run(() =>
{
bytes = page.AsPNG(72);
});
My code :
public async Task<string> GetBitmaps(string filePath)
{
//TODO -- WORK ON THIS
PdfRenderer pdfRenderer = new PdfRenderer(GetSeekableFileDescriptor(filePath));
var appDirectory = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments);
string fileName = System.IO.Path.GetFileNameWithoutExtension(filePath);
string directoryPath = System.IO.Path.Combine(appDirectory, "thumbnailsTemp", System.IO.Path.GetFileNameWithoutExtension(fileName));
var stream = new MemoryStream();
using (Stream resourceStream = new FileStream(filePath, FileMode.Open))
{
resourceStream.CopyTo(stream);
}
for (int i = 0; i < pdfRenderer.PageCount; i++)
{
TallComponents.PDF.Rasterizer.Page page = new TallComponents.PDF.Rasterizer.Page(stream, i);
byte[] bytes = null;
await Task.Run(() =>
{
bytes = page.AsPNG(72);
});
using (FileStream output = new FileStream(System.IO.Path.Combine(directoryPath, fileName + "Thumbnails" + i + ".png"), FileMode.Create, FileAccess.Write))
{
output.Write(bytes, 0, bytes.Length);
}
}
return directoryPath;
}
I tried to use Device.BeginInvokeOnMainThread but the page.AsPNG(dpi) method doesn't handle await.
Update
Here is the output message when Task.run is running :
And 1 min later if have the message : "pdf.android isn't responding".
03-13 20:46:19.862 D/Mono ( 4972): Loading reference 7 of
/storage/emulated/0/Android/data/com.companyname.pdf/files/.override/TallComponents.PDF.Rasterizer.dll
asmctx DEFAULT, looking for System.Collections, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 03-13 20:46:19.863
D/Mono ( 4972): Image addref System.Collections[0xc69869c0] (asmctx
DEFAULT) -> System.Collections.dll[0xc91e0200]: 2 03-13 20:46:19.863
D/Mono ( 4972): Prepared to set up assembly 'System.Collections'
(System.Collections.dll) 03-13 20:46:19.863 D/Mono ( 4972):
Assembly System.Collections[0xc69869c0] added to domain RootDomain,
ref_count=1 03-13 20:46:19.863 D/Mono ( 4972): AOT: image
'System.Collections.dll.so' not found: dlopen failed: library
"System.Collections.dll.so" not found 03-13 20:46:19.864 D/Mono (
4972): AOT: image
'/Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/sdks/out/android-x86-release/lib/mono/aot-cache/x86/System.Collections.dll.so'
not found: (null) 03-13 20:46:19.864 D/Mono ( 4972): Config
attempting to parse: 'System.Collections.dll.config'. 03-13
20:46:19.864 D/Mono ( 4972): Config attempting to parse:
'/Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/sdks/out/android-x86-release/etc/mono/assemblies/System.Collections/System.Collections.config'.
03-13 20:46:19.864 D/Mono ( 4972): Assembly Ref addref
TallComponents.PDF.Rasterizer[0xe9ccb780] ->
System.Collections[0xc69869c0]: 2 03-13 20:46:19.864 D/Mono (
4972): Loading reference 0 of System.Collections.dll asmctx DEFAULT,
looking for mscorlib, Version=2.0.5.0, Culture=neutral,
PublicKeyToken=7cec85d7bea7798e 03-13 20:46:19.864 D/Mono ( 4972):
Assembly Ref addref System.Collections[0xc69869c0] ->
mscorlib[0xe9ccb420]: 53 03-13 20:46:19.864 D/Mono ( 4972): Loading
reference 6 of
/storage/emulated/0/Android/data/com.companyname.pdf/files/.override/TallComponents.PDF.Rasterizer.dll
asmctx DEFAULT, looking for System.Globalization, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 03-13 20:46:19.864
D/Mono ( 4972): Image addref System.Globalization[0xc6986960]
(asmctx DEFAULT) -> System.Globalization.dll[0xc91e1600]: 2 03-13
20:46:19.865 D/Mono ( 4972): Prepared to set up assembly
'System.Globalization' (System.Globalization.dll) 03-13 20:46:19.865
D/Mono ( 4972): Assembly System.Globalization[0xc6986960] added to
domain RootDomain, ref_count=1 03-13 20:46:19.865 D/Mono ( 4972):
AOT: image 'System.Globalization.dll.so' not found: dlopen failed:
library "System.Globalization.dll.so" not found 03-13 20:46:19.865
D/Mono ( 4972): AOT: image
'/Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/sdks/out/android-x86-release/lib/mono/aot-cache/x86/System.Globalization.dll.so'
not found: (null) 03-13 20:46:19.865 D/Mono ( 4972): Config
attempting to parse: 'System.Globalization.dll.config'. 03-13
20:46:19.865 D/Mono ( 4972): Config attempting to parse:
'/Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/sdks/out/android-x86-release/etc/mono/assemblies/System.Globalization/System.Globalization.config'.
03-13 20:46:19.865 D/Mono ( 4972): Assembly Ref addref
TallComponents.PDF.Rasterizer[0xe9ccb780] ->
System.Globalization[0xc6986960]: 2 03-13 20:46:19.866 D/Mono (
4972): Loading reference 0 of System.Globalization.dll asmctx DEFAULT,
looking for mscorlib, Version=2.0.5.0, Culture=neutral,
PublicKeyToken=7cec85d7bea7798e 03-13 20:46:19.866 D/Mono ( 4972):
Assembly Ref addref System.Globalization[0xc6986960] ->
mscorlib[0xe9ccb420]: 54 Loaded assembly: System.Collections.dll
[External] Loaded assembly: System.Globalization.dll [External] 03-13
20:46:19.888 D/Mono ( 4972): Loading reference 4 of
/storage/emulated/0/Android/data/com.companyname.pdf/files/.override/TallComponents.PDF.Rasterizer.dll
asmctx DEFAULT, looking for System.Threading, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 03-13 20:46:19.888
D/Mono ( 4972): Image addref System.Threading[0xc6986900] (asmctx
DEFAULT) -> System.Threading.dll[0xc91e1b00]: 2 03-13 20:46:19.888
D/Mono ( 4972): Prepared to set up assembly 'System.Threading'
(System.Threading.dll) 03-13 20:46:19.888 D/Mono ( 4972): Assembly
System.Threading[0xc6986900] added to domain RootDomain, ref_count=1
03-13 20:46:19.889 D/Mono ( 4972): AOT: image
'System.Threading.dll.so' not found: dlopen failed: library
"System.Threading.dll.so" not found 03-13 20:46:19.889 D/Mono (
4972): AOT: image
'/Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/sdks/out/android-x86-release/lib/mono/aot-cache/x86/System.Threading.dll.so'
not found: (null) 03-13 20:46:19.889 D/Mono ( 4972): Config
attempting to parse: 'System.Threading.dll.config'. 03-13 20:46:19.889
D/Mono ( 4972): Config attempting to parse:
'/Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/sdks/out/android-x86-release/etc/mono/assemblies/System.Threading/System.Threading.config'.
03-13 20:46:19.889 D/Mono ( 4972): Assembly Ref addref
TallComponents.PDF.Rasterizer[0xe9ccb780] ->
System.Threading[0xc6986900]: 2 03-13 20:46:19.889 D/Mono ( 4972):
Loading reference 0 of System.Threading.dll asmctx DEFAULT, looking
for mscorlib, Version=2.0.5.0, Culture=neutral,
PublicKeyToken=7cec85d7bea7798e 03-13 20:46:19.890 D/Mono ( 4972):
Assembly Ref addref System.Threading[0xc6986900] ->
mscorlib[0xe9ccb420]: 55 03-13 20:46:19.890 D/Mono ( 4972): Loading
reference 8 of
/storage/emulated/0/Android/data/com.companyname.pdf/files/.override/TallComponents.PDF.Rasterizer.dll
asmctx DEFAULT, looking for System.Text.Encoding, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 03-13 20:46:19.890
D/Mono ( 4972): Image addref System.Text.Encoding[0xc69868a0]
(asmctx DEFAULT) -> System.Text.Encoding.dll[0xc76c5000]: 2 03-13
20:46:19.890 D/Mono ( 4972): Prepared to set up assembly
'System.Text.Encoding' (System.Text.Encoding.dll) 03-13 20:46:19.890
D/Mono ( 4972): Assembly System.Text.Encoding[0xc69868a0] added to
domain RootDomain, ref_count=1 Loaded assembly: System.Threading.dll
[External]03-13 20:46:19.890 D/Mono ( 4972): AOT: image
'System.Text.Encoding.dll.so' not found: dlopen failed: library
"System.Text.Encoding.dll.so" not found
03-13 20:46:19.891 D/Mono ( 4972): AOT: image
'/Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/sdks/out/android-x86-release/lib/mono/aot-cache/x86/System.Text.Encoding.dll.so'
not found: (null) 03-13 20:46:19.891 D/Mono ( 4972): Config
attempting to parse: 'System.Text.Encoding.dll.config'. 03-13
20:46:19.891 D/Mono ( 4972): Config attempting to parse:
'/Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/sdks/out/android-x86-release/etc/mono/assemblies/System.Text.Encoding/System.Text.Encoding.config'.
03-13 20:46:19.891 D/Mono ( 4972): Assembly Ref addref
TallComponents.PDF.Rasterizer[0xe9ccb780] ->
System.Text.Encoding[0xc69868a0]: 2 03-13 20:46:19.891 D/Mono (
4972): Loading reference 0 of System.Text.Encoding.dll asmctx DEFAULT,
looking for mscorlib, Version=2.0.5.0, Culture=neutral,
PublicKeyToken=7cec85d7bea7798e 03-13 20:46:19.891 D/Mono ( 4972):
Assembly Ref addref System.Text.Encoding[0xc69868a0] ->
mscorlib[0xe9ccb420]: 56 Loaded assembly: System.Text.Encoding.dll
[External] 03-13 20:46:20.007 D/Mono ( 4972): Loading reference 5
of
/storage/emulated/0/Android/data/com.companyname.pdf/files/.override/TallComponents.PDF.Rasterizer.dll
asmctx DEFAULT, looking for System.Runtime.Extensions,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
03-13 20:46:20.007 D/Mono ( 4972): Image addref
System.Runtime.Extensions[0xc6986c60] (asmctx DEFAULT) ->
System.Runtime.Extensions.dll[0xc76c6400]: 2 03-13 20:46:20.007 D/Mono
( 4972): Prepared to set up assembly 'System.Runtime.Extensions'
(System.Runtime.Extensions.dll) 03-13 20:46:20.007 D/Mono ( 4972):
Assembly System.Runtime.Extensions[0xc6986c60] added to domain
RootDomain, ref_count=1 03-13 20:46:20.008 D/Mono ( 4972): AOT:
image 'System.Runtime.Extensions.dll.so' not found: dlopen failed:
library "System.Runtime.Extensions.dll.so" not found 03-13
20:46:20.008 D/Mono ( 4972): AOT: image
'/Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/sdks/out/android-x86-release/lib/mono/aot-cache/x86/System.Runtime.Extensions.dll.so'
not found: (null) 03-13 20:46:20.008 D/Mono ( 4972): Config
attempting to parse: 'System.Runtime.Extensions.dll.config'. 03-13
20:46:20.008 D/Mono ( 4972): Config attempting to parse:
'/Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/sdks/out/android-x86-release/etc/mono/assemblies/System.Runtime.Extensions/System.Runtime.Extensions.config'.
03-13 20:46:20.008 D/Mono ( 4972): Assembly Ref addref
TallComponents.PDF.Rasterizer[0xe9ccb780] ->
System.Runtime.Extensions[0xc6986c60]: 2 03-13 20:46:20.008 D/Mono
( 4972): Loading reference 0 of System.Runtime.Extensions.dll asmctx
DEFAULT, looking for mscorlib, Version=2.0.5.0, Culture=neutral,
PublicKeyToken=7cec85d7bea7798e 03-13 20:46:20.008 D/Mono ( 4972):
Assembly Ref addref System.Runtime.Extensions[0xc6986c60] ->
mscorlib[0xe9ccb420]: 57 Loaded assembly:
System.Runtime.Extensions.dll [External] Thread started:
2 Thread started: #3 Thread started: #4 Thread started: #5 03-13 20:46:26.407 D/Mono ( 4972):
Loading reference 1 of
/storage/emulated/0/Android/data/com.companyname.pdf/files/.override/TallComponents.PDF.Rasterizer.dll
asmctx DEFAULT, looking for Mono.Android, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=84e04ff9cfb79065 03-13 20:46:26.407
D/Mono ( 4972): Assembly Ref addref
TallComponents.PDF.Rasterizer[0xe9ccb780] -> Mono.Android[0xe9cccd40]:
44 03-13 20:46:26.850 D/Mono ( 4972): DllImport searching in:
'Internal' ('(null)'). 03-13 20:46:26.850 D/Mono ( 4972):
Searching for 'java_interop_jnienv_new_byte_array'. 03-13 20:46:26.850
D/Mono ( 4972): Probing 'java_interop_jnienv_new_byte_array'. 03-13
20:46:26.850 D/Mono ( 4972): Found as
'java_interop_jnienv_new_byte_array'. 03-13 20:46:26.854 D/Mono (
4972): DllImport searching in: '__Internal' ('(null)'). 03-13
20:46:26.854 D/Mono ( 4972): Searching for
'java_interop_jnienv_set_byte_array_region'. 03-13 20:46:26.854 D/Mono
( 4972): Probing 'java_interop_jnienv_set_byte_array_region'. 03-13
20:46:26.854 D/Mono ( 4972): Found as
'java_interop_jnienv_set_byte_array_region'. 03-13 20:46:26.857 D/Mono
( 4972): DllImport searching in: '__Internal' ('(null)'). 03-13
20:46:26.857 D/Mono ( 4972): Searching for
'java_interop_jnienv_get_byte_array_region'. 03-13 20:46:26.857 D/Mono
( 4972): Probing 'java_interop_jnienv_get_byte_array_region'. 03-13
20:46:26.857 D/Mono ( 4972): Found as
'java_interop_jnienv_get_byte_array_region'. 03-13 20:46:27.053 D/skia
( 4972): --- Failed to create image decoder with message
'unimplemented' 03-13 20:46:27.127 I/companyname.pd( 4972): Explicit
concurrent copying GC freed 16071(4MB) AllocSpace objects, 2(100KB)
LOS objects, 50% free, 2MB/4MB, paused 639us total 6.952ms 03-13
20:46:27.131 D/Mono ( 4972): GC_TAR_BRIDGE bridges 369 objects 9865
opaque 2897 colors 364 colors-bridged 364 colors-visible 364 xref 8
cache-hit 0 cache-semihit 0 cache-miss 0 setup 0.03ms tarjan 1.13ms
scc-setup 0.05ms gather-xref 0.02ms xref-setup 0.02ms cleanup 1.70ms
03-13 20:46:27.131 D/Mono ( 4972): GC_BRIDGE: Complete, was running
for 12.47ms 03-13 20:46:27.131 D/Mono ( 4972): GC_MINOR: (Nursery
full) time 5.12ms, stw 6.23ms promoted 1312K major size: 2240K in use:
1560K los size: 3072K in use: 2386K 03-13 20:46:27.158 D/skia (
4972): --- Failed to create image decoder with message 'unimplemented'
03-13 20:46:27.187 D/Mono ( 4972): Loading reference 13 of
/storage/emulated/0/Android/data/com.companyname.pdf/files/.__override/TallComponents.PDF.Rasterizer.dll
asmctx DEFAULT, looking for System.Text.Encoding.Extensions,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
03-13 20:46:27.187 D/Mono ( 4972): Image addref
System.Text.Encoding.Extensions[0xe9d426e0] (asmctx DEFAULT) ->
System.Text.Encoding.Extensions.dll[0xc5db8900]: 2 03-13 20:46:27.187
D/Mono ( 4972): Prepared to set up assembly
'System.Text.Encoding.Extensions'
(System.Text.Encoding.Extensions.dll) Loaded assembly:
System.Text.Encoding.Extensions.dll [External]03-13 20:46:27.187
D/Mono ( 4972): Assembly
System.Text.Encoding.Extensions[0xe9d426e0] added to domain
RootDomain, ref_count=1
03-13 20:46:27.188 D/Mono ( 4972): AOT: image
'System.Text.Encoding.Extensions.dll.so' not found: dlopen failed:
library "System.Text.Encoding.Extensions.dll.so" not found 03-13
20:46:27.188 D/Mono ( 4972): AOT: image
'/Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/sdks/out/android-x86-release/lib/mono/aot-cache/x86/System.Text.Encoding.Extensions.dll.so'
not found: (null) 03-13 20:46:27.188 D/Mono ( 4972): Config
attempting to parse: 'System.Text.Encoding.Extensions.dll.config'.
03-13 20:46:27.188 D/Mono ( 4972): Config attempting to parse:
'/Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/sdks/out/android-x86-release/etc/mono/assemblies/System.Text.Encoding.Extensions/System.Text.Encoding.Extensions.config'.
03-13 20:46:27.189 D/Mono ( 4972): Assembly Ref addref
TallComponents.PDF.Rasterizer[0xe9ccb780] ->
System.Text.Encoding.Extensions[0xe9d426e0]: 2 03-13 20:46:27.189
D/Mono ( 4972): Loading reference 0 of
System.Text.Encoding.Extensions.dll asmctx DEFAULT, looking for
mscorlib, Version=2.0.5.0, Culture=neutral,
PublicKeyToken=7cec85d7bea7798e 03-13 20:46:27.189 D/Mono ( 4972):
Assembly Ref addref System.Text.Encoding.Extensions[0xe9d426e0] ->
mscorlib[0xe9ccb420]: 58 03-13 20:46:27.233 D/Mono ( 4972): Loading
reference 12 of
/storage/emulated/0/Android/data/com.companyname.pdf/files/.override/TallComponents.PDF.Rasterizer.dll
asmctx DEFAULT, looking for System.Reflection, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 03-13 20:46:27.233
D/Mono ( 4972): Image addref System.Reflection[0xe9d43640] (asmctx
DEFAULT) -> System.Reflection.dll[0xc76c9b00]: 2 03-13 20:46:27.233
D/Mono ( 4972): Prepared to set up assembly 'System.Reflection'
(System.Reflection.dll) 03-13 20:46:27.233 D/Mono ( 4972): Assembly
System.Reflection[0xe9d43640] added to domain RootDomain, ref_count=1
03-13 20:46:27.234 D/Mono ( 4972): AOT: image
'System.Reflection.dll.so' not found: dlopen failed: library
"System.Reflection.dll.so" not found 03-13 20:46:27.234 D/Mono (
4972): AOT: image
'/Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/sdks/out/android-x86-release/lib/mono/aot-cache/x86/System.Reflection.dll.so'
not found: (null) 03-13 20:46:27.234 D/Mono ( 4972): Config
attempting to parse: 'System.Reflection.dll.config'. 03-13
20:46:27.234 D/Mono ( 4972): Config attempting to parse:
'/Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/sdks/out/android-x86-release/etc/mono/assemblies/System.Reflection/System.Reflection.config'.
03-13 20:46:27.234 D/Mono ( 4972): Assembly Ref addref
TallComponents.PDF.Rasterizer[0xe9ccb780] ->
System.Reflection[0xe9d43640]: 2 03-13 20:46:27.234 D/Mono ( 4972):
Loading reference 0 of System.Reflection.dll asmctx DEFAULT, looking
for mscorlib, Version=2.0.5.0, Culture=neutral,
PublicKeyToken=7cec85d7bea7798e 03-13 20:46:27.234 D/Mono ( 4972):
Assembly Ref addref System.Reflection[0xe9d43640] ->
mscorlib[0xe9ccb420]: 59 Loaded assembly: System.Reflection.dll
[External] 03-13 20:46:27.513 I/companyname.pd( 4972): Explicit
concurrent copying GC freed 1556(87KB) AllocSpace objects, 2(6MB) LOS
objects, 50% free, 1997KB/3MB, paused 632us total 6.975ms 03-13
20:46:27.513 D/Mono ( 4972): GC_TAR_BRIDGE bridges 3 objects 3
opaque 0 colors 3 colors-bridged 3 colors-visible 3 xref 0 cache-hit 0
cache-semihit 0 cache-miss 0 setup 0.03ms tarjan 0.02ms scc-setup
0.02ms gather-xref 0.02ms xref-setup 0.02ms cleanup 0.16ms 03-13 20:46:27.513 D/Mono ( 4972): GC_BRIDGE: Complete, was running for
7.78ms 03-13 20:46:27.513 D/Mono ( 4972): GC_MINOR: (Concurrent start) time 1.03ms, stw 3.77ms promoted 126K major size: 2368K in use:
1719K los size: 16856K in use: 16154K 03-13 20:46:27.514 D/Mono (
4972): GC_MAJOR_CONCURRENT_START: (LOS overflow) 03-13 20:46:27.643
I/companyname.pd( 4972): Explicit concurrent copying GC freed
505(41KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 1971KB/3MB,
paused 627us total 6.512ms 03-13 20:46:27.644 D/Mono ( 4972):
GC_TAR_BRIDGE bridges 205 objects 1700 opaque 503 colors 200
colors-bridged 200 colors-visible 200 xref 6 cache-hit 0 cache-semihit
0 cache-miss 0 setup 0.03ms tarjan 0.46ms scc-setup 0.04ms gather-xref
0.02ms xref-setup 0.02ms cleanup 0.03ms 03-13 20:46:27.644 D/Mono ( 4972): GC_BRIDGE: Complete, was running for 8.50ms 03-13 20:46:27.644
D/Mono ( 4972): GC_MAJOR_CONCURRENT_FINISH: (finishing) time
131.48ms, stw 4.30ms los size: 2048K in use: 606K 03-13 20:46:27.644 D/Mono ( 4972): GC_MAJOR_SWEEP: major size: 2704K in use: 1634K
Thread finished: #4 Le thread 0x4 s'est arrêté avec le
code 0 (0x0). Thread finished: #5 Le thread 0x5 s'est
arrêté avec le code 0 (0x0). Thread finished: #3 Thread
started: #6 Thread started: #7 Le thread
0x3 s'est arrêté avec le code 0 (0x0). Thread finished:
2 Thread started: #8 Le thread 0x2 s'est arrêté avec le code 0 (0x0).
Related
I'm using Xamarin Forms 4.2.0 and utilizing Xamarin.Forms Shell. Pressing the back button seems to work find when navigating through the various screens in my app, however, when I press back to exit the app when debugging I get a NullReferenceException:
09-30 14:49:52.866 D/Mono ( 1085): Loading reference 10 of /storage/emulated/0/Android/data/com.companyname.agentconnectmobile/files/.__override__/Xamarin.Forms.Platform.Android.dll asmctx DEFAULT, looking for System.Runtime.Serialization, Version=2.0.5.0, Culture=neutral, PublicKeyToken=abc123
09-30 14:49:52.866 D/Mono ( 1085): Assembly Ref addref Xamarin.Forms.Platform.Android[0x799acc0e00] -> System.Runtime.Serialization[0x7935aa8d00]: 3
09-30 14:49:52.866 D/Mono ( 1085): Loading reference 1 of System.Runtime.Serialization.dll asmctx DEFAULT, looking for System.Xml, Version=2.0.5.0, Culture=neutral, PublicKeyToken=abc123
09-30 14:49:52.866 D/Mono ( 1085): Assembly Ref addref System.Runtime.Serialization[0x7935aa8d00] -> System.Xml[0x799be73480]: 5
09-30 14:49:52.918 D/Mono ( 1085): Loading reference 2 of System.Runtime.Serialization.dll asmctx DEFAULT, looking for System.ServiceModel.Internals, Version=0.0.0.0, Culture=neutral, PublicKeyToken=abc123
09-30 14:49:52.920 D/Mono ( 1085): Image addref System.ServiceModel.Internals[0x7937f9df00] (asmctx DEFAULT) -> System.ServiceModel.Internals.dll[0x7935889800]: 2
09-30 14:49:52.920 D/Mono ( 1085): Prepared to set up assembly 'System.ServiceModel.Internals' (System.ServiceModel.Internals.dll)
09-30 14:49:52.920 D/Mono ( 1085): Assembly System.ServiceModel.Internals[0x7937f9df00] added to domain RootDomain, ref_count=1
09-30 14:49:52.922 D/Mono ( 1085): AOT: image 'System.ServiceModel.Internals.dll.so' not found: dlopen failed: library "System.ServiceModel.Internals.dll.so" not found
09-30 14:49:52.923 D/Mono ( 1085): AOT: image '/Users/builder/jenkins/workspace/archive-mono/2019-06/android/release/sdks/out/android-arm64-v8a-release/lib/mono/aot-cache/arm64/System.ServiceModel.Internals.dll.so' not found: (null)
09-30 14:49:52.923 D/Mono ( 1085): Config attempting to parse: 'System.ServiceModel.Internals.dll.config'.
09-30 14:49:52.923 D/Mono ( 1085): Config attempting to parse: '/Users/builder/jenkins/workspace/archive-mono/2019-06/android/release/sdks/out/android-arm64-v8a-release/etc/mono/assemblies/System.ServiceModel.Internals/System.ServiceModel.Internals.config'.
09-30 14:49:52.923 D/Mono ( 1085): Assembly Ref addref System.Runtime.Serialization[0x7935aa8d00] -> System.ServiceModel.Internals[0x7937f9df00]: 2
09-30 14:49:52.923 D/Mono ( 1085): Loading reference 0 of System.ServiceModel.Internals.dll asmctx DEFAULT, looking for mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=abc123
09-30 14:49:52.923 D/Mono ( 1085): Assembly Ref addref System.ServiceModel.Internals[0x7937f9df00] -> mscorlib[0x7a3039be80]: 64
09-30 14:49:52.923 D/Mono ( 1085): Loading reference 2 of System.ServiceModel.Internals.dll asmctx DEFAULT, looking for System.Xml, Version=2.0.5.0, Culture=neutral, PublicKeyToken=abc123
09-30 14:49:52.924 D/Mono ( 1085): Assembly Ref addref System.ServiceModel.Internals[0x7937f9df00] -> System.Xml[0x799be73480]: 6
Loaded assembly: System.ServiceModel.Internals.dll [External]09-30 14:49:52.924 D/Mono ( 1085): Loading reference 3 of System.Runtime.Serialization.dll asmctx DEFAULT, looking for System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=abc123
09-30 14:49:52.924 D/Mono ( 1085): Assembly Ref addref System.Runtime.Serialization[0x7935aa8d00] -> System[0x799acd1580]: 10
09-30 14:49:52.998 D/Mono ( 1085): Loading reference 1 of System.Xml.dll asmctx DEFAULT, looking for System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=abc123
09-30 14:49:52.999 D/Mono ( 1085): Assembly Ref addref System.Xml[0x799be73480] -> System[0x799acd1580]: 11
09-30 14:49:53.099 D/Mono ( 1085): Loading reference 1 of System.ServiceModel.Internals.dll asmctx DEFAULT, looking for System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=abc123
09-30 14:49:53.100 D/Mono ( 1085): Assembly Ref addref System.ServiceModel.Internals[0x7937f9df00] -> System[0x799acd1580]: 12
09-30 14:49:53.145 D/Mono ( 1085): Loading reference 19 of /storage/emulated/0/Android/data/com.companyname.agentconnectmobile/files/.__override__/Xamarin.Forms.Platform.Android.dll asmctx DEFAULT, looking for System.Xml, Version=2.0.5.0, Culture=neutral, PublicKeyToken=abc123
09-30 14:49:53.146 D/Mono ( 1085): Assembly Ref addref Xamarin.Forms.Platform.Android[0x799acc0e00] -> System.Xml[0x799be73480]: 7
09-30 14:49:53.221 D/Mono ( 1085): DllImport searching in: 'libmono-native.so' ('./libmono-native.so').
09-30 14:49:53.221 D/Mono ( 1085): Searching for 'SystemNative_Unlink'.
09-30 14:49:53.221 D/Mono ( 1085): Probing 'SystemNative_Unlink'.
09-30 14:49:53.222 D/Mono ( 1085): Found as 'SystemNative_Unlink'.
09-30 14:49:53.279 D/Mono ( 1085): DllImport searching in: 'libmono-native.so' ('./libmono-native.so').
09-30 14:49:53.279 D/Mono ( 1085): Searching for 'SystemNative_LStat2'.
09-30 14:49:53.279 D/Mono ( 1085): Probing 'SystemNative_LStat2'.
09-30 14:49:53.279 D/Mono ( 1085): Found as 'SystemNative_LStat2'.
09-30 14:49:53.279 D/Mono ( 1085): DllImport searching in: 'libmono-native.so' ('./libmono-native.so').
09-30 14:49:53.279 D/Mono ( 1085): Searching for 'SystemNative_Rename'.
09-30 14:49:53.279 D/Mono ( 1085): Probing 'SystemNative_Rename'.
09-30 14:49:53.280 D/Mono ( 1085): Found as 'SystemNative_Rename'.
09-30 14:49:53.553 D/Mono ( 1085): DllImport searching in: 'libmono-native.so' ('./libmono-native.so').
09-30 14:49:53.553 D/Mono ( 1085): Searching for 'SystemNative_Link'.
09-30 14:49:53.553 D/Mono ( 1085): Probing 'SystemNative_Link'.
09-30 14:49:53.553 D/Mono ( 1085): Found as 'SystemNative_Link'.
09-30 14:49:53.563 D/Mono ( 1085): DllImport searching in: 'libmono-native.so' ('./libmono-native.so').
09-30 14:49:53.563 D/Mono ( 1085): Searching for 'SystemNative_Stat2'.
09-30 14:49:53.563 D/Mono ( 1085): Probing 'SystemNative_Stat2'.
09-30 14:49:53.563 D/Mono ( 1085): Found as 'SystemNative_Stat2'.
09-30 14:49:53.564 D/Mono ( 1085): DllImport searching in: 'libmono-native.so' ('./libmono-native.so').
09-30 14:49:53.564 D/Mono ( 1085): Searching for 'SystemNative_Symlink'.
09-30 14:49:53.564 D/Mono ( 1085): Probing 'SystemNative_Symlink'.
09-30 14:49:53.564 D/Mono ( 1085): Found as 'SystemNative_Symlink'.
09-30 14:49:53.588 W/com.companyname.agentconnectmobile( 1085): type=1400 audit(0.0:4414): avc: denied { link } for comm=54687265616420506F6F6C20576F72 name="PropertyStore.forms.tmp" dev="dm-6" ino=77573 scontext=u:r:untrusted_app_27:s0:c6,c257,c512,c768 tcontext=u:object_r:app_data_file:s0:c6,c257,c512,c768 tclass=file permissive=0
09-30 14:49:53.597 D/Mono ( 1085): DllImport searching in: 'libmono-native.so' ('./libmono-native.so').
09-30 14:49:53.598 D/Mono ( 1085): Searching for 'SystemNative_CopyFile'.
09-30 14:49:53.598 D/Mono ( 1085): Probing 'SystemNative_CopyFile'.
09-30 14:49:53.598 D/Mono ( 1085): Found as 'SystemNative_CopyFile'.
**System.NullReferenceException:** 'Object reference not set to an instance of an object.'
This is my first Xamarin application so I'm not sure if I am supposed to be handling exit on Android somehow? I haven't seen this issue on iOS.
EDIT: This NRE appears to be specific to a Xamarin.Forms 4.2 issue as shown in the answer.
Had a similar crash, now the issue seems to be that shell is pushing a null page into the NavStack in version 4.2.xxx and above which is very annoying but it is what it is. I was able to solve this btw by writing the following code in the OnBackButtonPressed of my Apps Shell class.
protected override bool OnBackButtonPressed()
{
if (Application.Current.MainPage.GetType() == typeof(AppShell) && Shell.Current.Navigation.NavigationStack.Where(x => x != null).Any())
{
return base.OnBackButtonPressed();
}
else
{
System.Diagnostics.Process.GetCurrentProcess().CloseMainWindow();
return true;
}
}
Where AppShell is my custom Shell class.
For the record, this has been identified in https://github.com/xamarin/Xamarin.Forms/issues/6640. The issue has been fixed in v4.3.0, but for those who are still using v4.2.0, the provided workaround is to
bypass the crash with the use of a custom renderer which dont null the shell in the dispose, like this.
[assembly: ExportRenderer(typeof(Shell), typeof(ShellRendererCustomDispose))]
namespace App.Droid.Renderers
{
public class ShellRendererCustomDispose : ShellRenderer
{
bool _disposed;
public ShellRendererCustomDispose(Context context)
: base(context)
{
}
protected override void Dispose(bool disposing)
{
if (_disposed)
{
return;
}
if (disposing)
{
Element.PropertyChanged -= OnElementPropertyChanged;
Element.SizeChanged -= (EventHandler)Delegate.CreateDelegate(typeof(EventHandler), this, "OnElementSizeChanged"); // OnElementSizeChanged is private, so use reflection
}
_disposed = true;
}
}
}
I am facing issue in Data load and merging of the table in Clickhouse 1.1.54343 and not able to insert any data in Clickhouse.
We have 3 node cluster and we add 300 columns to the tables in data ingestion and ingesting data from JSON files.
We were able to save data in the tables
Create Table
*-- Each Node*
CREATE TABLE IF NOT EXISTS AudiencePlanner.reached_pod
(
date Date,
p_id String,
language String,
city String,
state String,
platform String,
manufacturer String,
model String,
content_id String
) ENGINE = ReplicatedMergeTree('/clickhouse/tables/shard1/reached_pod', 'clickhouse1')
PARTITION BY date
ORDER BY (date, platform, language, city, state, manufacturer, model, content_id, p_id);
CREATE TABLE IF NOT EXISTS AudiencePlanner2.reached_pod
(
date Date,
p_id String,
language String,
city String,
state String,
platform String,
manufacturer String,
model String,
content_id String
) ENGINE = ReplicatedMergeTree('/clickhouse/tables/shard3/reached_pod', 'clickhouse1')
PARTITION BY date
ORDER BY (date, platform, language, city, state, manufacturer, model, content_id, p_id);
--- All Nodes
CREATE TABLE AudiencePlanner.reached_pod_all AS AudiencePlanner.reached_pod ENGINE = Distributed(test, '', reached_pod, rand());
Config.xml
<remote_servers>
<test>
<shard>
<weight>1</weight>
<internal_replication>false</internal_replication>
<replica>
<host>ip1</host>
<port>9000</port>
<default_database>AudiencePlanner</default_database>
<user>test</user>
<password>testpass</password>
</replica>
<replica>
<host>ip2</host>
<port>9000</port>
<default_database>AudiencePlanner2</default_database>
<user>test</user>
<password>testpass</password>
</replica>
</shard>
<shard>
<weight>1</weight>
<internal_replication>false</internal_replication>
<replica>
<host>ip2</host>
<port>9000</port>
<default_database>AudiencePlanner</default_database>
<user>test</user>
<password>testpass</password>
</replica>
<replica>
<host>ip3</host>
<port>9000</port>
<default_database>AudiencePlanner2</default_database>
<user>test</user>
<password>testpass</password>
</replica>
</shard>
<shard>
<weight>1</weight>
<internal_replication>false</internal_replication>
<replica>
<host>ip3</host>
<port>9000</port>
<default_database>AudiencePlanner</default_database>
<user>test</user>
<password>testpass</password>
</replica>
<replica>
<host>ip1</host>
<port>9000</port>
<default_database>AudiencePlanner2</default_database>
<user>test</user>
<password>testpass</password>
</replica>
</shard>
</dms>
</remote_servers>
Error log
2018.03.10 07:50:59.990953 [ 31 ] <Trace> AudiencePlanner.reached_pod (StorageReplicatedMergeTree): Executing log entry to merge parts 20180203_111_111_0, 20180203_112_112_0, 20180203_113_113_0 to 20180203_111_113_1
2018.03.10 07:50:59.991204 [ 31 ] <Debug> AudiencePlanner.reached_pod (Merger): Merging 3 parts: from 20180203_111_111_0 to 20180203_113_113_0 into tmp_merge_20180203_111_113_1
2018.03.10 07:50:59.996659 [ 31 ] <Debug> AudiencePlanner.reached_pod (Merger): Selected MergeAlgorithm: Horizontal
2018.03.10 07:50:59.997347 [ 31 ] <Trace> MergeTreeBlockInputStream: Reading 1 ranges from part 20180203_111_111_0, approx. 24576 rows starting from 0
2018.03.10 07:50:59.997417 [ 31 ] <Trace> MergeTreeBlockInputStream: Reading 1 ranges from part 20180203_112_112_0, approx. 8192 rows starting from 0
2018.03.10 07:50:59.997476 [ 31 ] <Trace> MergeTreeBlockInputStream: Reading 1 ranges from part 20180203_113_113_0, approx. 8192 rows starting from 0
2018.03.10 07:51:00.016479 [ 31 ] <Debug> MemoryTracker: Peak memory usage: 1.16 GiB.
2018.03.10 07:51:00.044547 [ 31 ] <Error> DB::StorageReplicatedMergeTree::queueTask()::<lambda(DB::StorageReplicatedMergeTree::LogEntryPtr&)>: Code: 76, e.displayText() =
DB::Exception: Cannot open file /data/clickhouse//data/AudiencePlanner/reached_pod/tmp_merge_20180203_111_113_1/%1F%EF%BF%BD%08%00%00%00%00%00%00%00%EF%BF%BDVrs%EF%BF%BDws%EF%BF%BDu%EF%BF%BDq%EF%BF%BD%0F%09%EF%BF%BD76%EF%BF%BD51P%EF%BF%BDQ%0A%0A%EF%BF%BDw%EF%BF%BDu%EF%BF%BD%EF%BF%BD%EF%BF%BD%EF%BF%BDw%042%0D%EF%BF%BD%0D%0C%0D%2D%EF%BF%BD%EF%BF%BD%08%EF%BF%BD%C6%A6%EF%BF%BD%26%26J%EF%BF%BD%00%EF%BF%BD%1C%EF%BF%BD%1E%3F%00%00%00.bin, errno: 36, strerror: File name too long, e.what() = DB::Exception, Stack trace:
0. /usr/bin/clickhouse-server(StackTrace::StackTrace()+0x15) [0x7317e35]
1. /usr/bin/clickhouse-server(DB::Exception::Exception(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)+0x1e) [0x19caa8e]
2. /usr/bin/clickhouse-server(DB::throwFromErrno(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, int)+0x1a4) [0x72ffea4]
3. /usr/bin/clickhouse-server(DB::WriteBufferFromFile::WriteBufferFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, int, unsigned int, char*, unsigned long)+0x1c5) [0x733d4a5]
4. /usr/bin/clickhouse-server(DB::createWriteBufferFromFileBase(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, unsigned long, unsigned long, int, unsigned int, char*, unsigned long)+0xac) [0x7345c9c]
5. /usr/bin/clickhouse-server(DB::IMergedBlockOutputStream::ColumnStream::ColumnStream(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, DB::CompressionSettings, unsigned long, unsigned long)+0x
I tried detaching the partition but still not able insert any other data, after detaching the error comes like
2018.03.10 09:00:27.299291 [ 9 ] <Error> reached_pod_all.Distributed.DirectoryMonitor: Code: 76, e.displayText() =
DB::Exception: Received from ip1:9000. DB::Exception: Cannot open file /data/clickhouse//data/AudiencePlanner/reached_pod/tmp_insert_20180207_21_21_0/%1F%EF%BF%BD%08%00%00%00%00%00%00%00%EF%BF%BDVrs%EF%BF%BDws%EF%BF%BDu%EF%BF%BDq%EF%BF%BD%0F%09%EF%BF%BD76%EF%BF%BD51P%EF%BF%BDQ%0A%0A%EF%BF%BDw%EF%BF%BDu%EF%BF%BD%EF%BF%BD%EF%BF%BD%EF%BF%BDw%042%0D%EF%BF%BD%0D%0C%0D%2D%EF%BF%BD%EF%BF%BD%08%EF%BF%BD%C6%A6%EF%BF%BD%26%26J%EF%BF%BD%00%EF%BF%BD%1C%EF%BF%BD%1E%3F%00%00%00.bin, errno: 36, strerror: File name too long. Stack trace:
0. /usr/bin/clickhouse-server(StackTrace::StackTrace()+0x15) [0x7317e35]
1. /usr/bin/clickhouse-server(DB::Exception::Exception(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)+0x1e) [0x19caa8e]
2. /usr/bin/clickhouse-server(DB::throwFromErrno(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, int)+0x1a4) [0x72ffea4]
3. /usr/bin/clickhouse-server(DB::WriteBufferFromFile::WriteBufferFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, int, unsigned int, char*, unsigned long)+0x1c5) [0x733d4a5]
4. /usr/bin/clickhouse-server(DB::createWriteBufferFromFileBase(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, unsigned long, unsigned long, int, unsigned int, char*, unsigned long)+0xac) [0x7345c9c]
5. /usr/bin/clickhouse-server(DB::IMergedBlockOutputStream::ColumnStream::ColumnStream(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, DB::CompressionSettings, unsigned long, unsigned long)+0xcc) [0x68cd7ac]
6. /usr/bin/clickhouse-server() [0x68ce674]
Please help me in identifying and resolving the issue.
I found a solution for my problem, it was due to number of columns that we were adding dynamically around 1000 of column.
Due to number of columns the filename created long string which gave error in writing in filename.
I reduced the number of columns to be inserted and i was able to write the data.
I am writing a page in Xamarin that displays a YouTube search using the YouTube Data API. It compiles fine but when I run it on my Android device it freezes and after awhile prompts to quit the application because it's not responding. I think it has something to do with establsihing the YouTubeService object.
This basically calls the data API and loads 50 of the videos for the given search term into the listview
private async Task Run()
{
videoList.Clear();
var youtubeService = new YouTubeService(new BaseClientService.Initializer()
{
ApiKey = DEVELOPER_KEY,
ApplicationName = "Xamarin-Basics"
});
var searchListRequest = youtubeService.Search.List("snippet");
searchListRequest.Q = "mkbhd";
searchListRequest.MaxResults = 50;
var searchListResponse = await searchListRequest.ExecuteAsync();
foreach(var searchResult in searchListResponse.Items)
{
if (searchResult.Id.Kind.Equals("youtube#video"))
{
videoList.Add(new VideoInfo(searchResult.Snippet.Title, searchResult.Snippet.Description));
}
}
}
Also, here is the stack trace which appears to be running the operation in the thread over and over again:
09-15 20:31:21.352 D/Mono ( 6831): Assembly Ref addref Newtonsoft.Json[0xb72c8210] -> System.Linq.Expressions[0xb72e98a0]: 3
Loaded assembly: Anonymously Hosted DynamicMethods Assembly [External]
09-15 20:31:21.562 D/Mono ( 6831): Assembly Ref addref Google.Apis.YouTube.v3[0xb72c7310] -> Newtonsoft.Json[0xb72c8210]: 4
09-15 20:31:22.127 D/Mono ( 6831): DllImport searching in: '__Internal' ('(null)').
09-15 20:31:22.127 D/Mono ( 6831): Searching for 'CloseZStream'.
09-15 20:31:22.127 D/Mono ( 6831): Probing 'CloseZStream'.
09-15 20:31:22.127 D/Mono ( 6831): Found as 'CloseZStream'.
09-15 20:31:31.950 D/Mono ( 6831): [0xb76fa5b0] worker finishing
Thread finished: <Thread Pool> #3
The thread 'Unknown' (0x3) has exited with code 0 (0x0).
09-15 20:31:57.148 D/Mono ( 6831): [0xb808e9b8] worker finishing
Thread finished: <Thread Pool> #7
The thread 'Unknown' (0x7) has exited with code 0 (0x0).
09-15 20:32:04.446 D/Mono ( 6831): [0xb77219d8] worker finishing
Thread finished: <Thread Pool> #4
The thread 'Unknown' (0x4) has exited with code 0 (0x0).
Thread finished: <Thread Pool> #2
The thread 'Unknown' (0x2) has exited with code 0 (0x0).
09-15 20:32:49.051 D/Mono ( 6831): [0xb808de40] worker finishing
Thread finished: <Thread Pool> #8
The thread 'Unknown' (0x8) has exited with code 0 (0x0).
Thread started: <Thread Pool> #11
Thread started: <Thread Pool> #12
09-15 20:32:59.725 D/Mono ( 6831): [0xb81d8738] worker starting
09-15 20:33:30.573 D/Mono ( 6831): [0xb81d8738] worker finishing
Thread finished: <Thread Pool> #12
The thread 'Unknown' (0xc) has exited with code 0 (0x0).
09-15 20:33:46.394 D/Mono ( 6831): [0xb80a4790] worker finishing
Thread finished: <Thread Pool> #9
The thread 'Unknown' (0x9) has exited with code 0 (0x0).
Thread finished: <Thread Pool> #11
The thread 'Unknown' (0xb) has exited with code 0 (0x0).
Thread started: <Thread Pool> #13
Thread started: <Thread Pool> #14
09-15 20:34:39.731 D/Mono ( 6831): [0xb81d8738] worker starting
Thread started: <Thread Pool> #15
09-15 20:34:39.749 D/Mono ( 6831): [0xb84d0f60] worker starting
09-15 20:34:52.494 D/Mono ( 6831): [0xb84d0f60] worker finishing
Thread finished: <Thread Pool> #15
The thread 'Unknown' (0xf) has exited with code 0 (0x0).
Your code looks basically right. I am assuming you are using the latest v3 api:
Google.Apis.YouTube.v3" version="1.16.0.582"
I would try wrapping the whole routine in a try/catch just to make sure that you are not getting a 403 or other access/auth error:
Xamarin.Android example:
try
{
var youtubeService = new YouTubeService(new BaseClientService.Initializer()
{
ApiKey = DEVELOPER_KEY,
ApplicationName = "com.sushihangover.youtubeapi",
});
var searchListRequest = youtubeService.Search.List("snippet");
searchListRequest.Q = "StackOverflow";
searchListRequest.MaxResults = 50;
var searchListResponse = await searchListRequest.ExecuteAsync();
foreach (var searchResult in searchListResponse.Items)
{
if (searchResult.Id.Kind.Equals("youtube#video"))
{
Console.WriteLine(searchResult.Snippet.Title);
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
I'm trying to build a project with openCV, but I'm getting the following errors:
1>------ Build started: Project: ZERO_CHECK, Configuration: Debug Win32 ------
1> Checking Build System
1> CMake does not need to re-run because C:/Users/Kevin/ROBOSLAM/build/CMakeFiles/generate.stamp is up-to-date.
1> CMake does not need to re-run because C:/Users/Kevin/ROBOSLAM/build/examples/CMakeFiles/generate.stamp is up-to-date.
1> CMake does not need to re-run because C:/Users/Kevin/ROBOSLAM/build/examples/opencv/CMakeFiles/generate.stamp is up-to-date.
2>------ Build started: Project: ratslam, Configuration: Debug Win32 ------
3>------ Build started: Project: ratslam_graphics, Configuration: Debug Win32 ------
3> Building Custom Rule C:/Users/Kevin/ROBOSLAM/CMakeLists.txt
3> CMake does not need to re-run because C:\Users\Kevin\ROBOSLAM\build\CMakeFiles\generate.stamp is up-to-date.
3> RatslamGraphics.cpp
2> Building Custom Rule C:/Users/Kevin/ROBOSLAM/CMakeLists.txt
2> CMake does not need to re-run because C:\Users\Kevin\ROBOSLAM\build\CMakeFiles\generate.stamp is up-to-date.
2> Experience_Map.cpp
2> Pose_Cell_Network.cpp
3> Creating library C:/Users/Kevin/ROBOSLAM/build/Debug/ratslam_graphics.lib and object C:/Users/Kevin/ROBOSLAM/build/Debug/ratslam_graphics.exp
3>RatslamGraphics.obj : error LNK2019: unresolved external symbol "public: __thiscall cv::Exception::Exception(int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int)" (??0Exception#cv##QAE#HABV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##00H#Z) referenced in function "public: __thiscall cv::Mat::Mat(int,int,int,void *,unsigned int)" (??0Mat#cv##QAE#HHHPAXI#Z)
3>RatslamGraphics.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall cv::Exception::~Exception(void)" (??1Exception#cv##UAE#XZ) referenced in function "public: __thiscall cv::Mat::Mat(int,int,int,void *,unsigned int)" (??0Mat#cv##QAE#HHHPAXI#Z)
3>RatslamGraphics.obj : error LNK2019: unresolved external symbol "void __cdecl cv::error(class cv::Exception const &)" (?error#cv##YAXABVException#1##Z) referenced in function "public: __thiscall cv::Mat::Mat(int,int,int,void *,unsigned int)" (??0Mat#cv##QAE#HHHPAXI#Z)
3>RatslamGraphics.obj : error LNK2019: unresolved external symbol "void __cdecl cv::fastFree(void *)" (?fastFree#cv##YAXPAX#Z) referenced in function "public: __thiscall cv::Mat::~Mat(void)" (??1Mat#cv##QAE#XZ)
3>RatslamGraphics.obj : error LNK2019: unresolved external symbol "public: void __thiscall cv::Mat::deallocate(void)" (?deallocate#Mat#cv##QAEXXZ) referenced in function "public: void __thiscall cv::Mat::release(void)" (?release#Mat#cv##QAEXXZ)
3>RatslamGraphics.obj : error LNK2019: unresolved external symbol "public: __thiscall cv::VideoWriter::VideoWriter(void)" (??0VideoWriter#cv##QAE#XZ) referenced in function "public: __thiscall ratslam::RatslamGraphics::RatslamGraphics(class boost::property_tree::basic_ptree<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > &,class irr::IEventReceiver *,class ratslam::Ratslam *)" (??0RatslamGraphics#ratslam##QAE#AAV?$basic_ptree#V?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##V12#U?$less#V?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std###2##property_tree#boost##PAVIEventReceiver#irr##PAVRatslam#1##Z)
3>C:\Users\Kevin\ROBOSLAM\build\Debug\ratslam_graphics.dll : fatal error LNK1120: 6 unresolved externals
2>..\src\ratslam\Pose_Cell_Network.cpp(716): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
2> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\stdio.h(218) : see declaration of 'fopen'
2> Visual_Template_Match.cpp
2>..\src\ratslam\Visual_Template_Match.cpp(127): warning C4018: '<' : signed/unsigned mismatch
2> Ratslam.cpp
2> Generating Code...
2>c:\users\kevin\roboslam\src\ratslam\experience_map.cpp(277): warning C4715: 'ratslam::Experience_Map::dijkstra_distance_between_experiences' : not all control paths return a value
2> Creating library C:/Users/Kevin/ROBOSLAM/build/Debug/ratslam.lib and object C:/Users/Kevin/ROBOSLAM/build/Debug/ratslam.exp
2> ratslam.vcxproj -> C:\Users\Kevin\ROBOSLAM\build\Debug\ratslam.dll
4>------ Build started: Project: ratslam_opencv_example, Configuration: Debug Win32 ------
4> Building Custom Rule C:/Users/Kevin/ROBOSLAM/examples/opencv/CMakeLists.txt
4> CMake does not need to re-run because C:\Users\Kevin\ROBOSLAM\build\examples\opencv\CMakeFiles\generate.stamp is up-to-date.
4> main.cpp
4>C:\Users\Kevin\ROBOSLAM\libraries\OpenCV2.3\build\include\opencv2/flann/logger.h(70): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
4> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\stdio.h(218) : see declaration of 'fopen'
4>..\..\..\examples\opencv\main.cpp(97): warning C4101: 'time_s' : unreferenced local variable
4>..\..\..\examples\opencv\main.cpp(97): warning C4101: 'last_time_s' : unreferenced local variable
4> Creating library C:/Users/Kevin/ROBOSLAM/build/examples/opencv/Debug/ratslam_opencv_example.lib and object C:/Users/Kevin/ROBOSLAM/build/examples/opencv/Debug/ratslam_opencv_example.exp
4>main.obj : error LNK2019: unresolved external symbol "void __cdecl cv::fastFree(void *)" (?fastFree#cv##YAXPAX#Z) referenced in function "public: __thiscall cv::Mat::~Mat(void)" (??1Mat#cv##QAE#XZ)
4>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall cv::Mat::deallocate(void)" (?deallocate#Mat#cv##QAEXXZ) referenced in function "public: void __thiscall cv::Mat::release(void)" (?release#Mat#cv##QAEXXZ)
4>main.obj : error LNK2019: unresolved external symbol "public: __thiscall cv::VideoCapture::VideoCapture(void)" (??0VideoCapture#cv##QAE#XZ) referenced in function _main
4>main.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall cv::VideoCapture::~VideoCapture(void)" (??1VideoCapture#cv##UAE#XZ) referenced in function _main
4>main.obj : error LNK2019: unresolved external symbol "public: virtual bool __thiscall cv::VideoCapture::open(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?open#VideoCapture#cv##UAE_NABV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std###Z) referenced in function _main
4>main.obj : error LNK2019: unresolved external symbol "public: virtual bool __thiscall cv::VideoCapture::isOpened(void)const " (?isOpened#VideoCapture#cv##UBE_NXZ) referenced in function _main
4>main.obj : error LNK2019: unresolved external symbol "public: virtual bool __thiscall cv::VideoCapture::grab(void)" (?grab#VideoCapture#cv##UAE_NXZ) referenced in function _main
4>main.obj : error LNK2019: unresolved external symbol "public: virtual bool __thiscall cv::VideoCapture::retrieve(class cv::Mat &,int)" (?retrieve#VideoCapture#cv##UAE_NAAVMat#2#H#Z) referenced in function _main
4>C:\Users\Kevin\ROBOSLAM\build\examples\opencv\Debug\ratslam_opencv_example.exe : fatal error LNK1120: 8 unresolved externals
5>------ Skipped Build: Project: ALL_BUILD, Configuration: Debug Win32 ------
5>Project not selected to build for this solution configuration
========== Build: 2 succeeded, 2 failed, 0 up-to-date, 1 skipped ==========
I'm using a cMake file to create the project, and it's contents are as so:
cmake_minimum_required(VERSION 2.8)
project(ratslam)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
file(GLOB RATSLAM_INCLUDES src/ratslam/*.h src/ratslam/*.hpp)
file(GLOB RATSLAM_GRAPHICS_INCLUDES src/graphics/*.h src/graphics/*.hpp)
file(GLOB GRI_INCLUDES src/gri/*.h src/gri/*.hpp)
file(COPY ${RATSLAM_INCLUDES};${RATSLAM_GRAPHICS_INCLUDES};${GRI_INCLUDES} DESTINATION include)
include_directories("/libraries/OpenCV2.3/build")
include_directories("C:/Users/Kevin/ROBOSLAM/irrlicht-1.8/include")
link_directories("C:/Users/Kevin/ROBOSLAM/irrlicht-1.8/include")
include_directories("/libraries/boost_1_53_0")
include_directories("C:/Users/Kevin/ROBOSLAM/libraries/OpenCV2.3/build/include")
link_directories("/libraries/boost_1_53_0")
include_directories("C:/Users/Kevin/ROBOSLAM/libraries/boost_1_53_0")
link_directories("C:/Users/Kevin/ROBOSLAM/libraries/boost_1_53_0/")
link_directories("C:/Users/Kevin/ROBOSLAM/libraries/boost_1_53_0/stage/lib")
include_directories("${CMAKE_BINARY_DIR}/include")
add_definitions(-DRATSLAM_EXPORTS -DRATSLAM_GRAPHICS_EXPORTS)
add_library(ratslam SHARED src/ratslam/Experience_Map.cpp src/ratslam/Pose_Cell_Network.cpp src/ratslam/Visual_Template_Match.cpp src/ratslam/Ratslam.cpp)
target_link_libraries(ratslam ${Boost_DATE_TIME_LIBRARY})
add_library(ratslam_graphics SHARED src/graphics/RatslamGraphics.cpp)
target_link_libraries(ratslam_graphics Irrlicht ${OpenCV_LIBS})
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/include)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
message(STATUS "headers include ${RATSLAM_INCLUDES};${RATSLAM_GRAPHICS_INCLUDES}")
set(RATSLAM_LIBS ratslam ratslam_graphics)
add_subdirectory(examples)
It seems that all the openCV methods are causing the errors. Any idea why? I believe I imported all the libraries/header files correctly into the project, but still I get these problems. Any help/pointing me in the right direction would be great. Thanks!
From the error shown above I assume you are using the RatSLAM C++ libraries, and I too had the same errors during compilation in VS 2010. I was able to solve it with help from the below link :
OpenCV Build on Visual Studio LINK error
The above link says that certain lib files should be configured, like opencv_core246.lib and opencv_highgui246.lib from the OpenCV library folder. The link also leads you to a tutorial explaining how to configure them :
Setup OpenCV-2.3 for Visual Studio 2010
I hope this helps.
I am trying to compile FLANN_Example.cpp in Visual Studio 2010. The file is a usage example of the Fast Library for Approximate Nearest Neighbors (FLANN); it is intended to produce an executable. I went through the whole CMake routine and installed the HD5F library (a dependency) set up for static linking.
I can compile every thing else - except for flann_example.cpp.
Here is the output:
1>------ Build started: Project: ZERO_CHECK, Configuration: Debug Win32 ------
2>------ Build started: Project: flann_cpp_s, Configuration: Debug Win32 ------
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _malloc already defined in LIBCMTD.lib(dbgmalloc.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _memmove already defined in LIBCMTD.lib(memmove.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _free already defined in LIBCMTD.lib(dbgfree.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _fclose already defined in LIBCMTD.lib(fclose.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _fprintf already defined in LIBCMTD.lib(fprintf.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: ___iob_func already defined in LIBCMTD.lib(_file.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _sprintf already defined in LIBCMTD.lib(sprintf.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _setvbuf already defined in LIBCMTD.lib(setvbuf.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _strtol already defined in LIBCMTD.lib(strtol.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _isdigit already defined in LIBCMTD.lib(_ctype.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _isalpha already defined in LIBCMTD.lib(_ctype.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _abort already defined in LIBCMTD.lib(abort.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _strncmp already defined in LIBCMTD.lib(strncmp.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _fopen already defined in LIBCMTD.lib(fopen.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _isspace already defined in LIBCMTD.lib(_ctype.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __errno already defined in LIBCMTD.lib(dosmap.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _strrchr already defined in LIBCMTD.lib(strrchr.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _isalnum already defined in LIBCMTD.lib(_ctype.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _strcspn already defined in LIBCMTD.lib(strcspn.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __read already defined in LIBCMTD.lib(read.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __get_osfhandle already defined in LIBCMTD.lib(osfinfo.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __open already defined in LIBCMTD.lib(open.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __write already defined in LIBCMTD.lib(write.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __lseeki64 already defined in LIBCMTD.lib(lseeki64.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __chsize_s already defined in LIBCMTD.lib(chsize.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __close already defined in LIBCMTD.lib(close.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __fileno already defined in LIBCMTD.lib(fileno.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _fread already defined in LIBCMTD.lib(fread.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _fwrite already defined in LIBCMTD.lib(fwrite.obj)
2>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _fflush already defined in LIBCMTD.lib(fflush.obj)
2>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info##AAE#ABV0##Z) already defined in LIBCMTD.lib(typinfo.obj)
2>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info##AAEAAV0#ABV0##Z) already defined in LIBCMTD.lib(typinfo.obj)
2>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
2>C:\flann-1.6.11-src\bin\lib\Debug\flann_example.exe : fatal error LNK1169: one or more multiply defined symbols found
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Here are my Additional Include Directories:
C:\Program Files %28x86%29\HDF Group\HDF5\1.8.7\include\cpp;
C:/flann-1.6.11-src/src/cpp;
%(AdditionalIncludeDirectories)
Here are my Additional Dependencies under Linker:
C:\Program Files (x86)\HDF Group\HDF5\1.8.7\lib\hdf5_cpp.lib;
C:\Program Files (x86)\HDF Group\HDF5\1.8.7\lib\hdf5.lib;
C:\Program Files (x86)\HDF Group\HDF5\1.8.7\lib\hdf5_hl_cpp.lib;
C:\Program Files (x86)\HDF Group\HDF5\1.8.7\lib\hdf5_hl.lib;
C:\Program Files (x86)\HDF Group\HDF5\1.8.7\lib\tools\hdf5_tools.lib;
C:\Program Files (x86)\HDF Group\HDF5\1.8.7\lib\zlib.lib;
C:\Program Files (x86)\HDF Group\HDF5\1.8.7\lib\libszip.lib;
C:\flann-1.6.11-src\bin\lib\Debug\flann_cpp_s.lib;
C:\flann-1.6.11-src\bin\lib\Debug\flann_s.lib;
C:\flann-1.6.11-src\bin\lib\Debug\flann_cpp-gd.lib;
C:\flann-1.6.11-src\bin\lib\Debug\flann.lib;
C:\flann-1.6.11-src\bin\lib\Debug\flann_cpp_s-gd.lib;
C:\flann-1.6.11-src\bin\lib\Debug\flann_cpp.lib;%(AdditionalDependencies)
Compiler Options:
/I"C:\Program Files (x86)\HDF Group\HDF5\1.8.7\include\cpp"
/I"C:/flann-1.6.11- src/src/cpp" /Zi /nologo /W3 /WX- /Od /Ob0 /Oy-
/D "WIN32" /D "_WINDOWS" /D "_DEBUG" /D "_FLANN_VERSION=1.6.11" /D
"FLANN_STATIC" /D "CMAKE_INTDIR=\"Debug\"" /D "_MBCS" /Gm- /EHsc /RTC1
/MTd /GS /fp:precise /Zc:wchar_t /Zc:forScope /GR
/Fp"flann_cpp_s.dir\Debug\flann_example.pch" /Fa"Debug"
/Fo"flann_cpp_s.dir\Debug\"
/Fd"C:/flann-1.6.11-src/bin/lib/Debug/flann_cpp_s.pdb" /Gd /TP
/analyze- /errorReport:queue
Some help would be really appreciated! I have spent an inordinate amount of time on this.
This turned out to be yet another case of 'Make sure you are compiling everything statically'