OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

CLI language binding and .Net Framework 2.0?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
donw
Newbie
Newbie


Joined: 14 Nov 2005
Posts: 2
Location: Ottawa, ON, Canada

PostPosted: Mon Nov 14, 2005 7:59 am    Post subject: CLI language binding and .Net Framework 2.0? Reply with quote

I've been experimenting successfully with the CLI language binding using C# in Visual Studio 2003 with the .Net Framework 1.1. I would like to be able to move to Visual Studio 2005 with the .Net Framework 2.0. Does anyone know if this support is available already (where?) or when it is scheduled for release?
Back to top
View user's profile Send private message
LarsB
OOo Advocate
OOo Advocate


Joined: 31 Aug 2005
Posts: 445
Location: Hamburg, Germany

PostPosted: Mon Nov 14, 2005 8:54 am    Post subject: .net 2.0 Reply with quote

Hi,

I'm also using the CLI bindings for .net 1.1, but I don't think that there's
a .net 2.0 CLI implemenation. Maybe as workaround - the CLI Assemblies
should be part of the OpenOffice 2.0 sourcecode, so you could checkout
the sourcecode and drag the CLI source into a new VS 2005 project and try
to build the dll's. Don't know if this will work!?

Cheers
Lars B
_________________
AODC - A free OpenDocument Converter
AODL - An independent OpenDocument Library C#
EmbeddedOpenOffice .net UserControl C#
EmbeddedOpenOffice Visual Studio .net Add In

http://www.OpenDocument4all.com/
Back to top
View user's profile Send private message Visit poster's website
Gregos
General User
General User


Joined: 29 Nov 2005
Posts: 16
Location: Paris

PostPosted: Tue Dec 20, 2005 7:49 am    Post subject: Reply with quote

Hi Lars,

i'm currently trying to use CLI DLL's with VS 2005 and framework 2.0. It seems not works very well since the program bugs on the first line:

Code:
unoidl.com.sun.star.uno.XComponentContext xLocalContext = uno.util.Bootstrap.bootstrap();


Here is the error i have:

Quote:
LoaderLock was detected
Message: DLL 'C:\Program Files\OpenOffice.org 2.0\program\cli_uno.dll' is attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang.



And here the explications of the msdn help:

Quote:
The LoaderLock managed debugging assistant (MDA) detects attempts to execute managed code on a thread that holds the Microsoft Windows operating system loader lock. Any such execution is illegal because it can lead to deadlocks and to use of DLLs before they have been initialized by the operating system's loader.

Symptoms
The most common failure when executing code inside the operating system's loader lock is that threads will deadlock when attempting to call other Win32 functions that also require the loader lock. Examples of such functions are LoadLibrary, GetProcAddress, FreeLibrary, and GetModuleHandle. The application might not directly call these functions; the common language runtime (CLR) might call these functions as the result of a higher level call like Load or the first call to a platform invoke method.

Deadlocks can also occur if a thread is waiting for another thread to start or finish. When a thread starts or finishes executing, it must acquire the operating system's loader lock to deliver events to affected DLLs.

Finally, there are cases where calls into DLLs can occur before those DLLs have been properly initialized by the operating system's loader. Unlike the deadlock failures, which can be diagnosed by examining the stacks of all the threads involved in the deadlock, it is very difficult to diagnose the use of uninitialized DLLs without using this MDA.

Cause
Mixed managed/unmanaged C++ assemblies built for .NET Framework versions 1.0 or 1.1 generally attempt to execute managed code inside the loader lock unless special care has been taken, for example, linking with /NOENTRY. For a detailed description of these problems, see "Mixed DLL Loading Problem" in the MSDN .

Mixed managed/unmanaged C++ assemblies built for .NET Framework version 2.0 are less susceptible to these problems, having the same reduced risk as applications using unmanaged DLLs that violate the operating system's rules. For instance, if an unmanaged DLL's DllMain entry point calls CoCreateInstance to obtain a managed object that has been exposed to COM, the result is an attempt to execute managed code inside the loader lock.

