EventtoCommand / SL5 / MVVMLight V3 - mvvm-light

I'm using V3 and recently decided to try SL5 against my Silverlight project. I've upgraded Blend to the V5 version, un-installed V4 SL and installed V5 tools. Updated all the references that I could find. The Event to command behaviour still remains unrecognized.
I've searched the web and have found no mention of V3 EventToCommand and SL5.
Any suggestions/experience with this? With Telerik have issues with SL5 RC as well, am I simply too early?

I assume you referenced the System.Windows.Interactivity.dll as well? EventToCommand is a Blend behavior and the base code for those is in that DLL. That assembly comes with MVVM Light but originally belongs to the Expression Blend SDK for SL4. I tried to search for Blend SDK for SL5 but didn't find any (or then it's just in the SL5 Beta SDK). Maybe that could be related.. what's the error message that you get?

You can now use the MVVM Light v.4 and the EventToCommad will work in SL5.
http://mvvmlight.codeplex.com/

Related

Dotnet Core 3.1, EF1001: internal ef core api usage

Upgraded to Dotnet Core 3.1 from 2.2, EF core kept complaining EF1001: internal ef core api usage by putting an Exclamation Mark in my project.
But no error / warning shown during compilation. I do not know which line of code is causing the trouble.
May I know how can I find out which API / Method that I am not suppose to use?
The warnings from these analyzers can be really confusing. If I understand this correctly, the issue is not what it seems.
The message with the gray warning icon inside the analyzer is normal and indicates what the analyzer is checking. See the Analyzers in Solution Explorer documentation for an explanation.
If you are experiencing yellow icons on the parent node ("Analyzers") try to unload/reload the project, or maybe open Visual Studio in admin mode. See the answer to "Analyzers warnings in ASP.NET Core 2.2 project in VS2019
" for details.
If you don't see a warning in the error list then I advise you to ignore that.
The GitHub issue "Confusing analyzer warnings in solution explorer with no way to see any details" provides additional information on this.
Are you using a database provider (i.e. packages for SQLServer, Postgres, etc)?
It sounds like you are saying there is some warning being given with your dependencies. I know Microsoft announced some breaking changes, mainly for database providers, with EF Core with the 3.0+ updates. Could be as simple as updating the other packages in your project.
Just guessing, I could very well be wrong.
figure it out for me, was getting the same warning,
it was using an entity framework namespace
(using Microsoft.EntityFrameworkCore.Internal;) and not
using System.Linq; which was extremely odd as I didn't add the Ef one at all.
which is why I was so confused and started googling and how i got to this page.

How to include Android.Support.v4 in Xamarin Forms (iOS)?

I am using Visual Studio For Mac. My Xamarin Forms project is quite large and contains many content pages. Some of them will be only used in android project and some of them only used in iOS project. There is no problem when I compile the project into android. However, when I want to compile the project into iOS, it seems like did not accept anything related to android. Please refer to the screenshot. There is no way I can include the android specialised reference and compile into iOS project. So, any idea to deal with this? Maybe there is a way to force build the iOS project no matter what? The error from the screenshot is from the page that will be only used in android. So what I can do for now is delete the page when I want to compile as iOS and recreate the page when I want to used it for android. But there are plenty of them, it is too heavy for me to do this every time. Please help.
You can't call platform specific APIs at the .NET standard libraries that are used to host Xamarin.Forms code by default.
Basically you have those options:
1) using shared project instead of library and using conditional compiling (easier but it is now not available as the option when creating the project)
2) using dependency injection.

