First I got this issue:
Using Office 365 API in Xamarin.Android
Now testing the same in Xamarin IOS I got another :(
{System.NullReferenceException: Object reference not set to an instance of an object
at Microsoft.Office365.OAuth.Authenticator.GetRefreshToken (System.String resource) [0x00000] in <filename unknown>:0
at Microsoft.Office365.OAuth.Authenticator+<GetAuthenticationResult>d__c.MoveNext () [0x00000] in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:62
at System.Runtime.CompilerServices.TaskAwaiter`1[Microsoft.Office365.OAuth.AuthenticationInfo].GetResult () [0x00034] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.CompilerServices/TaskAwaiter_T.cs:59
at Microsoft.Office365.OAuth.Authenticator+<AuthenticateAsync>d__6.MoveNext () [0x00000] in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:62
at System.Runtime.CompilerServices.TaskAwaiter`1[Microsoft.Office365.OAuth.AuthenticationInfo].GetResult () [0x00034] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.CompilerServices/TaskAwaiter_T.cs:59
at Office365InXamarinApps.ViewModel.ContactsViewModel+<EnsureClientCreated>d__9.MoveNext () [0x00046] in c:\DevApps\GitHub\Office365InXamarinApps\scr\Office365InXamarinApps\Office365InXamarinApps\ViewModel\ContactsViewModel.cs:76 }
The code is here: https://github.com/saramgsilva/Office365InXamarinApp
The Office 365 API Preview has issues and I cannot use it, for this reason I created another demo using Office 365 REST API.
https://github.com/saramgsilva/Office365RESTAPISample
You may want to check out this blog post (see link in Xamarin Forum) -Xamarin developer was able to get it working in Android
http://forums.xamarin.com/discussion/21367/put-some-office-365-in-your-apps
Related
In my Xamarin Forms project, when I call a function that uses Realm (the project with common code) from iOS project, I get the following exception. From Android project it works fine. The exception occurs when trying to get the Realm instance with Realm.GetInstance(). Any idea why this happens and how to fix it?
{System.TypeInitializationException: The type initializer for 'Realms.SharedRealmHandle' threw an exception. ---> System.ExecutionEngineException: Attempting to JIT compile method '(wrapper native-to-managed) Realms.SynchronizationContextEventLoopSignal:GetCurrentSynchronizationContext ()' while running in aot-only mode. See https://developer.xamarin.com/guides/ios/advanced_topics/limitations/ for more information.
at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_delegate_to_ftnptr(object)
at (wrapper managed-to-native) Realms.SynchronizationContextEventLoopSignal.install_eventloop_callbacks(Realms.SynchronizationContextEventLoopSignal/get_eventloop,Realms.SynchronizationContextEventLoopSignal/post_on_event_loop,Realms.SynchronizationContextEventLoopSignal/release_eventloop)
at Realms.SynchronizationContextEventLoopSignal.Install () [0x0003b] in /Users/realm/workspace/realm_realm-dotnet_PR-1723/Realm/Realm/Native/SynchronizationContextEventLoopSignal.cs:122
at Realms.NativeCommon.Initialize () [0x00119] in /Users/realm/workspace/realm_realm-dotnet_PR-1723/Realm/Realm/Native/NativeCommon.cs:91
at Realms.SharedRealmHandle..cctor () [0x00000] in /Users/realm/workspace/realm_realm-dotnet_PR-1723/Realm/Realm/Handles/SharedRealmHandle.cs:124
--- End of inner exception stack trace ---
at Realms.RealmConfiguration.CreateRealm (Realms.Schema.RealmSchema schema) [0x000b4] in /Users/realm/workspace/realm_realm-dotnet_PR-1723/Realm/Realm/RealmConfiguration.cs:153
at Realms.Realm.GetInstance (Realms.RealmConfigurationBase config, Realms.Schema.RealmSchema schema) [0x0003f] in /Users/realm/workspace/realm_realm-dotnet_PR-1723/Realm/Realm/Realm.cs:138
at Realms.Realm.GetInstance (Realms.RealmConfigurationBase config) [0x00000] in /Users/realm/workspace/realm_realm-dotnet_PR-1723/Realm/Realm/Realm.cs:80
at Realms.Realm.GetInstance (System.String databasePath) [0x00000] in /Users/realm/workspace/realm_realm-dotnet_PR-1723/Realm/Realm/Realm.cs:67
at NumeropakettiMobile.LocalDB+<UpdateDB>d__0.MoveNext () [0x00023] in /Users/lasse/Code/numeropaketti_mobile/NumeropakettiMobile/NumeropakettiMobile/LocalDB.cs:17 }
I can't even compile the default project from visual studio. I created a new project from the new project menu in a fresh directory, changed the app identifier to my apple developer app name, and compile, and it tells me that Default-568#2x.png does not exist.
here is the full error:
System.IO.FileNotFoundException: /Users/boemanation/Library/Caches/Xamarin/mtbs/builds/OpenGL_Xamarin_TestiOS/ddf7db6bef3b320db45c7f9f5fb4bd29/obj/iPhone/Debug/optimized/Default-568h#2x.png does not exist
File name: '/Users/boemanation/Library/Caches/Xamarin/mtbs/builds/OpenGL_Xamarin_TestiOS/ddf7db6bef3b320db45c7f9f5fb4bd29/obj/iPhone/Debug/optimized/Default-568h#2x.png'
at System.IO.File.Copy (System.String sourceFileName, System.String destFileName, Boolean overwrite) <0x34bb690 + 0x002ff> in <filename unknown>:0
at Xamarin.MacDev.Tasks.SmartCopyTaskBase.CopyFile (System.String source, System.String target, System.String targetItemSpec) <0x34bb578 + 0x000c7> in <filename unknown>:0
at Xamarin.MacDev.Tasks.SmartCopyTaskBase.Execute () <0x34bad88 + 0x00227> in <filename unknown>:0 OpenGL_Xamarin_Test.iOS
I am completely stumped. any ideas?
project > properties > disable "Optimize PNG images files for iOS"
This is a workaround to solve this issue.
On my iOS project, my app crash to start in debug , but in release it works.
Xamarin Forms : 1.3
Xamarin Forms Labs 1.2.1 Pre 2
My error :
Exception has been thrown by the target of an invocation.
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00016] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:543
at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x000af] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/Activator.cs:329
at System.Activator.CreateInstance (System.Type type) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/Activator.cs:222
at Xamarin.Forms.Xaml.CreateValuesVisitor.Visit (Xamarin.Forms.Xaml.ElementNode node, INode parentNode) [0x00000] in <filename unknown>:0
Attempting to JIT compile method 'Microsoft.Scripting.Interpreter.LightLambda:MakeRun1<InviteVite.Entities.Event, System.DateTime> (Microsoft.Scripting.Interpreter.LightLambda)' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information.
at Microsoft.Scripting.Interpreter.LightLambda.MakeDelegate (System.Type delegateType) [0x0000d] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.4.0.47/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightLambda.cs:177
at Microsoft.Scripting.Interpreter.LightDelegateCreator.CreateDelegate (System.Runtime.CompilerServices.StrongBox`1[] closure) [0x00000] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.4.0.47/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightDelegateCreator.cs:109
at Microsoft.Scripting.Interpreter.CreateDelegateInstruction.Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x00043] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.4.0.47/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/TypeOperations.cs:47
at Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x0001b] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.4.0.47/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Interpreter.cs:126
Thanks for your help
Have you tried enabling generic value type sharing?
Go to the iOS project's options, iOS Build section. On the Advanced tab check: "Enable generic value type sharing".
I'm updating the tooling for my project llvm-fs, so I installed the new version of mono and tried to compile it. Using either mono 3.10.0 with fsharpc 3.1 under OS X or mono 3.2.8 with fsharpc 3.0 under ubuntu the compile fails with a stack overflow:
Unhandled Exception:
System.StackOverflowException: The requested operation caused a stack overflow.
at (wrapper managed-to-native) object:__icall_wrapper_mono_object_isinst (object,intptr)
at (wrapper castclass) object:__castclass_with_cache (object,intptr,intptr)
at Microsoft.FSharp.Compiler.Driver+DelayedDisposables.System-IDisposable-Dispose () [0x00000] in <filename unknown>:0
at Microsoft.FSharp.Compiler.Driver.typecheckAndCompile (System.String[] argv, Boolean bannerAlreadyPrinted, Exiter exiter, Microsoft.FSharp.Compiler.ErrorLoggerProvider errorLoggerProvider) [0x00000] in <filename unknown>:0
at Microsoft.FSharp.Compiler.Driver.mainCompile (System.String[] argv, Boolean bannerAlreadyPrinted, Exiter exiter) [0x00000] in <filename unknown>:0
at Microsoft.FSharp.Compiler.CommandLineMain.runMain (System.String[] argv) [0x00000] in <filename unknown>:0
at Microsoft.FSharp.Compiler.CommandLineMain.main (System.String[] argv) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.StackOverflowException: The requested operation caused a stack overflow.
at (wrapper managed-to-native) object:__icall_wrapper_mono_object_isinst (object,intptr)
at (wrapper castclass) object:__castclass_with_cache (object,intptr,intptr)
at Microsoft.FSharp.Compiler.Driver+DelayedDisposables.System-IDisposable-Dispose () [0x00000] in <filename unknown>:0
at Microsoft.FSharp.Compiler.Driver.typecheckAndCompile (System.String[] argv, Boolean bannerAlreadyPrinted, Exiter exiter, Microsoft.FSharp.Compiler.ErrorLoggerProvider errorLoggerProvider) [0x00000] in <filename unknown>:0
at Microsoft.FSharp.Compiler.Driver.mainCompile (System.String[] argv, Boolean bannerAlreadyPrinted, Exiter exiter) [0x00000] in <filename unknown>:0
at Microsoft.FSharp.Compiler.CommandLineMain.runMain (System.String[] argv) [0x00000] in <filename unknown>:0
at Microsoft.FSharp.Compiler.CommandLineMain.main (System.String[] argv) [0x00000] in <filename unknown>:0
You can reproduce this error on linux or OS X by doing the following:
git clone git#github.com:fsprojects/llvm-fs.git
cd llvm-fs/
FSC=fsharpc ./build.bash
Under windows fsc 12.0.30815.0 the compile completes with no errors:
fsc --nologo --debug --sig:LLVMFSharp.fsi --target:library --out:LLVMFSharp.dll src/LLVM/FFIUtil.fs src/LLVM/Generated.fs src/LLVM/Core.fs src/LLVM/BitReader.fs src/LLVM/ExecutionEngine.fs src/LLVM/Extra.fs src/LLVM/Target.fs src/LLVM/Quote.fs
Is this a known issue and is there any way to work around it? I've tried passing different options to the mono runtime and none resulted in the compiler exiting normally. I do remember in the past mono has had some problems respecting tailcall instructions but I thought that those problems were mostly resolved. Thanks!
This is too long for a comment, but the error is triggered by this bit of code from generated.fs (in that commenting it out stops the stack overflow - there is an error later once this is commented out) (from line 6496-6506):
[<DllImport(
llvmAssemblyName,
EntryPoint="LLVMRunFunction",
CallingConvention=CallingConvention.Cdecl,
CharSet=CharSet.Ansi)>]
extern void* (* LLVMGenericValueRef *) runFunctionNative(
void* (* LLVMExecutionEngineRef *) EE,
void* (* LLVMValueRef *) F,
uint32 NumArgs,
void* (* LLVMGenericValueRef* *) Args)
// I don't know how to generate an "F# friendly" version of LLVMRunFunction
The crash is occuring in the code that outputs the signature file.
Disabling the signature file fixes the problem (but there is still an underlying bug somewhere).
I'm building an ASP.NET MVC application and I'm trying to deploy it on a free host (0000free) which does support ASP.NET. I tried a couple of things, but none of them worked (i.e. I only see the directory structure when I browse to my web site):
Publishing to a local folder and then copying the published files via ftp over to my host (in the public_html directory).
Publishing via ftp to the root folder: ftp.mywebsite.com
Publishing via ftp to the public_html folder: ftp.mywebsite.com/public_html
Usually I would just drop the html files in the public_html folder, but I'm getting the feeling that the deployment process for an MVC application is slightly different. Do I have to modify the Web.config or some other filer? How does one usually deploy an MVC application (on a free host)?
Update:
I have learned that the host uses Mono and supports .NET 4.0, but I'm still not able to deploy.
I have Visual Studio 2010 and I used its Publish Feature (i.e. right click on the project name and click publish) and I tried several things:
Publish method: FTP to the root folder.
Publish method: FTP to the publich_html folder.
Publish method: File System to the root folder.
Publish method: File System to the publich_html folder.
Publish method: File System to a local directory on my computer and then FTP to root and also tried the public_html folder.
I went into the cPanel (control panel) to try and see if ASP.NET has to be added/enabled for my web site, but I didn't see anything there.
I can't browse to Index.aspx nor can I redirect to it from index.html (as suggested from other posts on the host forum), right now I have a link from index.html to Index.aspx but it's not working either (see http://www.mydevarmy.com)
I've also tried renaming Index.aspx to Default.aspx, but that doesn't work either.
The search utility of the forum of the host is somewhat weak, so I use google to search their forum: http://www.google.com/search?q=publish+asp.net+site%3A0000free.com%2Fforum%2F&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a
I've been reading Pro ASP.NET MVC Framework and they have a chapter about publishing, but it doesn't provide any specific information with respect to the location of publishing, this is all they say (and it's not very helpful in my case):
Where Should I Put My Application?
You can deploy your application to any
folder on the server. When IIS first
installs, it automatically creates a
folder for a web site called Default
Web Site at c:\Inetpub\wwwroot\, but
you shouldn’t feel any obligation to
put your application files there. It’s
very common to host applications on a
different physical drive from the
operating system (e.g., in
e:\websites\ example.com). It’s
entirely up to you, and may be
influenced by concerns such as how you
plan to back up the server.
Here is the error I get when I try to view my Index.aspx page:
Unrecognized attribute 'targetFramework'. (/home/devarmy/public_html/Web.config line 1)
Description: HTTP 500. Error processing request.
Stack Trace:
System.Configuration.ConfigurationErrorsException: Unrecognized attribute 'targetFramework'. (/home/devarmy/public_html/Web.config line 1)
at System.Configuration.ConfigurationElement.DeserializeElement (System.Xml.XmlReader reader, Boolean serializeCollectionKey) [0x00000] in <filename unknown>:0
at System.Configuration.ConfigurationSection.DoDeserializeSection (System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0
at System.Configuration.ConfigurationSection.DeserializeSection (System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0
at System.Configuration.Configuration.GetSectionInstance (System.Configuration.SectionInfo config, Boolean createDefaultInstance) [0x00000] in <filename unknown>:0
at System.Configuration.ConfigurationSectionCollection.get_Item (System.String name) [0x00000] in <filename unknown>:0
at System.Configuration.Configuration.GetSection (System.String path) [0x00000] in <filename unknown>:0
at System.Web.Configuration.WebConfigurationManager.GetSection (System.String sectionName, System.String path, System.Web.HttpContext context) [0x00000] in <filename unknown>:0
at System.Web.Configuration.WebConfigurationManager.GetSection (System.String sectionName, System.String path) [0x00000] in <filename unknown>:0
at System.Web.Configuration.WebConfigurationManager.GetWebApplicationSection (System.String sectionName) [0x00000] in <filename unknown>:0
at System.Web.Compilation.BuildManager.get_CompilationConfig () [0x00000] in <filename unknown>:0
at System.Web.Compilation.BuildManager.Build (System.Web.VirtualPath vp) [0x00000] in <filename unknown>:0
at System.Web.Compilation.BuildManager.GetCompiledType (System.Web.VirtualPath virtualPath) [0x00000] in <filename unknown>:0
at System.Web.Compilation.BuildManager.GetCompiledType (System.String virtualPath) [0x00000] in <filename unknown>:0
at System.Web.HttpApplicationFactory.InitType (System.Web.HttpContext context) [0x00000] in <filename unknown>:0
If your hosting provider supports ASP.NET MVC then your deployment process shouldn't be any different than the one for a normal ASP.NET application. If it doesn't you could attempt a bin-deployment. And here's another article on MSDN.
It turns out that the Mono version does not support MVC, so I had to change my host to one that supports ASP.NET MVC. I had to dish out some cash, but "good hosting" isn't free. Anyway, thanks for the help everybody!