DbMetal Generated Code "System.FieldAccessException"

31 views
Skip to first unread message

Zak

unread,
Dec 3, 2009, 2:40:33 PM12/3/09
to DbLinq
I am receiving the follwing:

Unhandled Exception: System.FieldAccessException: Field
`IHS.Data.Gcode:_job' is inaccessible from method `(wrapper dynamic-
method) object:setter
(IHS.Data.Gcode,DbLinq.Data.Linq.EntityRef`1<IHS.Data.Job>)'

at (wrapper managed-to-native)
System.Delegate:CreateDelegate_internal
(System.Type,object,System.Reflection.MethodInfo)
at System.Delegate.CreateDelegate (System.Type type, System.Object
firstArgument, System.Reflection.MethodInfo method, Boolean
throwOnBindFailure) [0x00251] in /usr/src/packages/BUILD/mono-2.4.2.3/
mcs/class/corlib/System/Delegate.cs:256
at System.Delegate.CreateDelegate (System.Type type,
System.Reflection.MethodInfo method, Boolean throwOnBindFailure)
[0x00000] in /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/corlib/
System/Delegate.cs:278
at System.Delegate.CreateDelegate (System.Type type,
System.Reflection.MethodInfo method) [0x00000] in /usr/src/packages/
BUILD/mono-2.4.2.3/mcs/class/corlib/System/Delegate.cs:282
at System.Reflection.Emit.DynamicMethod.CreateDelegate (System.Type
delegateType) [0x00029] in /usr/src/packages/BUILD/mono-2.4.2.3/mcs/
class/corlib/System.Reflection.Emit/DynamicMethod.cs:176
at DbLinq.Data.Linq.Mapping.LambdaMetaAccessor.MakeSetter
(System.Reflection.MemberInfo member, System.Type memberType,
System.Type declaringType) [0x000ee] in /home/zak/dev/dblinq2007/src/
DbLinq/Data/Linq/Mapping/LambdaMetaAccessor.cs:44


<snip...>

Just to try something I changed private EntityRef<Job> _job; public
which did allow execution to get past that point, just to choke on the
next inaccessible field. It's pretty obvious that making all fields
public is not the real solution to the problem, but at this point I am
not sure what to do as I have only begun to dig through DbLinq.

Any pointing in the right direction would be great.

Thanks, Zak

Jonathan Pryor

unread,
Dec 3, 2009, 5:01:12 PM12/3/09
to dbl...@googlegroups.com
On Thu, 2009-12-03 at 11:40 -0800, Zak wrote:
> I am receiving the follwing:
>
> Unhandled Exception: System.FieldAccessException: Field
> `IHS.Data.Gcode:_job' is inaccessible from method `(wrapper dynamic-
> method) object:setter
> (IHS.Data.Gcode,DbLinq.Data.Linq.EntityRef`1<IHS.Data.Job>)'

This is an issue with Mono 2.4.2.3 (and likely the 2.4 branch in
general).

For example, while running DbLinq.Sqlite_test_mono.dll:

Runtime Total Tests Failures Skipped
------- ----------- -------- -------
2.4.2.3 332 326 14
2.6 [r145607] 332 6 14
trunk [r146765] 332 2 14

Looks like a Mono 2.4.x bug, fixed in subsequent releases (neither of
which is *actually* out; 2.6 is still in preview stages).

I'll have to write a minimal test case and see if we can backport the
fix to the 2.4 branch, but I don't know if that'll happen or when a
release containing the fix would be available.

It's possible that there's some other change we could do to DbLinq to as
a workaround; you might want to look into that if using Mono 2.6+ isn't
an option.

- Jon


Zak

unread,
Dec 3, 2009, 5:10:27 PM12/3/09
to DbLinq
I will give 2.6 a try since I have some time before putting these
changes into production. Thanks for the response I really appreciate
the time you took to answer.

Zak

Zak

unread,
Dec 3, 2009, 6:16:02 PM12/3/09
to DbLinq
That did work. I am now moving forward, and once again thanks.

Zak
Reply all
Reply to author
Forward
0 new messages