Is Prism 6.3.0 tied to an older version of Unity (I can't seem to upgrade)

I've got a WPF App using the latest version of Prism for WPF (6.3.0) and Unity. Just a few modules. It works great.
When I manage NuGet packages for my solution, it tells me that there is a new version of Unity (5.4.0) available. Unfortunately, if I try to update to that version, I can no longer build.
It's pretty clear to see why: Upgrading unity via this method removes all references to it (Unity) from my project. Specifically the following 3 references completely disappear from all my projects without any replacement:
Microsoft.Practices.Unity
Microsoft.Practices.Unity.Configuration
Microsoft.Practices.Unity.RegistrationByConvention
(The Prism references remain, of course)
Error messages tell me that IUnityContainer is defined in an unreferenced assembly (Microsoft.Practices.Unity. 4.0.0.0). Given that it removed those assemblies, this all makes sense.
If I then try to go looking to add Unity back in, the Add Project Reference dialog cannot even find Microsoft.Practices.Unity when I search for it.
Now this isn't that big of a deal. I didn't need to upgrade. and it's easy for me to revert back. But I want to understand why this is failing for future reference.
Does this mean that Prism is tied to the older version of Unity and I just shouldn't upgrade?
Does this mean that types have moved to different namespaces and I need to make some other fix?
Some other reason?
Among the Unity 5 updates included a change of namespaces which as you noticed was a major breaking change. There are no plans for Prism 6 to support Unity 5, however the current Prism 7 previews (which is available for WPF) have updated both the Common Service Locator and Unity.
https://www.nuget.org/packages/Prism.Unity/7.0.0.336-pre

Xamarin UWP and Azure Mobile Services Offline SQLite Sync - problems when building in Relase mode with .Net Native Toolchain on

We have a problem when we build our app in Release mode with .Net Native Toolchain on.
MobileServiceClient.SyncContext.PendingOperations then returns -1 instead of 0 when there are no Pending Operations which result in that offline functionality no longer works (no items that are inserted when you are offline are sent over to the server).
The same phenomenon is described here:
https://github.com/Azure/azure-mobile-services/issues/890
We have tested with Visual Studio Update 2 and also with Visual Studio Update 3, but unfortunately, the problem remains in that version.
However, we have noticed that if we set "Optimize code" = false the offline functionality works, but then we instead get the following errors when Windows App Certification Kit tests have been completed.
"AppName" takes a dependency on Microsoft .Net Native Framework Package 1.x framework but is missing the framework dependency declaration in the manifest.
and
API CoCreateInstance in api-ms-win-core-com-l1-1-0.dll is not supported for this application type. "AppName.dll" calls this API.
If anyone has a solution for this, we would be very grateful!
With the help of a member from the .NET Native runtime and compiler team (Many thanks) we have been able to troubleshoot the problem and come up with a workaround!
We have worked around this issue by adding this to Properties\Default.rd.xml file:
<Library Name="Newtonsoft.Json"> <Assembly Name="Newtonsoft.Json" DoNotOptimize="true"DoNotInline="true" /></Library>​
This instructs the optimizer to ignore all of the types/methods inside of Newtonsoft.Json.
I have noticed that you reposted on the Azure Forums as well. I asked a few follow-up questions there and will answer your query there. We can cross-post the eventual answer if you like.

EntryPointNotFoundException - Entry point was not found when loading an MVVM Light View in Expression Blend 4

I'm posting this question so I can document the solution as I found it very tricky and time consuming to solve.
I'm using Laurent Bugnion's excellent MVVM Light Toolkit in a Silverlight 4 project and I'm using his ViewModelLocator pattern with the Microsoft.Practices.ServiceLocation.ServiceLocator to load design time models for Blendability. Initially loading the Views up in Expression Blend 4 was working and the design time data binding was great. This stopped working at some point without any error message in Blend at all.
I used Visual Studio 2010 SP1 to attach to Blend.exe to debug the issue. The EntryPointNotFoundException (Entry point was not found) exception was being thrown at this line of code:
return ServiceLocator.Current.GetInstance<ExampleViewModel>();
Strangely enough, I was able to load the same View in the Visual Studio XAML Designer successfully with my design time data binding working correctly. I used another Visual Studio instance to attach the debugger to the Visual Studio instance hosting the XAML Designer and was able to confirm that the ServiceLocator call was executing successfully.
The exception detail (stack trace, InnerExcetion etc) did not give me any further clue to the problem and various Internet searches for the unhelpful error emssage failed to shed any further light.
I eventually got lucky by using the Visual Studio Immediate Window to execute part of the line of code that was causing the problem and got a much better error message:
?ServiceLocator.Current
The type 'Microsoft.Practices.ServiceLocation.ServiceLocator' exists in both 'Microsoft.Practices.ServiceLocation.dll' and 'Microsoft.Practices.ServiceLocation.dll'
Comparing the changeset to previously working code I noticed that I had added a reference to GalaSoft.MvvmLight.Extras.SL4 in a separate Unit Test Framework for Silverlight project (which references the UI project). This test project was referencing the assembly from C:\Program Files (x86)\Laurent Bugnion (GalaSoft)\Mvvm Light Toolkit\Binaries\Silverlight4 where as the UI project was referencing it from ..\packages\MvvmLightLibsPreview.4.0.0\lib\SL4. I had used the nuget package MvvmLightLibsPreview to add MVVM Light to the client project.
The Blend Results - Errors and Output Windows did not show any error message at any point. Obviously there is no real answers required unless there are some Blend trouble shooting techniques which would have helped my figure out the problem faster.
I had almost the same issue though my problem did not go away until I uninstalled MVVM Light using the Windows 7 control panel. The NuGet MVVM Light references were still in the project but now I can see the design time data. It was broken before.
I followed the advice on the MVVM Light web site and attached the Blend preview for Visual Studio 2012 and received the error that you mentioned above (EntryPointNotFoundException). I had no idea even then that I should try to remove two different versions of MVVM Light that were conflicting with each other.
AS you would expect, changing the test project's MVVM Light assembly references to use the same nuget package versions used by the client UI Project fixes the problem. I've no idea why Visual Studio did not have a problem with two versions of the Microsoft.Practices.ServiceLocation.dll being referenced in the same way as Blend.
I ended up trying to copy over the entire contents of the package that would come from NuGet into
C:\Program Files (x86)\Laurent Bugnion (GalaSoft)\Mvvm Light
Toolkit\Binaries
That did not solve the problem.
Since uninstalling MVVM Light took away other things such as snippets, I decided to go back and troubleshoot some more. I was not successful and could only find a rough temporary solution.
I tried comparing projects that would work and projects that would not work by looking at the four DLL files:
GalaSoft.MvvmLight.Extras.WPF4 GalaSoft.MvvmLight.WPF4
Microsoft.Practices.ServiceLocation System.Windows.Interactivity
I don't see any differences in versions.
So, the work around for now is to start a new project using the MVVM Light WPF template in Visual Studio 2012, build it, then remove references to the four DLL's mentioned above. Then I install the package MVVM Light from NuGet and edit out the double entry of the view model locator in App.xaml and then the program works fine. At this point I can see the design data message on the Main window which says
"Welcome to MVVM Light [design]"

Resources