And just another update on how this is going:

I must say that all seems to be working quite well. I have been using
aspects the whole day and haven’t had many problems at all.

I am using 2 mainly:
- The first one is the INotifyPropertyChanged aspect :) This was originally
created for our main Silverlight project, but I was able use it Mono for
Android without any code changes.
- The other was a IEditableObject thing. It would create and implement the
BeginEdit/EndEdit/CancelEdit methods of any class. It would automatically
serialize/deserialize the view model into a temporary json string. This was
used to remove the need of having to re-download the object from the
server. I am currently having problems with the DataContractJsonSeriaizer,
but I am sure that its with the mono implementation, as the .NET one works.
Also, the RestSharp serializer/deserializer works, so I am going to try and
use that one instead in the aspect.

I would go so far as to say that it is better to see if you can get the
aspects working than trying to edit all your view models.

It is a bit disappointing that the PostSharp guys aren’t going to support
Mono for Android and MonoTouch. Maybe I can persuade them to "unofficially”
support it - just see if the basics work :)

So far, PostSharp does seem to work ok.

Matthew



Sent from my Windows 8 PC <http://windows.microsoft.com/consumer-preview>

 *From:* Miha Markic <[email protected]>
*Sent:* 03 August 2012 02:12:50 PM
*To:* Discussions related to Mono for Android <[email protected]>
*Subject:* Re: [mono-android] PostSharp 2.1 and Mono for Android


FYI I've asked Gael, the guy behind PS, and he, unfortunately, said
that no official support for monodroid is coming. That said PS could
still work but I'm not all that keen to use it.
Crap, back to implementation of all that INPC properties :-(

Matthew Leibowitz <[email protected]> wrote:


Well, some weird news, all is now working. I did nothing except:

 I first tried updating PostSharp to version 2.1.7.6. This made no changes.
Then, I created the sample in VS 2012:
http://www.sharpcrafters.com/postsharp/documentation#getting-started. No
work...
In utter desperation I created the same project in VS 2012. It worked. Hmm.
So I tried the VS 2012 project again. Still no go.
Then, the brainwave. The VS 2010 project works, so lets open that in VS
2012. That worked. The only difference was the project files and the VS
version.
I assumed that as the same project file (the one from VS 2010) worked in
both VS versions, then it must be the project file. Wrong! Both the code
and the project file were exactly the same. The only difference was the
project GUID - one line.

 Now here comes the crazy part (before I broke down in tears):
I opened the original project (the one with the errors). It now builds fine
:)

 Don't ask me what happened. I haven't touched that project since
yesterday. Maybe it was the upgrade slowly kicking in or maybe it was the
first build with VS 2010. Or maybe it was the incessant building and
re-building. (Or the hand waving).

 Note: you do need the PostSharp.Custom.targets file.

So the sum of the story is: It works. Who knows why.

 Hope this helps :)

 Matthew


 On Fri, Aug 3, 2012 at 8:46 AM, Matthew Leibowitz <[email protected]
> wrote:

