Forums

Help test next version of MonoDevelop/Xamarin Studio add-in

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

Re: Help test next version of MonoDevelop/Xamarin Studio add

Postby nerdzero » Sat Jan 04, 2014 2:48 am

Maybe. We are reaching the limits of my knowledge on the matter.

If I remember correctly, the issue with reflection-only loading was that it was leaking memory. I think the reason is that once an assembly is loaded, it can't be unloaded. So, every parse request in the IDE loads the assembly into memory again. A caching mechanism in Cobra.Compiler.dll that reuses data for assemblies that haven't changed might slow the leak enough to keep the system responsive for a longer coding session perhaps.

I seem to remember reading something about loading the assembly file into a byte array and then loading from that instead of directly off the disk. I'm not sure if that would make any difference though.

Didn't you add an environment variable to turn on reflection only loading? If so I could do some tests.
nerdzero
 
Posts: 286
Location: Chicago, IL

Re: Help test next version of MonoDevelop/Xamarin Studio add

Postby Charles » Sat Jan 04, 2014 3:06 pm

Ah yes, it's all coming back to me now.

Yes, a cache would help, but not really solve the problem. (We'll want one eventually to improve responsiveness.)

Also, I lean towards System.Reflection not because there is anything wrong with Cecil, but because we already have the code that reads libraries through System.Reflection.

I did some more digging and came across a solution I had read about before, but not yet tried. AppDomain has methods for loading assemblies, but not in reflection-only mode. However, you can create a temporary app domain and invoke Assembly.ReflectionLoadOnly from that, then dispose of the app domain when you're done. Here is a fairly tight example: https://gist.github.com/Shandem/7147978

But then we get into cross app domain calls, marshal by ref, performance issues, etc. Hmm. Maybe we should just use Cecil after all...
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Help test next version of MonoDevelop/Xamarin Studio add

Postby thriwkin » Wed Jan 08, 2014 7:19 pm

thriwkin wrote:
I want to think about it, maybe it will take a few days, before I post a reply.

nerdzero,
I thought that my reply would be out-of-topic here.
Therefore I started another thread.
thriwkin
 
Posts: 26

Re: Help test next version of MonoDevelop/Xamarin Studio add

Postby kobi7 » Tue Feb 25, 2014 12:02 pm

Hi nerdzero
I sometimes get the following error when working in MonoDevelop.
happens right after typing '.' dot (for example .myVar.doThat)
thanks.

"Error in text editor extension chain"
Details: (stack trace)
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object
at Cobra.Compiler.UseDirective.FindSymbol (System.String name) [0x00000] in <filename unknown>:0
at Cobra.Compiler.NameSpace._symbolsForNameFromUseDirectives (System.String name, Cobra.Core_ert_7d347f46c489d84e6e8efe588eda67f2.Set`1 members) [0x00000] in <filename unknown>:0
at Cobra.Compiler.NameSpace.SymbolForName (System.String name) [0x00000] in <filename unknown>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0
at Cobra.Core_ert_7d347f46c489d84e6e8efe588eda67f2.CobraImp.InvokeMethod (System.Object obj, System.String methodName, System.Object[] args) [0x00000] in <filename unknown>:0
at Cobra.Compiler.Compiler.SymbolForName (System.String name, Boolean haveThis, Boolean isLowerOkay) [0x00000] in <filename unknown>:0
at Cobra.Compiler.Compiler.SymbolForName (System.String name, Boolean haveThis) [0x00000] in <filename unknown>:0
at Cobra.Compiler.AbstractTypeIdentifier._symbolForName (System.String name) [0x00000] in <filename unknown>:0
at Cobra.Compiler.GenericTypeIdentifier._resolveType () [0x00000] in <filename unknown>:0
at Cobra.Compiler.AbstractTypeIdentifier.get_RealType () [0x00000] in <filename unknown>:0
at Cobra.Compiler.ProperDexer._bindInt () [0x00000] in <filename unknown>:0
at Cobra.Compiler.Node.BindInt () [0x00000] in <filename unknown>:0
at Cobra.Compiler.ProperDexer.get_ResultType () [0x00000] in <filename unknown>:0
at MonoDevelop.CobraBinding.Completion.CobraCompletionTextEditorExtension._getTypeForMemberCompletion (ISyntaxNode node) [0x00000] in <filename unknown>:0
at MonoDevelop.CobraBinding.Completion.CobraCompletionTextEditorExtension.HandleCodeCompletion (MonoDevelop.Ide.CodeCompletion.CodeCompletionContext context, Char completionChar, System.Int32& triggerWordLength) [0x00000] in <filename unknown>:0
at MonoDevelop.Ide.Gui.Content.CompletionTextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x00000] in <filename unknown>:0
at MonoDevelop.CobraBinding.Completion.CobraCompletionTextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x00000] in <filename unknown>:0
at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x00000] in <filename unknown>:0
at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x00000] in <filename unknown>:0
at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x00000] in <filename unknown>:0
at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x00000] in <filename unknown>:0
at MonoDevelop.Debugger.ExceptionCaughtTextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x00000] in <filename unknown>:0
at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x00000] in <filename unknown>:0
at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x00000] in <filename unknown>:0
at MonoDevelop.SourceEditor.ExtensibleTextEditor.ExtensionKeyPress (Key key, UInt32 ch, ModifierType state) [0x00000] in <filename unknown>:0
Falun Dafa is Good.
Truth, Compassion, Forbearance is Good.
kobi7
 
Posts: 82
Location: Israel

Re: Help test next version of MonoDevelop/Xamarin Studio add

Postby nerdzero » Tue Feb 25, 2014 12:36 pm

I've noticed this myself. I pushed a change to GitHub a couple days ago that I think should reduce the frequency with which this happens. If you're running anything higher than Cobra svn 3013 the add-in won't compile right now though.
nerdzero
 
Posts: 286
Location: Chicago, IL

Re: Help test next version of MonoDevelop/Xamarin Studio add

Postby Charles » Tue Feb 25, 2014 7:57 pm

It will build now. I applied your patch. Thanks.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Help test next version of MonoDevelop/Xamarin Studio add

Postby kobi7 » Thu Feb 27, 2014 10:12 am

Hi!
After updating I don't see the problem anymore
thanks, kobi
Falun Dafa is Good.
Truth, Compassion, Forbearance is Good.
kobi7
 
Posts: 82
Location: Israel

Re: Help test next version of MonoDevelop/Xamarin Studio add

Postby nerdzero » Thu Feb 27, 2014 11:58 am

Cool. Thanks for reporting back, kobi.
nerdzero
 
Posts: 286
Location: Chicago, IL

Re: Help test next version of MonoDevelop/Xamarin Studio add

Postby wilbertom » Wed May 28, 2014 9:29 pm

Hello,

I started programming in Cobra today. I love it so far but I'm having some issues with the editor.

I have never worked with Monodevelop nor .Net or C# so I have no idea how to troubleshoot this.

First when trying to install the Monodevelop binding I'm getting errors.

Code: Select all
~/Programming/Cobra/MonoDevelop.CobraBinding (master) wil$ cobra install.cobra

===============================================================================
This will compile and install the Cobra Language Binding addin for MonoDevelop.

The compiled assemblies will be copied to:
/home/wil/.local/share/MonoDevelop-4.0/LocalInstall/Addins/MonoDevelop.CobraBinding.0.5.2/
===============================================================================

Do you wish to continue? [Y/N]
y
Running xbuild...
Running /usr/local/bin/cobra...
Failed!
std out:
Compilation failed - 1 error, 0 warnings

std err:
Completion/Icons.cobra(47): error: Cannot compile initialization expression at this point. Add an explicit type to the `var` ("as <type>") or move to a `cue init` or change the expression.


The addin was not installed due to compilation errors.
~/Programming/Cobra/MonoDevelop.CobraBinding (master) wil$ git s
On branch master
Your branch is up-to-date with 'origin/master'.

nothing to commit, working directory clean
~/Programming/Cobra/MonoDevelop.CobraBinding (master) wil$



I included git status to show I haven't broke anything. I suspect it has something to do with my cobra or monodevelop version

Code: Select all
~/Programming/Cobra/MonoDevelop.CobraBinding (master) wil$ cobra --about

The Cobra Programming Language svn:3116 (post 0.9.6) / 2014-05-28
on Mono 3.2.8 CLR v4.0.30319 on Ubuntu 14.04 LTS
at /usr/local/cobra/Cobra-svn-3116/bin/cobra.exe

Copyright (C) 2003-2014 by Cobra Language LLC.  All Rights Reserved.

On the web:  http://cobra-language.com/
Source:      http://cobra-language.com/source
Support:     http://cobra-language.com/support
License:     http://www.opensource.org/licenses/mit-license.php

Usage:       cobra -h



Code: Select all
~/Programming/Cobra/MonoDevelop.CobraBinding (master) wil$ mono --version
Mono JIT compiler version 3.2.8 (Debian 3.2.8+dfsg-4ubuntu1)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
   TLS:           __thread
   SIGSEGV:       altstack
   Notifications: epoll
   Architecture:  amd64
   Disabled:      none
   Misc:          softdebug
   LLVM:          supported, not enabled.
   GC:            sgen


Code: Select all
MonoDevelop
Version 4.0.12


So I installed the binding using the gui as instructed in http://mdrepo.ramonrocha.com. All was working perfectly for about 6 hours but now I'm getting this error too.

Code: Select all
System.NullReferenceException: Object reference not set to an instance of an object
  at MonoDevelop.CobraBinding.TypeSystem.ParsedCobraDocument._getNodeFromIds (System.Collections.Generic.List`1 ids, ISyntaxNode parent, System.Collections.Generic.List`1 containingRegions) [0x00000] in <filename unknown>:0
  at MonoDevelop.CobraBinding.TypeSystem.ParsedCobraDocument._getNodeFromIds (System.Collections.Generic.List`1 ids, System.Collections.Generic.List`1 containingRegions) [0x00000] in <filename unknown>:0
  at MonoDevelop.CobraBinding.TypeSystem.ParsedCobraDocument.ResolveTextToNode (System.String text, System.Collections.Generic.List`1 containingRegions) [0x00000] in <filename unknown>:0
  at MonoDevelop.CobraBinding.TypeSystem.ParsedCobraDocument.ResolveOffsetToNode (Int32 offset, Mono.TextEditor.TextDocument txtDoc) [0x00000] in <filename unknown>:0
  at MonoDevelop.CobraBinding.Completion.CobraCompletionTextEditorExtension.HandleParameterCompletion (MonoDevelop.Ide.CodeCompletion.CodeCompletionContext context, Char completionChar) [0x00000] in <filename unknown>:0
  at MonoDevelop.Ide.Gui.Content.CompletionTextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x00000] in <filename unknown>:0
  at MonoDevelop.CobraBinding.Completion.CobraCompletionTextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x00000] in <filename unknown>:0
  at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x00000] in <filename unknown>:0
  at MonoDevelop.CobraBinding.Formatting.CobraIndentationTextEditorExtension.<>n__FabricatedMethod3 (Key , Char , ModifierType ) [0x00000] in <filename unknown>:0
  at MonoDevelop.CobraBinding.Formatting.CobraIndentationTextEditorExtension+<>c__DisplayClass1.<KeyPress>b__0 () [0x00000] in <filename unknown>:0
  at MonoDevelop.CobraBinding.Formatting.CobraIndentationTextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x00000] in <filename unknown>:0
  at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x00000] in <filename unknown>:0
  at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x00000] in <filename unknown>:0
  at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x00000] in <filename unknown>:0
  at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x00000] in <filename unknown>:0
  at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x00000] in <filename unknown>:0
  at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x00000] in <filename unknown>:0
  at MonoDevelop.Debugger.ExceptionCaughtTextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x00000] in <filename unknown>:0
  at MonoDevelop.SourceEditor.ExtensibleTextEditor.ExtensionKeyPress (Key key, UInt32 ch, ModifierType state) [0x00000] in <filename unknown>:0


