Windows UWP - Dynamically Load Assembly In Side Loaded App - c#

It seems to be a deliberate security of Windows 10 Store apps that assemblies not be allowed to be loaded at runtime. I think that this feature is massive overkill and stops UWP development dead in its tracks. However, if it is a rock solid design decision by Microsoft, there is nothing we can do to argue with it.
Instead, I'd like to ask the question, assuming that you were not deploying your UWP app to the store, would it still be impossible to load an assembly dynamically? If it's possible, how?
Please see this feature request: https://wpdev.uservoice.com/forums/110705-universal-windows-platform/suggestions/18145291-dynamically-load-assembly

Regardless of what environment you deploy your UWP application to, the UWP API will be the same. Choosing to deploy your app internally instead of to the Windows Store will not enable non-supported API features, eg. Assembly.Load().

It seems as though the answer to this question is no.
The game has changed in UWP. UWP is a platform which is geared toward getting apps in to the store. It's a stripped down platform and doesn't appear to allow you to load assemblies at runtime. This was possible in .NET.
However, there does seem to be a way to run UWP style apps on top of the .NET runtime using the Desktop Bridge. I'm not really that familiar with it, but you can read more here as a starting my point. My guess is that if you want to load assemblies dynamically, the best approach would be to use this:
https://learn.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-root

Related

Is it possible to run a .Net UWP Class Library on Azure?

I thought up an idea for a website that would involve some video editing happening on the web server. Microsoft UWP has a library that does the video editing functions I'm looking to perform... Amazing!!
My problem is I don't know if it's possible to get my website to run UWP code on Azure. Web Jobs seem like what I'd prefer to use to kick off this code, but web jobs don't appear to be able to run UWP code and without UWP code I don't see a library that can perform the video editing I'd like to do. Does anybody know if it's possible to run UWP code on Azure? If so, how?
I don't think WebJobs are especially suited for this scenario. They are part of the WebApp platform as a service offering that abstracts the underlying operating system for you to be able to focus on building the code itself and deploy as easily as possible.
UWP on the other hand is a Windows-specific app platform which has many requirements including running on Windows 10. Because you don't know which concrete operating system the web app will run on, it is not easy to say if the APIs would work.
That said, you could theoretically use UWP APIs in a web app as well, because there is a UwpDesktop NuGet package that allows it mainly targeted for desktop apps. It is a long shot but you can certainly try it.
As a preferable solution, I would still look to find another library that suits your needs, as the choice on NuGet is pretty broad and one of those should be sufficient.
I would suggest taking a look at azure functions
These have about the same working as webjobs, however expand beyond the limitations of webjobs. These are also more versatile in what they can do and how they can be created.
webjobs vs functions

Xamarin : add .dll files at runtime to add functionnalities to application

I'm wondering if it's possible for a Xamarin application (all the platforms : Android, iOS, Windows Phone) to detect and load assemblies at runtime.
This is the kind of thing that I already did in WPF, and I'd like to use those modules (maybe with some modifications) in a Xamarin app.
I've spent yesterday looking for info online, and today I tried to implement a solution, but without success.
Prism seemed to be a way to do it, but it works only in WPF.
The restriction which makes this difficult is that I don't know at compile time any information about the assemblies. No names, no versions, no classes.
I can put the name and the version in the filename, and maybe find the classes by reflection. Using an interface as entry point (Prism use this), I should be able to do it.
Do you have any thoughts about this challenge ?
Thank you very much !
iOS: No
Apple does not allow code that was not bundled into the app at signing time to be executed, thus no on-the-fly Jit'ing of CIL allowed. The only exception to this is Javascript code that is run via their Nitro JavaScript Engine.
Android: Yes
Google allows just about anything you can think of, for better or worse ;-)
Windows Phone: No
All code must be signed as part of the Microsoft Store' App Ingestion process and thus you can not dynamically load assemblies later
Note: If this is a hard requirement for your app, you should look at hybrid mobile apps, like Cordova/Ionic, where you can perform a hot push to roll out new features, bugs fixes, etc... Besides self-hosting those hot pushes, various vendors support hosting of those, even Microsoft Azure has a full versioning publication system for this. Of course you would most likely be coding in JavaScript (or some trans-compiled variant).

Using Universal Windows Platform (Windows 10) controls in WPF

