Xamarin's shared project issue - xamarin

I want to add a shared project to my ios/android solution. The problem is that after adding a reference to it and using a class from it, I get CS0234 error (The type or namespace name "myname space" does not exist in the namespace...). I use Xamarin studio 5.0.1 for Mac. Any suggestions?

Note: I'm using Starter Edition
I've noticed erratic/buggy behaviour of Xamarin Studio(XS) while while refactoring Shared projects.
for example, when a working(*) Type/class inside an Android project is moved to the Shared Project.
XS refuse to build(*1) the Android project with "Type not found".
Solution Attempts:
- Clean/Rebuild does not help.
- right-click reference and click Refresh,it does Not help.
- Unload-Reload Shared Project (sometimes helps) (*2) .
- Close Solution/Open Solution (sometimes Helps *2b). (more often)
- Close XS Open XS (99% of the time helps)
- Rename (*3) NameSpace in Shared Project Type/class helps 99% of the time (*4) (*5)
*: It builds
*1: Build failed
*2: Sometimes makes more damage than Help,
3: Not Refactoring
4: difficult to know if you didn't break it your self with the renaming when it didn't help , :)
5*: you need to go back to calling/referencing code and fiddle around a bit , intellisense will help you to find the right reference again (6)
6: Highly recommended to enable source analysis of open files (Resharper Mode :)
The Shared project feature is quite new so I'll expect it to get more 'stable' very soon.
To be fair and almost out of context, I also notice glitches in Visual Studio with Shared projects
When working Microsoft projects like in Win8.1/Phone scenario.

Related

UnityPlayer_UAP_ARM64_release_il2cpp.pdb not loaded

I've installed several packages in a Unity (2020) app I'm building. Namely: World Locking Tools, MRTK, PUN2. World Locking Tools provides some examples that are built with assemblies defining scripting symbols that any derived files I want to build would need access to. I'd like to create my own version of certain files from one of these examples. To do this and have access to the scripting symbols in one of those examples, I created an assembly reference to reference the assembly for that example code within World Locking Tools package installed in my project space. In so doing, I kept running into the common "...not found, are you missing an assembly reference" issue, which ultimately led me to creating assembly references for many of the assemblies provided by the various packages I needed to use (not just the particular example code I initially wanted to modify). Once my project finally built successfully in unity, I then tried to upload to a Hololens 2 headset in Visual Studio. This provided the error in the title of this post. Coincidentally, the app also appears to fail to start on the headset. Before I tried to alter my codebase with modified versions of files from that World Locking Tools example and with assembly references, the code would successfully build in Unity and successfully deploy to the Hololens 2 headset.
Does the behavior and missing .pdb error I describe mean that I'm missing assembly references for yet other packages even though Unity successfully builds the project?
This is my first foray into using assemblies so be please be gentle :)
For the .pdb message, that one is ignorable since will not have that symbol available. However, the app not starting is definitely likely due to a missing component or loading issue. When ran in debugger, may get a better idea on what is missing or from a debugger log in Unity.

Mono.Android reference in PCL project in VS 2017 Mac

