question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SharpKml.Dom.Document' does not have a default constructor on HoloLens(UWP)

See original GitHub issue

I am trying to read in a kml file for a HoloLens application. I am using the MRTKv2 with Unity.

My solution with SharpKml works fine in the player of Unity. But on the HoloLens an exception is thrown.

string fileURI = Path.Combine(Application.streamingAssetsPath, "lszh.kml");
var stream = File.Open(fileURI, FileMode.Open);
KmlFile file = KmlFile.Load(stream);

When the stream is loaded I get the following exception: System.ArgumentException: Type 'SharpKml.Dom.Document' does not have a default constructor Parameter name: type occurred

I suspect it has to do with the interaction between SharpKml and UWP.

Any ideas about what the problem might be?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
samcraggcommented, May 1, 2020

Thanks for the extra information. The stack trace seems to show the area of code I linked to earlier, looking like some of the reflection information is being stripped. I downloaded the emulator and ran the UWP application in release build without the debugger attached but it still worked fine. However, you mention that you’re using Unity, which does try to do some unused code stripping.

Unfortunately, I have no experience with Unity and, although I managed to get all the tools installed and ran one of the tutorials, I have to concede my limitations and am completely lost with how to write anything that would reproduce the issue.

Could I ask you try a link.xml file as per the previously linked Unity docs – if that fixes it then it looks like I can add a Preserve attribute to the actual assembly that would have the same affect and remove the need for you to include that file. Alternatively, I can create a pre-release package that has the attribute applied if you’d like to try using that instead, however, I don’t have the ability to test if it works.

Let me know which option works for you

0reactions
samcraggcommented, May 8, 2020

Thank you so much for testing that out and coming back with the fix!

I’ve added some documentation here and linked to it from the getting started page.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Does a window's default constructor have to be public?
2 Answers. Controls dont need a default constructor in WPF, unless you want to instantiate the control from XAML. As shown, the default ......
Read more >
Parameterless struct constructors - C# 10.0 draft feature ...
When a struct instance constructor has no constructor initializer, that constructor implicitly performs the initializations specified by the ...
Read more >
stackOverflowTags
This file contains bidirectional Unicode text that may be ... To review, open the file in an editor that reveals hidden Unicode characters....
Read more >
generate-cs-word-dict - hangyan
Generate a word dict for CS from stackoverflow/github tags - generate-cs-word-dict/dict at master · hangyan/generate-cs-word-dict.
Read more >
C#, PHP, C++, iOS, MySQL, SQL, ASP.NET, Objective-C, ...
NET 4.0, Eclipse Plugin, TkInter, controller, DNS, get, phpMyAdmin, ... assets, CRM, regression, html-helper, connect, domdocument, attachment, d, extjs4.1, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found