Hopefully a simple question; I seem to recall seeing somebody at one of the recent Microsoft conferences say that some of the UWP application functionality was to be made available within WPF/Desktop. Unfortunately, I can no longer find (or remember) which of the many videos this was from (though it was probably Build or similar on Channel9).
Is it therefore possible to use UWP controls within a WPF application? Basically I want the look and feel of an "app", including some of the new controls (RelativePanel, SplitPanel) and the themed buttons etc., but I need the power of the full desktop - such as access to the full file system.
Thanks.
I think you are referring to the different Bridges to port apps to Windows 10 from for instance, IOS, Android, Web, Win32, etc. and still take advantage of Windows 10 features and APIs. Specifically, I think you are talking about the Bridge to bring in Win32 apps. You can find the bridges listed here.
https://dev.windows.com/en-us/bridges
•"Project Centennial": This toolkit will enable desktop developers to package and publish their existing .NET and Win32-based Windows applications to the Windows Store. Developers can also use Centennial to call common UWP APIs and services."

Robotium in C# project

I am looking for a mobile automated testing tool and have found robotium. Will it work with C# android app? Can I add the robotium jar file to a .Net project?
While it is likely that, with some amount of work, Robotium could be made to work with Xamarin.Android, it is an amount of relatively complicated work that the Robotium project is unlikely to do. (the killer item probably being good IDE integration)
However, it appears that Xamarin has acquired a testing framework for mobile applications called Calabash. They have devoted a page to explaining it on their main site: http://developer.xamarin.com/guides/testcloud/calabash/introduction-to-calabash/. My instinct here (without having tried it) would be to try and make it work, as it is pretty likely that Calabash will be supported by Xamarin in the future.

Is Silverlight a good fit for these requirements?

I'm looking for a suitable client side architecture that will meet some or all of the following requirements.
I'm thinking primarily about Silverlight (but I would also consider MVC or WPF depending on your suggestions - I can possibly trade some of these requirements off, or find work arounds).
I'm looking for an assessment of Silverlight being able to fully, partially or not able to support, each of the following, with detail around each if possible:
Must be able to reliably upload large (~100MB) binary files via WCF and MTOM
Must be able to support file downloads, preferably in the background (i.e. through 'synching'), though this could simply be supported through a manual URL if necessary
Should have access to some form of local storage - this could be binary or XML for config purposes, but ideally some kind of database (not fussed which, as long as it is part of the install/app)
Should be able to dynamically configure itself depending on user profile. In other words, where a user logs in, the UI and services available are dynamically determined.
Should support some form of client notification (sound and or tray bubble). Ideally this would be supported via WCF duplex, but could be accomplished through polling.
Ideally, should run on multiple platforms (Win / OSX)
Should be easily deployable - if I need to run Silverlight in full-trust mode / OOB - how do users get new versions?
Should be minimisable to the system tray
Any detail or thoughts you can give me on the above would be much appreciated.
Edit - additional questions
Are there any limitations on local storage/access in Silverlight 5 OOB? Or does it behave like a standard WinForms app?
Is it possible to bundle SQL express with a Silverlight OOB .msi?
What is the best option for dynamically configuring a Silverlight app? I've seen MEF mentioned - is this the preferred approach or are there others?
Must be able to reliably upload large (~100MB) binary files via WCF
and MTOM
Should work.
Must be able to support file downloads, preferably in the background
(i.e. through 'synching'), though this could simply be supported
through a manual URL if necessary
Unless you are running OOB with elevated trust (or SL5 in browser elevated) and thus have limited access to the local file system, you would need to ensure sufficient space in Isolated Storage for the downloads.
Should have access to some form of local storage - this could be
binary or XML for config purposes, but ideally some kind of database
(not fussed which, as long as it is part of the install/app)
See above. Regarding local database support there is an SQLite port for Windows Phone 7 which also works in Silverlight (I've recently tested it).
Should support some form of client notification (sound and or tray
bubble). Ideally this would be supported via WCF duplex, but could be
accomplished through polling.
The notification can be done through Silverlight's Notification Window (supported from SL4 and up). The actual server side notification could be done through duplex channels or Kaazing WebSockets Gateway etc.
Should be easily deployable - if I need to run Silverlight in
full-trust mode / OOB - how do users get new versions?
You can install an OOB Client along with the runtime with an MSI installer and still have the Silverlight standard update mechanism work for you (required Authenticode signed XAP). I've done just that a couple weeks ago.
Should be minimisable to the system tray
AFAIK not possible in SL4. Not sure about SL5.
All the points I have not quoted should work.
Having done some Silverlight development I often feel a bit restricted by the possibilities it offers. In my opinion it is meant to be run within a browser, with a web-like interface. From what you describes it is more of a full app you want so I would recommend WPF and click-once deploy that handles updates automatically.
From your requirements I would suggest WPF, full application support, but when it comes to OS X support, then you have a problem, WPF won't work on OS X, only Silverlight will, so I am afraid you have a few requirements that have conflicts with one another.

Categories