> Hi,
>
>  That "when I get home" turned into a "tomorrow", but here is some more
> information:
>
>  With just a plain old PostSharp 2.1 install and a simple project I get
> this:
>
>   Unhandled exception (2.1.3.3, 32 bit, CLR 2.0, Release):
>> PostSharp.Sdk.CodeModel.BindingException: Cannot find the type
>> 'System.Func`2' in assembly 'mscorlib, Version=2.0.0.0, Culture=neutral,
>> PublicKeyToken=b77a5c561934e089'.
>>    at PostSharp.Sdk.CodeModel.AssemblyEnvelope.GetTypeDefinition(String
>> typeName, BindingOptions bindingOptions)
>>    at
>> PostSharp.Sdk.CodeModel.TypeRefDeclaration.GetTypeDefinition(BindingOptions
>> bindingOptions)
>>    at
>> PostSharp.Sdk.CodeModel.TypeSpecDeclaration.GetTypeDefinition(BindingOptions
>> bindingOptions)
>>    at
>> PostSharp.Sdk.Extensibility.Tasks.IndexGenericInstancesTask.Execute()
>>    at PostSharp.Sdk.Extensibility.Project.ExecutePhase(String phase)
>>    at PostSharp.Sdk.Extensibility.Project.Execute()
>>    at PostSharp.Hosting.PostSharpObject.ExecuteProjects()
>>    at PostSharp.Hosting.PostSharpObject.InvokeProject(ProjectInvocation
>> projectInvocation)
>
>
>  So following the tips of experts, I added a PostSharp.Custom.targetsfile to 
> my solution folder:
>
>   <?xml version="1.0" encoding="utf-8" ?>
>> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003";>
>>     <PropertyGroup>
>>
>> <PostSharpAssemblyBindingPolicySet>Silverlight20</PostSharpAssemblyBindingPolicySet>
>>     </PropertyGroup>
>> </Project>
>
>
>  This results in a new error:
>
>   Unhandled exception (2.1.3.3, 32 bit, CLR 2.0, Release):
>> PostSharp.Sdk.CodeModel.AssemblyLoadException: Cannot load assembly
>> mscorlib_3. [Version mismatch]
>> ============ PostSharp Assembly Loading Log ===================
>> LOG: Finding the assembly with binding identity 'mscorlib,
>> version=5.0.5.0, culture=neutral, publickeytoken=7cec85d7bea7798e,
>> processorarchitecture=msil'.
>> LOG: Probing location 'C:\Program Files (x86)\Reference
>> Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll' because this
>> file was explicitly added to the search path.
>> LOG: File 'C:\Program Files (x86)\Reference
>> Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll' has identity
>> 'mscorlib, version=2.0.5.0, culture=neutral,
>> publickeytoken=7cec85d7bea7798e, processorarchitecture=msil'.
>> LOG: File 'C:\Program Files (x86)\Reference
>> Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll' does not
>> match the reference.
>> LOG: Probing location 'C:\Program Files (x86)\PostSharp
>> 2.1\Release\mscorlib.exe' because this directory is in the search path.
>> LOG: The file 'C:\Program Files (x86)\PostSharp 2.1\Release\mscorlib.exe'
>> could not be found.
>> LOG: Probing location 'C:\Program Files (x86)\PostSharp
>> 2.1\Release\mscorlib.dll' because this directory is in the search path.
>> LOG: The file 'C:\Program Files (x86)\PostSharp 2.1\Release\mscorlib.dll'
>> could not be found.
>> LOG: Probing location
>> 'C:\BrandDirector\Mobile\Brandirector.Mobile\BrandDirector.Core.Aspects\mscorlib.exe'
>> because this directory is in the search path.
>> LOG: The file
>> 'C:\BrandDirector\Mobile\Brandirector.Mobile\BrandDirector.Core.Aspects\mscorlib.exe'
>> could not be found.
>> LOG: Probing location
>> 'C:\BrandDirector\Mobile\Brandirector.Mobile\BrandDirector.Core.Aspects\mscorlib.dll'
>> because this directory is in the search path.
>> LOG: The file
>> 'C:\BrandDirector\Mobile\Brandirector.Mobile\BrandDirector.Core.Aspects\mscorlib.dll'
>> could not be found.
>> LOG: Probing location 'C:\Program Files (x86)\PostSharp
>> 2.1\PlugIns\mscorlib.exe' because this directory is in the search path.
>> LOG: The file 'C:\Program Files (x86)\PostSharp 2.1\PlugIns\mscorlib.exe'
>> could not be found.
>> LOG: Probing location 'C:\Program Files (x86)\PostSharp
>> 2.1\PlugIns\mscorlib.dll' because this directory is in the search path.
>> LOG: The file 'C:\Program Files (x86)\PostSharp 2.1\PlugIns\mscorlib.dll'
>> could not be found.
>> LOG: Probing location
>> 'C:\BrandDirector\Mobile\Brandirector.Mobile\BrandDirector.Core.Aspects\bin\Debug\mscorlib.exe'
>> because this directory is in the search path.
>> LOG: The file
>> 'C:\BrandDirector\Mobile\Brandirector.Mobile\BrandDirector.Core.Aspects\bin\Debug\mscorlib.exe'
>> could not be found.
>> LOG: Probing location
>> 'C:\BrandDirector\Mobile\Brandirector.Mobile\BrandDirector.Core.Aspects\bin\Debug\mscorlib.dll'
>> because this directory is in the search path.
>> LOG: The file
>> 'C:\BrandDirector\Mobile\Brandirector.Mobile\BrandDirector.Core.Aspects\bin\Debug\mscorlib.dll'
>> could not be found.
>> LOG: Probing location
>> 'C:\BrandDirector\Mobile\Brandirector.Mobile\BrandDirector.Core.Aspects\obj\Debug\mscorlib.exe'
>> because this directory is in the search path.
>> LOG: The file
>> 'C:\BrandDirector\Mobile\Brandirector.Mobile\BrandDirector.Core.Aspects\obj\Debug\mscorlib.exe'
>> could not be found.
>> LOG: Probing location
>> 'C:\BrandDirector\Mobile\Brandirector.Mobile\BrandDirector.Core.Aspects\obj\Debug\mscorlib.dll'
>> because this directory is in the search path.
>> LOG: The file
>> 'C:\BrandDirector\Mobile\Brandirector.Mobile\BrandDirector.Core.Aspects\obj\Debug\mscorlib.dll'
>> could not be found.
>> LOG: Probing location 'C:\Program Files (x86)\Reference
>> Assemblies\Microsoft\Framework\MonoAndroid\v2.2\mscorlib.exe' because this
>> directory is in the search path.
>> LOG: The file 'C:\Program Files (x86)\Reference
>> Assemblies\Microsoft\Framework\MonoAndroid\v2.2\mscorlib.exe' could not be
>> found.
>> LOG: Probing location 'C:\Program Files (x86)\Reference
>> Assemblies\Microsoft\Framework\MonoAndroid\v2.2\mscorlib.dll' because this
>> directory is in the search path.
>> LOG: The file 'C:\Program Files (x86)\Reference
>> Assemblies\Microsoft\Framework\MonoAndroid\v2.2\mscorlib.dll' could not be
>> found.
>> LOG: Probing location 'C:\Program Files (x86)\Reference
>> Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.exe' because this
>> directory is in the search path.
>> LOG: The file 'C:\Program Files (x86)\Reference
>> Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.exe' could not be
>> found.
>> LOG: Probing location 'C:\Program Files (x86)\Reference
>> Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll' because this
>> directory is in the search path.
>> LOG: File 'C:\Program Files (x86)\Reference
>> Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll' has identity
>> 'mscorlib, version=2.0.5.0, culture=neutral,
>> publickeytoken=7cec85d7bea7798e, processorarchitecture=msil'.
>> LOG: File 'C:\Program Files (x86)\Reference
>> Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll' does not
>> match the reference.
>> LOG: The assembly 'mscorlib_3' was not found.
>> ===============================================================
>>    at PostSharp.Sdk.CodeModel.Domain.GetAssembly(IAssemblyName
>> assemblyName, BindingOptions bindingOptions)
>>    at PostSharp.Sdk.CodeModel.AssemblyRefDeclaration.GetAssemblyEnvelope()
>>    at
>> PostSharp.Sdk.Extensibility.Tasks.MulticastAttributeTask.^SgrhoGlQ(AssemblyRefDeclaration
>> _0)
>>    at
>> PostSharp.Sdk.Extensibility.Tasks.MulticastAttributeTask.^+GwnKh4ZYHu3()
>>    at PostSharp.Sdk.Extensibility.Tasks.MulticastAttributeTask.Execute()
>>    at PostSharp.Sdk.Extensibility.Project.ExecutePhase(String phase)
>>    at PostSharp.Sdk.Extensibility.Project.Execute()
>>    at PostSharp.Hosting.PostSharpObject.ExecuteProjects()
>>    at PostSharp.Hosting.PostSharpObject.InvokeProject(ProjectInvocation
>> projectInvocation)
>
>
>  Not quite sure what this means...
>
>  I will try some other things, but if this rings any bells with you guys
> out there, let me know.
>
>  Matthew
>
>
> On Thu, Aug 2, 2012 at 6:30 PM, Matthew Leibowitz <
> [email protected]> wrote:
>
>> Hi all,
>>
>> Has anyone tried using postsharp 2.1 with mono for android?
>>
>> One guy managed to get it to work, but he was using version 2. Version
>> 2.1 seems to use the mscorlib 5? Maybe its because of silverlight 5 being
>> installed?
>>
>> I'll see if I can give some more info when I get home, but I just wanted
>> to see if anyone tried something?
>>
>> Matthew
>>
>> Sent from my Android.
>>
>
>

_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to