I didn't want to open a github issue because I know it's probably an error on my setup.
wilbertom
 
Posts: 3

Re: Help test next version of MonoDevelop/Xamarin Studio add

Postby nerdzero » Thu May 29, 2014 12:08 am

Hi wilbertom,

Just last night (didn't even announce it yet), I created a new package and uploaded it to mdrepo.ramonrocha.com so currently GitHub and the add-in repo host the same thing, v0.5.2. Unfortunately, it only works on MonoDevelop/Xamarin Studio 4.2.5 and it appears you are on 4.0.12. Some APIs changed between these two versions so that's probably why it won't build for you, but that error message is weird. You could try to build this older version of the add-in from October: https://github.com/ramon-rocha/MonoDeve ... 721876.zip I think that's the last version that worked for 4.0.12 but I'm not sure if the latest version of Cobra will build it. You might be rim-rocked between incompatible versions of MonoDevelop and Cobra with regards to the addin.

Regarding the crash with the installation from the repo, does it happen all the time or only when you are working on a certain project or file? If you can help me reproduce it then I can probably fix it.

Oh, and to make things more confusing, the latest version of MonoDevelop is 5.0 which was just released today. This weekend, I will be pushing some changes to the add-in to make it work on that version as well.
nerdzero
 
Posts: 286
Location: Chicago, IL

PreviousNext

Return to Discussion

Who is online

Users browsing this forum: No registered users and 14 guests