Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Compiling for 'AnyCPU' through errors
Message
From
05/04/2011 16:00:04
 
 
General information
Forum:
ASP.NET
Category:
Forms
Miscellaneous
Thread ID:
01506035
Message ID:
01506172
Views:
59
O, I took the Imports for linq out
removed all code i had in there referencing linq
and added the line you gave me
re-build, re-installed

same error

now what?


>AFAICS that looks ok.
>Does it fall over if you target x86 ?
>Try accessing some other member of System.Linq e.g:
System.Linq.ParallelExecutionMode em = System.Linq.ParallelExecutionMode.Default;
If that fails it's a pretty clear indication that System.Core.dll is not being found.
>
>>Target CPU : AnyCPU
>>Target framework : .NET Framework 4
>>
>>On the 64-bit machine, showing in Add-Remove Programs:
>>
  • .NET Framework 2.0 SP 2
    >>
  • .NET Framework 3.0 SP 2
    >>
  • .NET Framework 3.5 SP 1
    >>
  • .NET Framework 4 Client Profile
    >>
  • .NET Framework 4 Extended
    >
    >>>I haven't got an XP 64bit machine to hand to try this but I don't see how such a machine could 'not like Linq' More likely that the installed .NET framework version is pre-linq....
    >>>
    >>>To be clear, what is the Target CPU and Target framework set to in the project when you get this error and what is the .NET version on the XP 64bit box?
    >>>
    >>>Also it looks as if you should implement global exception handling to catch unhandled errors. See :
    >>>http://msdn.microsoft.com/en-us/library/system.windows.forms.application.threadexception.aspx
    >>>
    >>>>Ok - I knew I wasn't crazy :-)
    >>>>
    >>>>I got my problem back: After installing the app on the winXP 64-bit machine and then running it, I get the following error:
    >>>>EventType : clr20r3     P1 : dms dataentry.exe     P2 : 1.0.0.0     
    >>>>P3 : 4d9b2837     P4 : system.windows.forms     P5 : 4.0.0.0     P6 : 4ba1e14e
    >>>>P7 : c29     P8 : 11     P9 : system.invalidoperationexception
    >>>>Here is what I did: I put linq back into my code.
    >>>>
    >>>>After I had removed the
    >>>>Imports System.Linq
    >>>>the folowing code threw an error at "combobox.Items "
    >>>>    Public Sub AutosizeDropDownWidth(ByVal combobox As ComboBox)
    >>>>        If combobox.Items.Count > 0 Then
    >>>>            Dim longestItem As Integer = 0
    >>>>            Using g = Graphics.FromHwnd(combobox.Handle)
    >>>>                
    >>>>                ' Error on the following line
    >>>>                Dim itemsAsText = (From item In combobox.Items Select combobox.GetItemText(item))
    >>>>                longestItem = CInt(itemsAsText.Max(Function(text) g.MeasureString(text, combobox.Font).Width))
    >>>>            End Using
    >>>>            ' Account for scrollbar     
    >>>>            If (combobox.Items.Count > combobox.MaxDropDownItems) Then longestItem += 15
    >>>>            ' Resize as needed (but never smaller than the default width)     
    >>>>            combobox.DropDownWidth = Math.Max(longestItem, combobox.Width)
    >>>>        End If
    >>>>    End Sub
    >>>>so I thought in order to still use this code I put the Imports for linq back in, rebuild, re-install - wam - get the error on the 64-bit machine.
    >>>>
    >>>>So I am assuming that the WindowsXP 64-bit version (only, not Win7) does not like LINQ.
    >>>>
    >>>>
    >>>>
    >>>>>>Hello Viv
    >>>>>>
    >>>>>>Trying to exclude LINQ in that part of the app. I like to reduce the .NET version to allow a greater range of computers which are then able to run my app.
    >>>>>
    >>>>>EnumerableRowCollection resides in System.Data.DatasetExtensions, the ElementAtOrDefault extension method in System.Core.dll. Both were introduced in .NET 3.5 for 'Linq to Dataset'. If you really want your application to run on earlier versions of the framework then you should explicitly set the target version for each project before compiliing (or, better yet, before coding :-}). But it you insist on supporting as far back as .NET 2 you will be losing a *lot* of very useful functionality - and upgrading the .NET version on client machines is not a big deal.
    >>>>>
    >>>>>Setting the target *platform* is a different thing entirely. It does *not* affect the compiled (IL) code in any way apart from setting flags indicating which platforms should be used - targeting x86 rather than 'Any CPU' simply means your application will still run as 32 bit when on a 64bit machine.
    >>>>>
    >>>>>>I am already having the issue with WindowsXP 64-bit - my app doesn't run on there. I think I read in my reasearch that LINQ won't run in that platform.
    >>>>>
    >>>>>Don't think that's true. What problems do you have? What's your development platform? Will the app run as 32bit on that machine (as per above)?
    >>>>>
    >>>>>>
    >>>>>>
    >>>>>>
    >>>>>>>>Hello Everybody.
    >>>>>>>>
    >>>>>>>>Ok - so I completed my first .NET app (desktop in vb.net and a asp.net web portion), compiled it in x86, install it on WindowsXP (32bit) and Windows 7 (64bit) machines, and it works great. - Hurray :-)
    >>>>>>>>
    >>>>>>>>Now i have some Windows XP 64 bit machines where i got an error right when I am starting the app (the desktop program). I think there was some mentioning about the System.Windows.Forms namespace.
    >>>>>>>>
    >>>>>>>>Well, so I am thinking to myself: "sure that makes sence, just recompile as "AnyCPU".
    >>>>>>>>
    >>>>>>>>Oops - maybe not. First i got some complaints about LINQ - so i converted that code to the System.Data.SqlClient stuff. Still everything works great on the other machienes (reinstalled).
    >>>>>>>>
    >>>>>>>>But now i get an error when compiling (not the code sections I converted) as follows (about 72 errors):
    >>>>>>>>Dim MasterTypeRow As DataTable = _
    >>>>>>>>   Me.TableAdapterManager1.DocumentTypesTableAdapter.GetType_Level0( _ 
    >>>>>>>>      Me.DocList(nRow, 3), Me.DocList(nRow, 4), Me.DocList(nRow, 5))
    >>>>>>>>
    >>>>>>>>' this following line triggers the error
    >>>>>>>>Dim MasterType As String = MasterTypeRow(0)("Type_level0")
    >>>>>>>>throughs the error:
    >>>>>>>>'ElementAtOrDefault' is not a member of 'System.Data.EnumerableRowCollection(Of System.Data.DataRow)'.
    >>>>>>>>Does anybody have an idea what i am missing here?
    >>>>>>>
    >>>>>>>Importing System.Linq ?
    >>>>>>>
    >>>>>>>>
    >>>>>>>>Thank you for all your help!
  • Previous
    Next
    Reply
    Map
    View

    Click here to load this message in the networking platform