I have been developing on the Hololens. The project is on .NET 4.x with IL2CPP with API compatibility 4.x. I'm using Unity 2018.3.6f.
I need to add external DLL (IdentityClient.dll)
Reference: IdentityModel NuGet Package
This dll has dependencies on both Newtonsoft.Json and System.Text.Encodings.Web.
After lot of work, I'm now able to deploy my application with the dlls, but when I use them, it makes my application crash. The problem is with Newtonsoft.Json.
Since IL2CPP use AOT compilation and newtonsoft use reflection, it crashes. I've replaced the Newtonsoft.Json.dll with this
https://assetstore.unity.com/packages/tools/input-management/json-net-for-unity-11347
I've been able to use Newtonsoft in my code, but the IdentityModel.dll still references the old implementation even though I deleted it. So it crashes again. I'm kind of stuck right now and I'm wondering if any of you would has a solution!
I'm also thinking if I can't fix it too :
Fork the github project of IdentityModel and adjust it
Just make everything manually instead of relaying on IdentityModel, but it will probably take some time.
Moreover, everything works fine in the Unity Editor, but when it's deployed it crash.
In the end, I decided to implement de dll myself. Most people working on Hololens seems to have similar issues
Related
I'm developing a Blazor PWA project where the WASM client needs to generate PDFs. My employer had already purchased an Xfinium license, thus I have been using it in our project. I have just recently ported the project from .NET Core 3.1 to .NET5 and have begun encountering issues with the Xfinium library. First of all, I am using the Xfinium.Pdf.NET library, as it supposedly supports .NET5. Upon attempting to initialize any object from this library (i.e. PdfFlowDocument test = new();) I am immediately greeted with the following error: Assertion at /__w/1/s/src/mono/mono/mini/interp/transform.c:3592, condition <disabled> not met, which causes my application to crash. To further pinpoint this issue, I created two separate Blazor PWA WASM projects, one with .NET5 and one with .NET6, installed the Xfinium.Pdf.NET library, and attempted to use it. Both resulted in the exact same error as above. I then recreated this on a separate machine as well.
I have reached out to Xfinium support in regards to this issue, and have yet to hear back. Wondering if anyone else has experience a problem similar to this one. For the time being I will simply keep the project on .NET Core 3.1 (the upgrade was to fix another issue where we couldn't read more than 2mb at a time from indexed db database).
Any help is much appreciated!
Upon receiving a helpful workaround from the Microsoft Forums and a response from the Xfinium support team, I can answer my own question.
The Xfinium support team was able to recreate my issue with the obfuscated NET version of their Xfinium.Pdf library. Upon testing the non-obfuscated assemblies of the same library, the problem was non-existant. Therefore, they believe the obfuscation tool is the source of the problem and have notified me that they have reached out to their obfuscation tool vendor. I will be alerted by their support team when the issue is fixed.
As for a workaround, a user named Bruce on the Microsoft Q&A Forums suggested I try the NetStandard version of the library in my NET5 project. This solved my problem. I then alerted the Xfinium support of this solution and they told me that the NetStandard assemblies for this library are in fact obfuscated using a separate tool.
Thus, for the time being, I will be going forward using the NetStandard version of the library. I will update this post when Xfinium support alerts me that a fix has been shipped.
I'm trying to use web services on unity.
I used svcutil to generate a proxy class, however the proxy class was using "System.Threading.Tasks".
I noticed that System.Threading.Tasks wasn't aviable on .Net 3.5.
So I went to player setting and I changed to .Net 4.x
But now I have an other issue, and I cannot find a way to fix it, I need to use System.Web.dll and System.Web.Services.dll to make my web service work, however, the dll that are include in Program Files\Unity\Editor\Data\Mono\lib\mono\2.0 are all targets for .Net 3.5.
So that mean I cannot use them on .Net 4.x
I've been looking for quiet long and was unable to find any answer.
I can add the code to the proxy class here if it's require, but I don't think it would be useful. Should I download those dll somewhere?
Anyone ever seen thoses issues somewhere?
You are using the wrong dll version.
Once you change Api Compatibility Level to Net 4.x, you have to copy the System.Web.dll and System.Web.Services.dll files from <UnityInstallationDirectory>\Editor\Data\MonoBleedingEdge\lib\mono\4.5 to your <Project>\Assets path.
That's it. Restart Visual Studio and Unity.
There is another method of linking missing libraries as described in this unity documentation.
Create a file called csc.rsp and put these 2 lines in it:
-r:System.Web.dll
-r:System.Web.Services.dll
And yes, you better set compatibility level to .NET 4.x
You also might want to restart Unity or VS in some cases.
Microsoft says it's platform neutral these days, so I'm trying to build on Mac and Linux only with VS Code and deploy to Azure. Why? It's mainly to prove that I can.
Our project has several parts which include a couple of different websites, a Web API, er API and a few other bits. On my Mac I've built a .Net Core Class Library with a load of objects in. Command line, dotnet build, DLL out, no problem.
I want to put that DLL on the Linux machine where the MVC website is being built - the objects forming the models part of that site hopefully. I cannot figure out how to get the website project to reference my DLL and use the objects.
I had assumed I copy it to the other machine, place it in the bin folder of the site being developed and reference it in the Dependencies section of the site's project.json. Nope. I saw a few articles that said .Net Core only works with NuGet and it had to be a package. Is that really true?
I've found and read (if not entirely understood) everything you could imagine on sharing between .net core and .net framework. This is a core-only project so not applicable. Frankly I'm lost, and something called .Net Standard has just rolled into my field of vision.
So instead of copying the DLL, use dotnet pack to build a nuget package on your Mac, and copy that to your Linux machine instead. Put it in a directory that you configure as a local nuget repository (no server or anything required) and you're away.
I agree it's not as straightforward as a reference to a DLL, but it's not too bad. Note that you'll need to version the package appropriately, so that the tool system can detect when it's changed.
I have recently acquired the student licence of Mono Android from Xamarin.
After making a simple project, i decided to start using some DLL's i am familiar with such as Json.Net and H.A.P on my Android Application (mono project), and that's when the problems started.
After trying to pull those references from NuGet, they failed since the "Android Application" project is not known leading to no .dll installed (NuGet tries to match the project type with the correct .dll to be downloaded be it WindowsPhone, .NET4, .NET 3.5 and so on).
So i moved on to mannually referencing the libraries, since i have them downloaded on my PC. Referencing Works, but as soon as i try to access the HtmlAgilityPack it raises an exception.
Error CS0012:
The type 'System.Xml.XPath.IXPathNavigable' is defined in an assembly that is not referenced.
You must add a reference to assembly 'System.Xml, Version=x.x.x.x, Culture=neutral
The exception is raised on the first execution of the code because of J.I.T compilation of .NET, i know this.
Question:
How can i use my "so loved" .dlls on my Mono Android Project?
Do i need the source code of those libraries in order to use them on my projects?
Thanks in Advance
In order to recompile an assembly you will need the source.
To see what assemblies are provided by Xamarin.Android and Xamarin.iOS you can visit these two pages:
http://docs.xamarin.com/guides/android/advanced_topics/assemblies
http://docs.xamarin.com/guides/ios/advanced_topics/assemblies
One way to recompile it would be to make a Android Class Library or iPhone Class Library and add a link to all the files in the original source and then compile it. Or when Xamarin have their PCL support done, do something similar just in a PCL so that you have one DLL targeting multiple platforms.
You may also find this post useful, which briefly describes how to compile HtmlAgilityPack against Xamarin.Android: http://forums.xamarin.com/discussion/comment/2139/#Comment_2139 You might need to alter some things as this is from December 2012, since then things might have changed.
I have a c# solution that accesses a c++ project through COM. The project has to be targeted to a specific processor, in this case x64. I am using the Windows installer to install the application.
The first problem I ran into was the c++ dll was not being registered properly when installed, and the program couldn't access it. I solved this by adding the c++ project to the solution.
For a while this worked, and everything installed properly, but then I started getting the following warning when I tried to build:
The target version of the .NET Framework in the project does not match the .NET Framework launch condition version '.NET Framework 3.5'. Update the version of the .NET Framework launch condition to match the target version of the.NET Framework in the Advanced Compile Options Dialog Box (VB) or the Application Page (C#, F#).
The setup would not install if I tried ignoring the warning. After some searching, I found that the c++ project was building in .NET 4.0, while my solution used .NET 3.5. I tried changing my solution to 4.0, but for some reason it stopped working, so I changed the c++ to 3.5.
This worked for a couple of builds, but then I began getting the following errors:
Error: LNK1104 cannot open file 'mfc90.dll'.
I added the file to the Additional Dependencies section, but then another link error occured (mfcs90.dll) and when adding that one, I got an x86 x64 conflict.
I'm not sure why these solutions worked for a while and then stopped, and I can't seem to find a resolution at any step that works. If anyone has seen anything similar to this, the insight would be appreciated.
In order to include the Microsoft runtime dlls, you should not simply include the dll in your application directory. This won't help when the dlls have various dependencies and you might run into different conflicts and versioning issues.
The way I would recommend installing the runtime dlls for you application is to include the official merge module in your MSI.
See the following link for your options to redistribute the runtime library:
http://msdn.microsoft.com/en-us/library/ms235316(v=vs.90).aspx