Resolution
Look at the stack trace for the thread that has activated this MDA. The thread is attempting to illegally call into managed code while holding the operating system's loader lock. You will probably see a DLL's DllMain or equivalent entry point on the stack. The operating system's rules for what you can legally do from inside such an entry point are quite limited. These rules preclude any managed execution.

Effect on the Runtime
Typically, several threads inside the process will deadlock. One of those threads is likely to be a thread responsible for performing a garbage collection, so this deadlock can have a major impact on the entire process. Furthermore, it will prevent any additional operations that require the operating system's loader lock, like loading and unloading assemblies or DLLs and starting or stopping threads.

In some unusual cases, it is also possible for access violations or similar problems to be triggered in DLLs which are called before they have been initialized.

Output
This MDA reports that an illegal managed execution is being attempted. You need to examine the thread's stack to determine why the loader lock is occurring and how to correct the problem.



It's possible to disable the Manage Debugging Assistant by using a registry key:

Quote:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework]
"MDA"="0"


But i've got same error anyway...
Not sounds good Confused
Back to top
View user's profile Send private message
LarsB
OOo Advocate
OOo Advocate


Joined: 31 Aug 2005
Posts: 445
Location: Hamburg, Germany

PostPosted: Tue Dec 20, 2005 9:08 am    Post subject: CLI .net 2.0 Reply with quote

Hi,

I think it happens what I thought what could happen. The
.net world is a managed world and I think the unmanaged
code that is call by the assemblie is restricted under .net 2.0,
now. Currentyl I don't have the time, to have deeper look
at the sourcecode of the CLI assembies. So I can't give
you a tip how to solve the problem. I think move back to
the .net 1.1 is the only possible way, but maybe I'm wrong!?

Cheers
LarsB
_________________
AODC - A free OpenDocument Converter
AODL - An independent OpenDocument Library C#
EmbeddedOpenOffice .net UserControl C#
EmbeddedOpenOffice Visual Studio .net Add In

http://www.OpenDocument4all.com/
Back to top
View user's profile Send private message Visit poster's website
Gregos
General User
General User


Joined: 29 Nov 2005
Posts: 16
Location: Paris

PostPosted: Tue Dec 20, 2005 9:55 am    Post subject: Reply with quote

I'm affraid that you're right Lars and it's what I was thinking too.
.net 2.0 seems to be more "secure" and as you said, it's more restricted.

The only thing which appear me surprising is that it is possible to disable the Manage Debugging Assistant with the reg key as i've said, but it doesn't change anything.

Well, i'll move back to .net 1.1 ...

Thanks for your response Lars Wink

Greg
Back to top
View user's profile Send private message
LarsB
OOo Advocate
OOo Advocate


Joined: 31 Aug 2005
Posts: 445
Location: Hamburg, Germany

PostPosted: Tue Dec 20, 2005 10:43 am    Post subject: Don't reach Reply with quote

Hi Greg,

I think changing the setting wouldn't take effect, because
this point wouldn't be reached when the call stack will
be executed Wink The first call which could produce the
deadlock is tried to execute, before this setting would
be use, or maybe it's a bug. .net 2.0 framework is very
new and maybe Microsoft will bring out a first service
pack. So wait and hope that it is a bug which will be fixed
with the first service pack Wink

Cheers
LarsB
_________________
AODC - A free OpenDocument Converter
AODL - An independent OpenDocument Library C#
EmbeddedOpenOffice .net UserControl C#
EmbeddedOpenOffice Visual Studio .net Add In

http://www.OpenDocument4all.com/
Back to top
View user's profile Send private message Visit poster's website
Gregos
General User
General User


Joined: 29 Nov 2005
Posts: 16
Location: Paris

PostPosted: Wed Jan 04, 2006 7:41 am    Post subject: Reply with quote

Hi Lars,

just for tell you that finally it works under framework 2.0

