Re: [ADVANCED-DOTNET] Questioning FxCop: GC.KeepAlive(this)?

2005-01-17 Thread Jeroen Frijters
Shawn A. Van Ness wrote: Ok, so I grant that GC.KeepAlive(this) does have some effect. But what does this have to do with IntPtr fields? The (somewhat dubious) assumption is that an IntPtr represents an unmanaged resource. I mean, is there something special about IntPtr (like, maybe the

Re: [ADVANCED-DOTNET] const modifier in method parameter - managed c++

2004-11-19 Thread Jeroen Frijters
PROTECTED] On Behalf Of Bogdan Lachendro Sent: Friday, November 19, 2004 16:27 To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] const modifier in method parameter - managed c++ On 2004-11-19 16:22, Jeroen Frijters wrote: Actually there is a difference between the method signatures

Re: [ADVANCED-DOTNET] Emitting an attribute on a method's return parameter

2004-09-06 Thread Jeroen Frijters
Mark Bugeja wrote: Thanks for the input guys, but the actual type of the element is not the source of our problem. For the moment, ignore that I ever mentioned XmlElementAttribute... What I need to know is if there is any way to apply an attribute to the return parameter of a method

Re: [ADVANCED-DOTNET] .NET vs Windows SP versioning?

2004-08-23 Thread Jeroen Frijters
Shawn A. Van Ness wrote: Two simple questions for which I should know the answer, but don't: Does XP SP2 include the .NET framework? If so, what version(s)? Does it include any bits from the upcoming .NET service packs [1]? I can't give any authoritive answers, but I have the following

Re: [ADVANCED-DOTNET] Another twist to dll hell

