I've got a c++ application for Windows Phone 8.1, which uses a C# module for xml processing. The NGEN'd version of that module throws and InvalidCastException from System.StubHelpers.InterfaceMarshaler.ConvertToNative, but the non-NGEN'd version works fine (more details here: http://social.msdn.microsoft.com/Forums/en-US/16fa4316-d0ae-4aca-ac70-9946c6cc4dfb/ngend-dll-throws-exception-but-winmd-does-not?forum=wpdevelop).
Anyway, as a workaround until I resolve the underlying issue, I would like to simply disable native image generation for my app. However, the approach suggested on msdn of including a nongen.txt file in the root of the appx does not seem to be working... the file is there, but the C# module still seems to be getting NGEN'd. Has anyone else run into this / does anyone know how to disable NGEN for an app on Windows Phone 8.1?
I managed to get ahold of a guy from .NET Native who is familiar with the native image generation process. Apparently there currently is no way to disable native image generation on Windows Phone. Here's the full response:
"Nongen.txt is not supported on Windows Phone. Technically, NGen doesn’t really exist on phone. Native code generation on phone goes through a very different set of steps compared to Windows. There is currently no supported mechanism for skipping native code generation when the app is deployed through Phone app store."
Too bad - that would have been a handy workaround.
Related
For my internship, I need to create a customized browser that will host their web application and simulates it to be like a normal desktop app for the user.
I've already looked at a few possibilities to help me create a browser without having to write the engines myself and this resulted in creating small prototypes for Electron, CefSharp, and Geckofx, these last two were done in c# WinForms, where the default webbrowser control was replaced by a chromium engine and the firefox engine Gecko in the case of Geckofx).
These prototypes seemed to work perfectly with the site and looked very promising, however since making these demo's I got the requirement to support Windows XP as well. This requirement has complicated things because none of my already available options support Windows XP as of now.
Which brings me to my question, are there any packages like Cefsharp and Geckofx that are embedded into c# (via Visual Studio NuGet) and available to be used on Windows XP without breaking?
The webapp I'm creating this for fully supports internet explorer 11, Chrome version 50+, Firefox (don't know the first supported version) and Microsoft Edge.
It also seems to work with Opera version 36 (which is the last available version for XP) but I haven't found any kits that can help me create a browser-based on this.
Edit 18-01-19:
I was asked to also support Windows XP because the company I work for has a lot of customers that are hospitals. Apparently, they mostly use Windows XP to support the other programs they have installed on their desktops and as such I got the requirement to make my browser support XP as well.
It is also worth noting that the webapp I'm making this for, is currently used on a local environment and accessible via localhost in a browser. So the security concerns are not the main problem here as far as I'm aware of.
Edit 22-01-2018:
It seems that the current version of Geckofx (v45) is still able to work with Windows XP, it does, however, need the .Net framework 4.0 to work, so you'd have to downgrade to that version whilst developing. However, when I try this out I miss certain dependencies that make it impossible to use.
When reinstalling the NuGet version on .net framework 4.0 the references to Geckofx-core and geckofx-WinForms disappear, along with a few others that I haven't been able to pinpoint. Because of these lost dependencies, I'm unable to support XP with the Geckofx browser and I haven't found any good replacements for it.
The error I'm getting right now after "Xpcom.Intialize("Firefox"); is 'System.EntryPointNotFoundException: cannot find entry point with the name NS_Alloc in DLL xul' which causes the program being unable to start.
I'm trying to use NHunspell library in my windows phone app (available thru NuGet package).
In the Hunspell constructor i'm getting this error:
Additional information: Unable to load DLL 'kernel32.dll': The specified module could not be found.
Does anyone know how why it happens and how can i fix it? i'm running my app in the emulator, maybe this cause the issue?
The same code works fine in a simple desktop app, so i guess it is something with the project refrences or stuff like that...
And if there's someone who is familiar with this spellcheck lib and WP or in general, i'll appricaite his help.
Please help!
Thanks in advance!
In fact NHunspell uses Hunspell. Hunspell is not a native windows component as mentioned, it is a C coded spell checker library. If it is possible to use native compiled libraries on Windows Phone, someone could compile Hunspell for it, so that this can be deployed to the Phone. This would also be nice on Android and iOS in conjunction with Xamarin. Currently there is no native Hunspell library for windows phone. But this should be possible with Windows Phone 8 native support.
I have already laid the foundation for this cross platform compilation by separating the NHunspell and native Hunspell projects in the latest NHunspell version. But I'm targeting Linux x86 with this step. If someone is good at cross platform development, maybe this could be done for the mobile devices too.
This blog post describes the new build process where additional native builds can be integrated: Building NHunspell with PowerShell Build Tools
Would it be possible to code and compile C#, on a Windows 8 Tablet (WinRT) (the ARM processor edition)?
Basically it comes down to this:
Is there a C# compiler that runs on ARM?
Is there and IDE that can run in WinRT?
If the above is true, I don't see any issue, but I currently can't find if the C# compiler runs on ARM (only a lot of posts about compiling for ARM). I've also looked at SharpDevelop, and found that their source code compiles for "Any CPU", which according to this post: Windows RT and c#, means that it'll run on ARM.
Sharpdevelop however requires .NET 4.0 "Full" runtime, which I couldn't find if WinRT has or not. I'm betting it doesn't, as WinRT is supposed to be a really lightweight edition of Windows.
As a sidenote, I know that Windows tablets will come in two editions, one for ARM and one for classic processors. The classic processors will run a normal Windows 8 edition, which means it can run all the native applications. Compiling C# wouldn't be an issue here - so the question is rather, can I do the same on ARM?
This would be awesome for travelling and trying out new ideas quickly.
Currently: no, and no.
It would certainly be possible to build a Windows Store app that contains an IDE and a C# compiler. However, you would not be able to run any programs built using such an app. Windows Store apps run with reduced privileges in a sandbox. In this sandbox, the CLR will only load system assemblies and assemblies contained in the app package. The app package is immutable and cannot be modified at runtime.
Actually, the .Net framework on the surface includes csc.exe, the Csharp compiler.
I've gotten code to compile, but WinRt doesn't seem to like it being run without proper signing.
The IDE won't happen for a while, not yet at least. I'm sure that with proper signing, it is possible to run a compiled executable.
Or the other guy might be right and it isn't just an issue of signing.
I've ported SharpDevelop to run on unlocked Windows RT devices, it works at least for C# Windows Forms apps. http://chentiangemalc.wordpress.com/2013/03/18/sharpdevelop-rt-edition-beta-code-windows-forms-directly-on-windows-rt/
It's not all together clear to me, so I am hoping someone here knows the answer. I am using the C# Json.Net and the C# HtmlAgilityPack both built from sources for "Any CPU". I've noticed that both of these include using directives that reference assemblies that don't seem to be available in Metro yet they both build fine.
If I reference them, does this mean my app will thunk to unmanaged code?
What exactly causes thunking to unmanged code?
Why are DLLs allowed to reference assemblies that are not available to WinRT and my app is not?
Will this fail the windows store approval process?
What are the general rules for DLLs I include with my app that I need to worry about?
Thanks in advance!
When developing apps that target WinRT, the app should only use the API's available in Windows 8 WinRT. The API's are defined in WinMD files. If the app used the desktop API's, then it will be rejected during the Windows store approval process.
Imagine this scenaio. You developed a WinRT app that uses .NET DLL's from desktop mode (client profile). The app is deployed in Windows store and user downloads it on ARM tablet. The application will crash as it does not have the desktop (client) .NET DLL's on the ARM devices.
so this brings us to the question on what .NET classes we can use while developing apps for WinRT. The article http://kishore1021.wordpress.com/2012/08/06/what-is-portable-class-library-project-in-visual-studio-2012-net-4-5/ lists the .NET classes available for WinRT application development.
Change all open source projects dependencies to target WinRT. See if some methods / classes in WinRT are missing so the code does not compile. Try to find the alternative methods/classes.
Such as List.FindAll(), change to Linq Where()
Hey. I came across Protobuf-net and it seems like a great serialization library to use. Is it possible to get this working on Windows Phone 7? I downloaded the MSI but it seems that the DLL cannot be referenced because it hasn't been created with the Windows Phone Runtime. Is there another DLL I should download to use so that it works on the phone? thanks
There is WP7 support in v2, which is the trunk. This is not yet fully released (I have a few bits to do), but it does work.
You could try compiling the v1 trunk. But the author says that a big refactor is currently in progress to support the Compact Framework's lack of generics support.
If you download one of the zip files at http://code.google.com/p/protobuf-net/ instead of the MSI. eg:
http://code.google.com/p/protobuf-net/downloads/detail?name=protobuf-net%20r282.zip
you get assemblies for all runtime versions including one for silverlight 2 which should run fine on the phone (I haven't tested it)