My colleague has found how to disable the MDA, directly in VS 2005.
Menu Debug > Managed Debugging Assistant and uncheck LoaderLock.

Disabling this, it works correctly Wink

Greg
Back to top
View user's profile Send private message
ssamayoa
Newbie
Newbie


Joined: 15 Jun 2006
Posts: 3

PostPosted: Thu Jun 15, 2006 5:35 am    Post subject: Did you use the component in .net 2.0? Reply with quote

Did you use the component in .net 2.0?
Regards.
Back to top
View user's profile Send private message
Gregos
General User
General User


Joined: 29 Nov 2005
Posts: 16
Location: Paris

PostPosted: Thu Jun 15, 2006 5:46 am    Post subject: Reply with quote

Hi,

yes i've used the component in .net 2.0 and it works for what i need to do:
- Create and Open a document, using a template.
- Create and fill some user fields.

Feel free to ask me some questions and if i could help you, i will ...

Greg
Back to top
View user's profile Send private message
ssamayoa
Newbie
Newbie


Joined: 15 Jun 2006
Posts: 3

PostPosted: Tue Jun 20, 2006 9:23 am    Post subject: Reply with quote

> ™Feel free to ask me some questions and if i could help you, i will ...

Thank you.
There is:
1. I need hide menu / toolbar options; Can be done?
2. I need intercept save event; Can be done?

Regards.
Back to top
View user's profile Send private message
Gregos
General User
General User


Joined: 29 Nov 2005
Posts: 16
Location: Paris

PostPosted: Tue Jun 20, 2006 11:32 pm    Post subject: Reply with quote

Have a look here: http://opendocument4all.com/component/option,com_frontpage/Itemid,1/

Lars developped this and I think it could help you on hiding toolbar... For the save event, I don't know but I think Lars could help you Wink

Greg
Back to top
View user's profile Send private message
ssamayoa
Newbie
Newbie


Joined: 15 Jun 2006
Posts: 3

PostPosted: Wed Jun 21, 2006 9:48 am    Post subject: Reply with quote

Thank you.

I post a message in Lar's site.

Regards.
Back to top
View user's profile Send private message
MrNice
Newbie
Newbie


Joined: 28 Jun 2006
Posts: 2
Location: Germany RLP

PostPosted: Wed Jun 28, 2006 6:09 am    Post subject: Reply with quote

Gregos wrote:

just for tell you that finally it works under framework 2.0

My colleague has found how to disable the MDA, directly in VS 2005.
Menu Debug > Managed Debugging Assistant and uncheck LoaderLock.

Disabling this, it works correctly Wink

Greg


Hi there,

one question:
Where's this Option?
Im using VS 2005 Prof. Edition and in Menu "Debug" is no entry "Managed Debugging Assistant".
I have also this problem using CLI in framework 2.0 ...
Can you help me?

Thanks in advance...
_________________
Always remember you are unique...
just like everyone else!
Back to top
View user's profile Send private message
sshan
General User
General User


Joined: 24 Jun 2009
Posts: 5

PostPosted: Sun Jul 05, 2009 9:45 pm    Post subject: Reply with quote

Hi,

I couldn't find this option in my VS 2005 prof too.

Btw, I have another issue. Upon the bootstrap() called, I have an exception saying cli_cppuhelper assembly is not found! And this issue lies with XP 64-bit platform.

I'm helpless with this issue.

Please help...
_________________
ss
Back to top
View user's profile Send private message Yahoo Messenger
max_cn
General User
General User


Joined: 26 Jun 2009
Posts: 19

PostPosted: Mon Jul 06, 2009 12:36 am    Post subject: Reply with quote

I thinks this options are not necessary.
I'm using MS VS 2008 Pro and have not found this options in my main menu too, but it was enough for me to add references on cli* dlls.

This files :
cli_basetypes.dll
cli_cppuhelper.dll
cli_oootypes.dll
cli_uno.dll
cli_ure.dll
cli_uretypes.dll

you can find in the openofficeorg1.cab file (it is in the install folder of Open Office Wink).
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group