I've recently came across the blog article Monovation: Assembly Injection into Live Processes of Miguel de Icaza.
I've tried to reproduce it with no luck. My command line was
'csharp --attach 5612'
where 5612 was the pid of a simple running mono 'Hello World' console application.
I've got an exception (see the stack trace above).
What I've tried so far:
using Mono 2.10.8 (csharp and csharp2 commands for .NET 4 and 2 )
using Mono 3.2.3 (only csharp command exists)
Q1: Missed I something?
Q2: Is it possible that this virtual machine attach facility (see Monovation: Assembly Injection into Live Processes) is available only in Linux installations? (I am using Windows 7) It sounds an easy answer, but Miguel does not mention platform restriction in his article, and the whole point of mono is the multiplatform, is not it? So I can not believe it so easy.
Q3: What about Mac? Is there any chance it will work in a Mac, or we must look elsewhere?
Thx in advance
Stack trace:
Unhandled Exception:
System.TypeInitializationException: An exception was thrown by the type initializer for Mono.Unix.Native.Syscall ---> System.EntryPointNotFoundException: Mono_Posix_Syscall_get_at_fdcwd
at (wrapper managed-to-native) Mono.Unix.Native.Syscall:get_at_fdcwd ()
at Mono.Unix.Native.Syscall..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Mono.Unix.UnixUserInfo.GetRealUserId () [0x00000] in <filename unknown>:0
at Mono.Unix.UnixUserInfo.GetRealUser () [0x00000] in <filename unknown>:0
at Mono.Attach.VirtualMachine.Attach (System.String agent, System.String args) [0x00000] in <filename unknown>:0
at Mono.ClientCSharpShell..ctor (Mono.CSharp.Evaluator evaluator, Int32 pid) [0x00000] in <filename unknown>:0
at Mono.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: An exception was thrown by the type initializer for Mono.Unix.Native.Syscall ---> System.EntryPointNotFoundException: Mono_Posix_Syscall_get_at_fdcwd
at (wrapper managed-to-native) Mono.Unix.Native.Syscall:get_at_fdcwd ()
at Mono.Unix.Native.Syscall..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Mono.Unix.UnixUserInfo.GetRealUserId () [0x00000] in <filename unknown>:0
at Mono.Unix.UnixUserInfo.GetRealUser () [0x00000] in <filename unknown>:0
at Mono.Attach.VirtualMachine.Attach (System.String agent, System.String args) [0x00000] in <filename unknown>:0
at Mono.ClientCSharpShell..ctor (Mono.CSharp.Evaluator evaluator, Int32 pid) [0x00000] in <filename unknown>:0
at Mono.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0
Related
I'm creating an app using xamarin Cross Platform. Everything is working in debug, but when i bulid app in release version, app crashes. Application output:
ERROR:
[mono] Unhandled Exception: [mono] System.MissingMethodException:
Method not found: 'System.Net.Http.HttpClient.GetAsync'.
[mono] at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[<LoadData>d__0] (POSSector.Mobile.<LoadData>d__0& stateMachine)
[0x00000] in <filename unknown>:0
[mono] at POSSector.Mobile.LoginViewModel.LoadData ()
[0x00000] in <filename unknown>:0
[mono] at POSSector.Mobile.LoginCommand+<Bind>d__3.MoveNext () [0x00000] in <filename unknown>:0
[mono] --- End of stack trace from previous location where exception was thrown --- [mono] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()
[0x00000] in <filename unknown>:0 [mono] at System.Runtime.CompilerServices.TaskAwaiter.GetResult ()
[0x00000] in <filename unknown>:0 [mono] at POSSector.Mobile.LoginCommand+<Execute>d__0.MoveNext ()
[0x00000] in <filename unknown>:0
[mono-rt] [ERROR] FATAL UNHANDLED EXCEPTION: System.MissingMethodException: Method not found: 'System.Net.Http.HttpClient.GetAsync'.
In Options - Android Build- Linker / I set Don link and my App work !
Info for problem
I'm having a problems building a PCL in Xamarin Studio on the Mac. It works fine in debug mode but fody throws an exception in Release Mode.
Exception during build is listed below.
Error: Fody: An unhandled exception occurred:
Exception:
Symbol file `XXX/obj/Release/XXX.dll.mdb' does not match assembly `XXX/obj/Release/XXX.dll'
StackTrace:
at Mono.CompilerServices.SymbolWriter.MonoSymbolFile.CheckGuidMatch (Guid other, System.String filename, System.String assembly) [0x00000] in <filename unknown>:0
at Mono.CompilerServices.SymbolWriter.MonoSymbolFile..ctor (System.String filename, Mono.Cecil.ModuleDefinition module) [0x00000] in <filename unknown>:0
at Mono.CompilerServices.SymbolWriter.MonoSymbolFile.ReadSymbolFile (Mono.Cecil.ModuleDefinition module, System.String filename) [0x00000] in <filename unknown>:0
at Mono.Cecil.Mdb.MdbReaderProvider.GetSymbolReader (Mono.Cecil.ModuleDefinition module, System.String fileName) [0x00000] in <filename unknown>:0
at Mono.Cecil.ModuleReader.ReadSymbols (Mono.Cecil.ModuleDefinition module, Mono.Cecil.ReaderParameters parameters) [0x00000] in <filename unknown>:0
at Mono.Cecil.ModuleReader.CreateModuleFrom (Mono.Cecil.PE.Image image, Mono.Cecil.ReaderParameters parameters) [0x00000] in <filename unknown>:0
at Mono.Cecil.ModuleDefinition.ReadModule (System.IO.Stream stream, Mono.Cecil.ReaderParameters parameters) [0x00000] in <filename unknown>:0
at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x00000] in <filename unknown>:0
at InnerWeaver.ReadModule () [0x00000] in <filename unknown>:0
at InnerWeaver.Execute () [0x00000] in <filename unknown>:0
Source:
Mono.Cecil.Mdb
TargetSite:
Void CheckGuidMatch(System.Guid, System.String, System.String)
Fody needs the debug information (*.mdb file) associated with the outputted assembly to perform the weaving step. Release builds by default turn off the Debug Information field within Build -> Compiler in a projects settings.
Having this build option set to None disables debug symbolication and results in the mdb file getting out of sync, hence the Symbol file 'XXX/obj/Release/XXX.dll.mdb' does not match assembly XXX/obj/Release/XXX.dll exception.
Therefore you need to enable Symbols Only or Full when you build projects in release mode when Fody is integrated into the build process:
You may have already, but I'd start with this if it was me:
Right click on your solution
Properties
Configuration Properties / Configuration
In the "Configuration" drop down in the top left, check that the "Debug" configuration (re: Platform | Build | Deploy) matches "Release".
We are busy with an application on a rasp pi where we retrieve a google calendar with the Google Calendar API. We wrote it in C# and tested it on Windows where i works fine. When we compile it on the Rasp PI (xbuild) we don't get any errors, but when we run (mono) it we get the following error:
Unhandled Exception: Google.GData.Client.GDataRequestException: Execution of request failed: http://www.google.com/calendar/feeds/USERNAME#gmail.com/private/full?start-min=2013-10-29T14:11:41Z ---> System.Net.WebException: The remote server returned an error: (401) Authorization required.
at System.Net.HttpWebRequest.CheckFinalStatus (System.Net.WebAsyncResult result) [0x00000] in <filename unknown>:0
at System.Net.HttpWebRequest.SetResponseData (System.Net.WebConnectionData data) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Google.GData.Client.GDataRequest.Execute () [0x00000] in <filename unknown>:0
at Google.GData.Client.GDataGAuthRequest.Execute (Int32 retryCounter) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: Google.GData.Client.GDataRequestException: Execution of request failed: http://www.google.com/calendar/feeds/USERNAME#gmail.com/private/full?start-min=2013-10-29T14:11:41Z ---> System.Net.WebException: The remote server returned an error: (401) Authorization required.
at System.Net.HttpWebRequest.CheckFinalStatus (System.Net.WebAsyncResult result) [0x00000] in <filename unknown>:0
at System.Net.HttpWebRequest.SetResponseData (System.Net.WebConnectionData data) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Google.GData.Client.GDataRequest.Execute () [0x00000] in <filename unknown>:0
at Google.GData.Client.GDataGAuthRequest.Execute (Int32 retryCounter) [0x00000] in <filename unknown>:0
Could someone help us, we don't see a solution.
We solved the authentification problem with running the following code:
mozroots --import --ask-remove
this is because Mono (by default) doesn't allow outside connections, so you have add it to the certificate list.
Is there any way to use Excel / Office libraries in Ubuntu?
I've developed a C# program that glues together an Excel spreadsheet and some VB macros. It uses the following.
Excel and Office libraries: Microsoft.Vbe.Interop.dll
Microsoft.Office.Interop.Excel.dll and Office.dll. It works perfectly fine in Windows but I can't manage to get it running on Ubuntu using Mono 3.2.
When I try to execute it (after adding the libraries that I explicitly imported using gacutil -l XXXX.dll)
the output is the following:
[ERROR] FATAL UNHANDLED EXCEPTION: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.DllNotFoundException: ole32.dll
at (wrapper managed-to-native) System.__ComObject:CoCreateInstance (System.Guid,intptr,uint,System.Guid,intptr&)
at System.__ComObject.Initialize (System.Type t) [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.__ComObject:Initialize (System.Type)
at Mono.Interop.ComInteropProxy.CreateProxy (System.Type t) [0x00000] in <filename unknown>:0
at System.Runtime.Remoting.RemotingServices.CreateClientProxyForComInterop (System.Type type) [0x00000] in <filename unknown>:0
at System.Runtime.Remoting.Activation.ActivationServices.CreateProxyForType (System.Type type) [0x00000] in <filename unknown>:0
at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0
at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x00000] in <filename unknown>:0
at System.Activator.CreateInstance (System.Type type) [0x00000] in <filename unknown>:0
at MyProgram.Program.joinMacroAndExcel () [0x00000] in <filename unknown>:0
at MyProgram.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
Any help or direction would be highly appreciated. Thanks in advance.
Josh
The Excel / Office integration libraries require Office to already be installed to run - just copying the PIAs (e.g. Microsoft.Office.Interop.Excel.dll) is insufficient, as they are to act as the bridge to the COM layer exposed by Excel et al. Without the COM layer, there's nothign to perform the work you're asking of it.
I need help with this following exception. I am trying to consume a web WCF web service using basicHttpSecurity etc. I had a look at the Dev Pipe for Mono and what I am consuming is in the working section.
So the service im trying to consume is AccountService.svc. The proxy that is generated has a AccountServiceClient() object that I am using. On the line where you create the object it throws an exception and there is no way of debugging and stepping into that constructor.
The strange thing is that I can consume this service on my Windows Machine going though IIS. I can also consume with my Mac PC using the mod mono extension ect. But not on Ubuntu Linux machine. Can anyone shed some light on this? Can anyone explain why this is happening? How do I fix this?
Me creating a new instance of the client.
client = new AccountServiceClient ();
The AccountServiceClient() sniplet
public partial class AccountServiceClient : System.ServiceModel.ClientBase<EServicesAccountProxy.IAccountService>, EServicesAccountProxy.IAccountService
The exception that gets thrown.
System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (System.Reflection.Assembly,bool)
at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0
at System.ServiceModel.Configuration.ConfigUtil.GetTypeFromConfigString (System.String name, NamedConfigCategory category) [0x00000] in <filename unknown>:0
at System.ServiceModel.ChannelFactory.ApplyConfiguration (System.String endpointConfig) [0x00000] in <filename unknown>:0
at System.ServiceModel.ChannelFactory.InitializeEndpoint (System.String endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) [0x00000] in <filename unknown>:0
at System.ServiceModel.ChannelFactory`1[EServicesAccountProxy.IAccountService]..ctor (System.String endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) [0x00000] in <filename unknown>:0
at System.ServiceModel.ClientBase`1[EServicesAccountProxy.IAccountService].Initialize (System.ServiceModel.InstanceContext instance, System.String endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) [0x00000] in <filename unknown>:0
at System.ServiceModel.ClientBase`1[EServicesAccountProxy.IAccountService]..ctor (System.ServiceModel.InstanceContext instance, System.String endpointConfigurationName) [0x00000] in <filename unknown>:0
at System.ServiceModel.ClientBase`1[EServicesAccountProxy.IAccountService]..ctor (System.ServiceModel.InstanceContext instance) [0x00000] in <filename unknown>:0
at System.ServiceModel.ClientBase`1[EServicesAccountProxy.IAccountService]..ctor () [0x00000] in <filename unknown>:0
at EServicesAccountProxy.AccountServiceClient..ctor () [0x00000] in <filename unknown>:0
at TCShared.TCInsuranceSystem_EGW.GetAccount (TCShared.TCInsuranceSystemAccount objInsuranceSystemAccount) [0x00000] in <filename unknown>:0
A Strange thing i have noticed also is that I get a LoaderException as well (System.TypeLoadException). I don't know if it is related because the message says that it could not load type 'Npgsql.VisualStudio.NpgsqlObjectSelector' from 'Npgsql.VisualStudio, vserion=2.0.2.1, culture-neutral, PublicKeyToken=null'. Im not even using VisualStudio, im using monodevelop and XamarinStudio on my windows machine.
She source in the exception message says if comes from "mscorelib"
Any help will be appreciated.
Turns out there was an inner load exception and I had a Npgsql.VisualStudio DLL in my bin. Once i have removed that everything worked. Reflections failed to load that DLL because of missing references.