2004-05-22 Thread Jeroen Frijters
Shawn A. Van Ness wrote: My advice to component vendors of the world: build your dll assemblies against the earliest version of the runtime you care to support. Exactly! I have a 1.0 component written in MC++ and I do this too (even though this is very painful, because the MC++ 1.0 compiler is

Re: [ADVANCED-DOTNET] Large structures

2004-05-18 Thread Jeroen Frijters
Message- From: Unmoderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of Jeroen Frijters Sent: Monday, May 17, 2004 6:17 AM To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Large structures John Elliot wrote: Is there any safeguard in place that could

Re: [ADVANCED-DOTNET] Large structures

2004-05-17 Thread Jeroen Frijters
Arlie Davis wrote: I have a few questions for the advanced CLR people here. I haven't been able to find any satisfactory answers elsewhere. Consider value types / structures in CLR, and passing them as arguments to methods. Does the MS CLR *always* copy the entire structure onto the

Re: [ADVANCED-DOTNET] Large structures

2004-05-17 Thread Jeroen Frijters
Frans Bouma wrote: Because the DX api is a COM api, We're talking about the *Managed* DirectX API. So your entire message doesn't make any sense. Regards, Jeroen === This list is hosted by DevelopMentorĀ® http://www.develop.com Some .NET courses you may be

Re: [ADVANCED-DOTNET] Large structures

2004-05-17 Thread Jeroen Frijters
Frans Bouma wrote: Although there is one weird thing: (and you know more on this than I do I think): the D3D structs are redefined in these formats: [StructLayout(LayoutKind.Sequential, Size=24, Pack=1), CLSCompliant(false), MiscellaneousBits(65), DebugInfoInPDB] public struct

Re: [ADVANCED-DOTNET] Large structures

2004-05-17 Thread Jeroen Frijters
Frans Bouma wrote: Why is it irrelevant, if I may ask? It's irrelevant to the question that we were discussing (which was why did MS design the Managed DirectX API like this?). Well, perhaps the answer lies somewhere in the reason why D3DMATRIX is defined as:

Re: [ADVANCED-DOTNET] Visibility of an array type and the element type

2004-05-17 Thread Jeroen Frijters
Stefan Holdermans wrote: JF I would argue that the behavior described by the original JF poster is in fact a bug. The spec says (part. I 8.5.3.1 JF Visibility Of Type): The visibility of a type definer is the JF same as that for the type from which it was generated. (as I JF

Re: [ADVANCED-DOTNET] Large structures

2004-05-17 Thread Jeroen Frijters
Frans Bouma wrote: Ok, I see your point. It is indeed weird, I didn't notice that, my appologies. If you look at Volume.LockBox() for example you see this: public GraphicsStream LockBox(Box box, LockFlags flags) { return this.LockBoxInternal(ref box, flags, 0); } Indeed weird why

Re: [ADVANCED-DOTNET] Large structures

2004-05-17 Thread Jeroen Frijters
John Elliot wrote: Is there any safeguard in place that could catch this type of thing? As long as you don't use unsafe code, there is no way to get in trouble with a ref to a struct (they are always local to one thread). Except, of course, by calling a native method that hangs on the pointer.

Re: [ADVANCED-DOTNET] Visibility of an array type and the element type

2004-05-16 Thread Jeroen Frijters
I disagree. While the implementation is close to what you describe, that really isn't relevant. In the type system, there really are distinct types for each array type. I would argue that the behavior described by the original poster is in fact a bug. The spec says (part. I 8.5.3.1 Visibility Of

Re: [ADVANCED-DOTNET] Reflection.Emit, MarshalAsAttribute and dealing with SizeParamIndex

2004-02-05 Thread Jeroen Frijters
Peter Partch wrote: ElementCount is read-only Ugh. Sorry about that. It isn't even what you asked about. I tried to use SetCustomAttribute to emit a MarshalAsAttribute, but that hangs (!) I looked at the Rotor code and SetCustomAttribute actually has support for pseudo-custom attributes, so in

Re: [ADVANCED-DOTNET] Reflection.Emit, MarshalAsAttribute and dealing with SizeParamIndex

2004-02-05 Thread Jeroen Frijters
I wrote: I tried to use SetCustomAttribute to emit a MarshalAsAttribute, but that hangs (!) I looked at the Rotor code and SetCustomAttribute actually has support for pseudo-custom attributes, so in theory it should work, but it looks like there is a bug somewhere in the runtime. I don't

Re: [ADVANCED-DOTNET] Reflection.Emit, MarshalAsAttribute and dealing with SizeParamIndex

2004-02-05 Thread Jeroen Frijters
to this, but when you say Whidbey are you referring to a particular .NET runtime version (what number? generally available? if so where?), a particular version of Windows (what number? generally available?) -- when .NET is supposed to be the same on them all -- or both? At 05:10 AM 2/5/2004, Jeroen

[ADVANCED-DOTNET] FW: J# and access modifiers

2003-10-20 Thread Jeroen Frijters
For the archives. Regards, Jeroen -Original Message- From: Markus Bergkvist [mailto:[EMAIL PROTECTED] Sent: Monday, October 20, 2003 15:09 To: Jeroen Frijters Subject: RE: J# and access modifiers Hi, I don't have any account on Advanced DotNet, so perhaps you could add the following

Re: [ADVANCED-DOTNET] J# and access modifiers

2003-09-08 Thread Jeroen Frijters
It is a feature. Java's package access is namespace based, so the J# compiler people decided (by default) to map all non-private access modifiers to public. You can use the /securescoping option to change this behavior. Regards, Jeroen -Original Message- From: Moderated discussion of

Re: [ADVANCED-DOTNET] Nasty bug in 1.0 and 1.1 compiler

2003-08-28 Thread Jeroen Frijters
I was able to reproduce it with the command line compiler. C:\csc /O test.cs Microsoft (R) Visual C# .NET Compiler version 7.10.3052.4 for Microsoft (R) .NET Framework version 1.1.4322 Copyright (C) Microsoft Corporation 2001-2002. All rights reserved. C:\test in if in else Regards, Jeroen

Re: [ADVANCED-DOTNET] Partially constructed objects in C#

2003-06-19 Thread Jeroen Frijters
Both approaches have ups and downs. It's probably best not to call virtual methods from the constructor. The reason C# (and Java too) do it this way is probably because of efficiency. Changing the vtable pointer (what C++ does) isn't possible in C#/Java because that would confuse the garbage

Re: [ADVANCED-DOTNET] ArgIterator is not object ???

2003-06-17 Thread Jeroen Frijters
It's hardcoded in the compiler. If you've got the Rotor sources installed, the check is done in TYPESYM::isSpecialByRefType(). http://dotnet.di.unipi.it/Content/sscli/docs/doxygen/csharp/symmgr_8cpp- source.html#l02546 Regards, Jeroen -Original Message- From: Frans Bouma

Re: [ADVANCED-DOTNET] ArgIterator is not object ???

2003-06-17 Thread Jeroen Frijters
It gets worse. Look at the following code: using System; class Class1 { static void Main(string[] args) { ArgIterator iter = new ArgIterator(Foo(__arglist(1, 2, 3))); } static RuntimeArgumentHandle Foo(__arglist) { return __arglist; } } This is effectively the same as

Re: [ADVANCED-DOTNET] ArgIterator is not object ???

2003-06-16 Thread Jeroen Frijters
ArgIterator is a special type. It contains a pointer to the stack, so it isn't allowed to escape the current method. Otherwise, you'd have a pointer pointing into the middle of nowhere. Regards, Jeroen -Original Message- From: Bogdan Lachendro [mailto:[EMAIL PROTECTED] Sent:

Re: [ADVANCED-DOTNET] ArgIterator is not object ???

2003-06-16 Thread Jeroen Frijters
16, 2003 11:45 To: [EMAIL PROTECTED] On 6/16/2003 11:39 AM, Jeroen Frijters wrote: ArgIterator is a special type. It contains a pointer to the stack, so it isn't allowed to escape the current method. Otherwise, you'd have a pointer pointing into the middle of nowhere. OK, I

Re: [ADVANCED-DOTNET] Mensa workout: constructing magic-value IntPtr arguments for p/invoke on IA64

2003-04-05 Thread Jeroen Frijters
Shawn A. Van Ness wrote: Another question. Aren't these KEYS provided to you as enum? I'm needing to p/invoke the actual Win32 functions -- not using the Microsoft.Win32.RegistryKey stuff. I seriously doubt the numerical values of the enum you mention are the actual UINT_PTR values I

Re: [ADVANCED-DOTNET] Binding to a method that takes a ref

2003-02-11 Thread Jeroen Frijters
It's quite simple: public static Type MakeRef(Type type) { return type.Assembly.GetType(type.FullName + ); } Regards, Jeroen -Original Message- From: Jason Whittington [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 11, 2003 07:13 To:

Re: [ADVANCED-DOTNET] Performance: castclass vs. isinst?

2003-01-10 Thread Jeroen Frijters
As long as the cast succeeds performance should be the same, if the cast fails, isinst is much faster than castclass (because castclass has to throw an exception, which is expensive). Note that neither of these instructions look at the elements of the array, i.e. only the type of the array is

Re: [ADVANCED-DOTNET] Reflection Emit and array types

2003-01-08 Thread Jeroen Frijters
Hi, You are correct in assuming that the fact that the type hasn't been created is causing the problem. The solution is to use: ModuleBuilder.GetType(string). Regards, Jeroen -Original Message- From: Moderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED]] On Behalf

Re: [ADVANCED-DOTNET] Reasons for restrictions on protected access from subclasses?

2002-12-13 Thread Jeroen Frijters
Whoops. I wasn't quite awake yet. In Java it isn't legal either. Well, the example below would be legal, but that is because protected members also have package (or default) access. If you move A and B to two different packages, the below code doesn't compile in Java either. Regards, Jeroen

Re: [ADVANCED-DOTNET] accessibility of delegates in 1.1

2002-11-01 Thread Jeroen Frijters
Please see http://discuss.develop.com/archives/wa.exe?A2=ind0209CL=DOTNET-CLRP=R2 458I=-3 for an explanation of what actually changed. In short, the change docs are wrong. Regards, Jeroen -Original Message- From: Moderated discussion of advanced .NET topics.

Re: [ADVANCED-DOTNET] Mutex and Monitor, any difference ?

2002-09-20 Thread Jeroen Frijters
Logically they are very similar, but Mutex wraps the OS mutex while Monitor is something that is native to the .NET framework. This has several consequences: - Mutex can be used to synchronize accross different processes, while a Monitor is local to the AppDomain - A Monitor is *much* faster than

Re: [ADVANCED-DOTNET] Missing Finalizers

2002-09-19 Thread Jeroen Frijters
The finalizers start running before you've finished the look, and they decrement Class1.iterations which is used in the loop, thus you're allocating less than 1000 objects. Also, it is *very* bad practice to close the filestream in the finalizer. You only ever should release *unmanaged*

Re: [ADVANCED-DOTNET] CAS limitations

2002-09-11 Thread Jeroen Frijters
Exactly! For specific configuration scenarios it might be possible to get around this problem, but in general that isn't possible (at the moment). I don't know if you're familiar with Palladium, but that would help solve these types of problems. Regards, Jeroen -Original Message-

Re: [ADVANCED-DOTNET] CAS: what's the diff between FullTrust and Everything permission sets?

2002-09-02 Thread Jeroen Frijters
1) I know of at least one scenario where Full Trust is demanded by the CLR. When you call a strong-named shared library that doesn't have the AllowPartiallyTrustedCallersAttribute, the CLR will only allow this if the caller has full trust. I don't know if this is what you're seeing, though. 2) I