I have created a project in Visual Studio 2017 Windows. Now I am trying to work on it from Mac. While tried to build the project I can see reference to Mono.Android is not available. Also System.ComponentModel is unavailable. How I can add the reference for both of it?
I also facing the same issue mono.android is missing, finally it work by adding mono.android.dll. I did something like this in my project, in Deploy.cs file add this line
class Deploy
{
[Android.Runtime.Register("getExternalStoragePublicDirectory", "(Ljava/lang/String;)Ljava/io/File;", "")]
it show missing mono.android.dll library is missing need to add into the project. Problem solved later I comment this line.
From the picture above you can see that the reference is made to a particular file on your Windows computer which on the Mac is obviously not on that path. If you want to make the project work you should find those files on the Mac and reference them. Copying them from Windows somewhere and referencing them should work too.
But as people noted, the point of PCL project is not to contain references like this so whole the architecture of your app is wrong and that's why you see the problems. So you may want to resolve the root of the problem as this probably won't be the last thing that you encounter by doing the things in the wrong way.

Cannot access DLL inside Shared Project

I have a Xamarin.Forms Shared project.
I need to add a reference to System.Net.Http and after some research I found out it should be done via the regular right click -> select assembly (at every regular project), done that.
But now, if I go to any class on my shared project and try to use that DLL I can't (see image)
What am I doing wrong?
I've added the reference to every other project (iOS, Android and WinPhone) but can't access it on my Shared Project classes.
EDIT
After much try-and-error I figured it out...
I have 3 projects (iOS, Android AND WP8.1).
I was able to add System.Net.Http to iOS and Android projects but when I tried to do that at the WP project I got a message saying all needed DLLs were already in the SDK (how presumptuous!).
Anyway, I decided to unload WP project and it worked =/
So the problem now is: How can I add that DLL to the WP project, since I want to support it, but I NEED System.Net.Http?
Thanks.
You can not add a reference to a project type of SharedProject. Instead you have to add this reference to the project you referenced the SharedProject to.
Consider the following:
You have a solution with a console project and a - lets call it core project - as a SharedProject.
Your console project references core. If you now want to use System.Net.WebClient you have to add the reference to System.Net to the console project.
Well, I figured it out.
The way I solved it was by unloading the WP project and reloading it. Perfect, it worked =)
After reloading the project I checked the .NET for Windows Phone reference and System.Net.Http is indeed there. Maybe this was just a cache thing, I don't know.
All I know is unloading the project and reloading it did the trick.

DSFML building error (VisualD)

And at first, sorry for my bad English. It is my first project in D. And my first project with SFML (DSFML of course).
I use dub for making Visual Studio project (I use VS2010). Then
open it and set up project settings:
general
compiler
linker
Autocomplete works correctly:
When I try build project, here is error:
Error 42: Symbol Undefined _D5dsfml8graphics12__ModuleInfoZ
How I can resolve it?
This particular error is saying that it can't find the actual D code for the library. It could mean that dub isn't grabbing/linking the source somewhere, but I've never used dub with an IDE so I can't be sure.
My suggestion to help you figure out what is going wrong and to fix this issue is to bug the maintainer (who is me, actually) on github by opening an issue about a lack of tutorials for the IDE's that are available to D right now.
If you want to get started with DSFML right now, however, you can sort of follow along with the command line tutorial and use that as a basis of figuring out what libraries need to be linked in, set up import search paths, etc.
Create project by dub init dsfml_test (where dsfml_test is our project name)
Add libs dependencies to dub.json
Generate Visual Studio project
Open project in Visual Studio
Open project properties
Enter path to directory where is placed dsfml lib files
Thats all. Now can add import dsfml.graphics, dsfml.window, dsfml.system; ...etc and build project.

Can't view Application property page - E_FAIL / Method Not Implemented

In the Solution Explorer in Visual Studio 2012, I right click on my wp8 project and go Properties, and the Application tab shows:
An error occurred trying to load the page.
Error HRESULT E_FAIL has been returned from a call to a COM component.
or
An error occurred trying to load the page.
The method or operation is not implemented.
Would anyone know how to go about debugging this?
I cannot repro this problem with a fresh project, but haven't been able to nail out where it is failing in my project...
Maybe related to AssemblyInfo.cs? Source file 'Properties\AssemblyInfo.cs' could not be found
BTW it builds and deploys to my device just fine...
Thanks
So after an exhaustive round of brute force elimination, I was able to narrow this down to my use of .java files. Yes it is weird, but it has worked. I have been including .java files in my project and setting their properties to Compile as c#. There were merge reasons for doing so, and I had of course modified the java code slightly to compile, but somehow Visual Studio's property pages spaz out when a .java file is included this way, even though the project compiles just fine. So I wrote a little tool to copy all the .java files to .java.cs and include them that way and everything is fine now!
I found this issue in all of my projects and reasoned it might have had to do with a recent Windows update. I updated VS 2017 to 15.9.15 and that resolved it for me.

Resources