System.Collections.Specialized.NameValueCollection doesn't exist in target framework [duplicate] - windows-phone-8

In VS 2012 Express for Windows Phone, I am using imports of both System and System.Collections.Specialized, but I still get an error when trying to use NameValueCollection.
Looking in the Object browser, I see it nested within System.dll, but there are several versions of the System dll listed - some of which do not have it. What I get in auto-complete matches the available items in the System.dll without NameValueCollection, so I'm thinking I need to sort out which System.dll is being used, but I am not sure how to do so.
Can someone help me to use NameValueCollection?
The System versions I have are:
2.0.0.0 (has it) - .NET 2,3,3.5
2.0.5.0 Runtime 2.0.5xxx (does not have it) Silverlight 4
2.0.5.0 Runtime 4.0.3xxx (does not have it) Windows Phone 8
4.0.0.0 (has it) - .NET 4.0

NameValueCollection is not available for Windows Phone. You can use Dictionary<string, string> instead.

Related

TreeView Control isn't still available with MSCOMCTL.OCX registered

At this moment I'm working on a MS Access database, and I have difficulties with the library MSCOMCTL.OCX.
The problem is the following: given Windows 7 x64, Microsoft Office 2010 x64 and MSCOMCTL.OCX v6.1.98.34 (which was registered with the help of regsvr32 in the folder SysWOW64), I can't use the TreeView (MsComCtlLib.TreeCtrl.2 class) present in some forms of the database. Every time the code approaches any TreeView's (read, Node's) property, I receive the following message:
"Object doesn't support this property or method" (Error 438)
while in Windows 7 x32 the database works fine.
Trying to understand what's wrong, I discovered that the library Microsoft Windows Common Controls 6.0 (SP6) exists in the list seen in the 'References...' dialog and is checked, but I don't see Microsoft TreeView Control 6.0 in the list of available ActiveX Objects when I'm in the Constructor mode.
Following some solutions found in the Internet, I executed regedit.exe and saw that there are two "folders" in the path HKEY_CLASSES_ROOT\TypeLib\{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}, "2.0" and "2.1". Besides, the path to the file MSCOMCTL.OCX is in "2.1", while "2.0" is not also empty - it contains PrimaryInteropAssemblyName property for example, which isn't present in "2.1".
So, what should I do to make TreeViews in my database work? As I've mentioned before, I saw some solutions, but I'm afraid to use them because the computer, where the database is in, is not mine and it's undesirable to make the changes, which can affect security of the system.
The version of MSCOMCTL that is installed by default is not 64-bit compatible. You're unfortunately out of luck. No amount of modifying the registry is going to make a 32-bit only control work in 64-bit office.
However, MS apparently includes a 64-bit compatible version of MSCOMCTL with Office 365 ProPlus installations (source). You can consider buying that, or obtaining it through other means.

Protobuf-net Causing Certification Failure on Windows Phone Store

I recently started using the protobuf-net library as a way to get around the lack of binary serialization in .Net Core on Windows Phone 8.1 for a port of an existing game.
So far protobuf-net has been working great for me. However when I came to submit the app it is failing the certification tests. The report lists various methods and classes belonging in the protobuf-net dll as being unsupported APIs.
An example from this report is:
This API is not supported for this application type - Api=System.Reflection.Emit.Label. Module=MSCORLIB, PUBLICKEYTOKEN=7CEC85D7BEA7798E. File=protobuf-net.dll.
This API is not supported for this application type - Api=System.Reflection.Emit.DynamicMethod. Module=MSCORLIB, PUBLICKEYTOKEN=7CEC85D7BEA7798E. File=protobuf-net.dll.
This API is not supported for this application type - Api=System.Reflection.Emit.ILGenerator. Module=MSCORLIB, PUBLICKEYTOKEN=7CEC85D7BEA7798E. File=protobuf-net.dll.
This API is not supported for this application type - Api=System.Reflection.Emit.LocalBuilder. Module=MSCORLIB, PUBLICKEYTOKEN=7CEC85D7BEA7798E. File=protobuf-net.dll.
This API is not supported for this application type - Api=System.Reflection.MemberTypes. Module=MSCORLIB, PUBLICKEYTOKEN=7CEC85D7BEA7798E. File=protobuf-net.dll.
There are many more but I have left them out for brevity. However as far as I can tell the MSDN documentation states that each of these APIs ARE supported on Windows Phone 8.1. Certainly in my own tests the library has been working correctly on device for some weeks when deploying from Visual Studio.
Is anyone aware of any steps that I could be missing here, some flag that needs setting in the package manifest or something like that? Or could I be using an incorrect version of protobuf-net (I built the dll from the WindowsPhone8.0 project)?
Thanks
Tom
As you're doing this as a Universal app, you're restricting yourself to the APIs that will also be available to desktop apps, and whilst part of the System.Reflection.Emit namespace is there, it does not include those classes that your error message refers.

Cannot find type System.Windows.Media.AudioSink in module System.Windows.dll for windows 8

In my Windows Store Application, I am getting the error:
Cannot find type System.Windows.Media.AudioSink in module System.Windows.dll
I tried to add a reference to it, but I can't find an assembly list in my project's references.
My system:
OS - Windows 8.1
IDE - Visual studio 2013
The .NET Core for Windows Store Applications does not include all of .NET 4.5 (nor 4.5.1). It is a subset of it, meaning that not all classes are included. It also has some classes specific to it.
If you want to do audio, you should look into the Getting Started with Audio and Video tutorial that Microsoft created for this very purpose.
Also, in the future you should probably include what language you are using. There are multiple languages that Windows Store Apps can be created in (C#,C++/XAML, Javascript/HTML), and it helps to know that.

Why use Service.Model from Silverlight for WindowsPhone?

I understood Silverlight was drop by MS.
I create my first app permitting to read RSS in WindowsPhone and I need to add a reference to System.ServiceModel.Syndication.dll. In the doc http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh487167(v=vs.105).aspx, I need to find this lib in Microsoft SDKs/Silverlight/v4.0/Libraries/Client/.Why should I do it? Why I can't add directly a lib from the standard .net4?
Can you help me to understand.
[UPDATE]
When I add the lib from C:\Program Files (x86)\Microsoft SDKs\Silverlight\v4.0\Libraries\Client\
Visual Studio shows a windows "Adding reference to Windows Phone XNA assembly is safe. However adding reference to a silverlight assembly may lead to unexpexted application behavior. Do you want to continue.
So my assumption is this lib shoudn't be use but I don't find another way.
Maybe by add a ref from .Net 4 or 4.5.
Best regards,
Alexandre
The Windows Phone 7 SDK was built on top of Silverlight. For Windows Phone 8 this was changed so that there isn't a direct history with Silverlight but it was based on WinRT instead. Lots of functionality was made available to Silverlight controls to support backwards compatibility with apps written for 7.
Because WinRT is not compatible with classes written for the full version of the framework you cannot use these in your Windows Phone apps.
The warning you are getting is just a warning. It's telling you that your doing something that isn't an ideal and so you may have issues. Unfortunately there are no other versions of the SyndicationFeed object available to Windows Phone apps so you'll need to use this library if you want the functionality of SyndicationFeed without recreating it yourself. The good news is that there are no issue with using this class in your app. Just be sure to test carefully, on real devices, if you start to use other functionality from that assembly because, as the warning says: "there may be unexpected behaviour".

How targeting .NET 4.0 with Mvvmcross?

I want to use Mvvmcross to make application for several platforms.
I use Profile 104 for PCL library like Mvvmcross, but this profile target .NET 4.5.
I want to target .NET 4.0 to use my application on Windows XP.
To do that, I add the xml files
MonoAndroid, Version = v1.6 +. Xml
and
VSMonoTouch, Version = v1.0 +. Xml
in the profile 143 which allows me to target. NET framework 4.0.3.
However, I have a compilation error because it can not find the ICommand interface.
This interface is not in the same library between version 4.0 and 4.5, is it why it doesn't work ?
Or should I recompile all Mvvmcross libraries with profile 143?
thanks,
This is a Portable Class Library limitation.
See the table on: http://msdn.microsoft.com/en-us/library/gg597391.aspx
Model-View-View Model (MVVM)
Only 4.5
This means that if anyone wants to use MvvmCross on earlier .Net platforms then someone has to build and maintain a non-PCL version.
Since the maintainer of Mvx (me!) has decided to only maintain PCL versions of MvvmCross, then any non-PCL support will have to be created by the community.
For WPF this shouldn't be too large or difficult a job - but it might be...
Alternatively, somebody might be able to do something funky to get the ICommand working... I've retagged this question with portable-class-library to try to lure in some of the MS experts.