Author Topic: System.Net.ComNetOS exception error  (Read 11749 times)

rms

  • Newbie
  • *
  • Posts: 21
    • View Profile
System.Net.ComNetOS exception error
« on: July 12, 2013, 02:13:33 PM »
Hi. I got the following error(s) when trying to run a project... any help or guidance would be appreciated.
Please see attached screenshots which I could not place in this message box
Thanks in advance

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5261
    • View Profile
    • AdvancedHMI
Re: System.Net.ComNetOS exception error
« Reply #1 on: July 12, 2013, 02:43:42 PM »
Can you copy the full Stack Trace message from the message window in your last picture and post it?

rms

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: System.Net.ComNetOS exception error
« Reply #2 on: July 12, 2013, 02:56:42 PM »
Ok - Here it is..

There are only 3 screens...they were all linked and communicating with the SLC 5/05 with no issues or problems.
When I shut down yesterday... windows 7 performed an update and installed or updated 18 items - not sure, but maybe that update had something to do with these problems

Thanks a lot of looking into it.

Hopefully the info below is what you requested...


System.TypeInitializationException was unhandled
  Message=The type initializer for 'System.Net.ComNetOS' threw an exception.
  Source=System
  TypeName=System.Net.ComNetOS
  StackTrace:
       at System.Net.Sockets.Socket.InitializeSockets()
       at System.Net.Sockets.Socket.get_OSSupportsIPv4()
       at System.Runtime.Remoting.Channels.Tcp.TcpServerChannel..ctor(IDictionary properties, IServerChannelSinkProvider sinkProvider, IAuthorizeRemotingConnection authorizeCallback)
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.RegisterChannel(ChannelType ChannelType, Boolean ChannelIsSecure)
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
       at MfgControl.AdvancedHMI.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.Configuration.ConfigurationErrorsException
       Message=An error occurred creating the configuration section handler for system.diagnostics: Attempt by method 'System.Configuration.TypeUtil.CreateInstanceRestricted(System.Type, System.Type)' to access method 'System.Diagnostics.TraceSection..ctor()' failed. (C:\Users\Rich\Downloads\AdvancedHMIBetaV340\AdvancedHMI\bin\Debug\AdvancedHMI.vshost.exe.Config line 3)
       Source=System.Configuration
       BareMessage=An error occurred creating the configuration section handler for system.diagnostics: Attempt by method 'System.Configuration.TypeUtil.CreateInstanceRestricted(System.Type, System.Type)' to access method 'System.Diagnostics.TraceSection..ctor()' failed.
       Filename=C:\Users\Rich\Downloads\AdvancedHMIBetaV340\AdvancedHMI\bin\Debug\AdvancedHMI.vshost.exe.Config
       Line=3
       StackTrace:
            at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)
            at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)
            at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
            at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
            at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
            at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
            at System.Configuration.ConfigurationManager.GetSection(String sectionName)
            at System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName)
            at System.Diagnostics.DiagnosticsConfiguration.Initialize()
            at System.Diagnostics.DiagnosticsConfiguration.get_Sources()
            at System.Diagnostics.TraceSource.Initialize()
            at System.Net.Logging.InitializeLogging()
            at System.Net.ComNetOS..cctor()
       InnerException: System.MethodAccessException
            Message=Attempt by method 'System.Configuration.TypeUtil.CreateInstanceRestricted(System.Type, System.Type)' to access method 'System.Diagnostics.TraceSection..ctor()' failed.
            Source=mscorlib
            StackTrace:
                 at System.RuntimeMethodHandle.PerformSecurityCheck(Object obj, RuntimeMethodHandleInternal method, RuntimeType parent, UInt32 invocationFlags)
                 at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)
                 at System.Activator.CreateInstance(Type type, Boolean nonPublic)
                 at System.Configuration.TypeUtil.CreateInstanceRestricted(Type callingType, Type targetType)
                 at System.Configuration.ConfigurationElement.CreateElement(Type type)
                 at System.Configuration.ConfigurationElement.get_Item(ConfigurationProperty prop)
                 at System.Configuration.ConfigurationElement.Reset(ConfigurationElement parentElement)
                 at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSectionImpl(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader)
                 at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSectionWithRestrictedPermissions(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader)
                 at System.Configuration.RuntimeConfigurationRecord.CreateSection(Boolean inputIsTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader)
                 at System.Configuration.BaseConfigurationRecord.CallCreateSection(Boolean inputIsTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader, String filename, Int32 line)
            InnerException: System.Security.SecurityException
                 Message=Request failed.
                 Source=mscorlib
                 GrantedSet=<PermissionSet class="System.Security.PermissionSet"
version="1">
<IPermission class="System.Security.Permissions.FileDialogPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Access="Open"/>
<IPermission class="System.Security.Permissions.IsolatedStorageFilePermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Allowed="ApplicationIsolationByUser"
UserQuota="1024000"/>
<IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Flags="Execution"/>
<IPermission class="System.Security.Permissions.UIPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Window="SafeTopLevelWindows"
Clipboard="OwnClipboard"/>
<IPermission class="System.Drawing.Printing.PrintingPermission, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
version="1"
Level="SafePrinting"/>
<IPermission class="System.Security.Permissions.MediaPermission, WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
version="1"
Audio="SafeAudio"
Video="SafeVideo"
Image="SafeImage"/>
<IPermission class="System.Security.Permissions.WebBrowserPermission, WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
version="1"
Level="Safe"/>
</PermissionSet>

                 PermissionState=<PermissionSet class="System.Security.PermissionSet"
version="1"
Unrestricted="true"/>

                 RefusedSet=""
                 Url=""
                 StackTrace:
                      at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(RuntimeAssembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandleInternal rmh, SecurityAction action, Object demand, IPermission permThatFailed)
                      at System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandleInternal rmh, Object assemblyOrString, SecurityAction action, Boolean throwException)
                      at System.Security.PermissionListSet.CheckSetDemandWithModification(PermissionSet pset, PermissionSet& alteredDemandSet, RuntimeMethodHandleInternal rmh)
                      at System.Security.PermissionListSet.CheckSetDemand(PermissionSet pset, RuntimeMethodHandleInternal rmh)
                      at System.Security.PermissionListSet.DemandFlagsOrGrantSet(Int32 flags, PermissionSet grantSet)
                      at System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32 permission, PermissionSet targetGrant)
                 InnerException:

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5261
    • View Profile
    • AdvancedHMI
Re: System.Net.ComNetOS exception error
« Reply #3 on: July 13, 2013, 10:27:14 AM »
I tried to reproduce this, but no luck. By searching the internet, it looks like many others have had this problem.

The next thing we need to check is the config file. Go into this directoty in your project AdvancedHMI\bin\Debug and open the file AdvancedHMI.vshost.exe.config with notepad. Post the contents of that file and I'll see if anything stands out in that.

One other thing to try that sometimes resolves strange issues is to delete both the \obj and \bin directories in the AdvancedHMI folder and the AdvancedHMIDrivers folder. Once you open the project again, Visual Studio will rebuild those folders and files.

rms

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: System.Net.ComNetOS exception error
« Reply #4 on: July 15, 2013, 09:32:32 AM »
Hi.. thanks a lot for replies thus far.... here is the content of AdvancedHMI.vshost.exe.config as requested...

<?xml version="1.0"?>
<configuration>
    <system.diagnostics>
        <sources>
            <!-- This section defines the logging configuration for My.Application.Log -->
            <source name="DefaultSource" switchName="DefaultSwitch">
                <listeners>
                    <add name="FileLog"/>
                    <!-- Uncomment the below section to write to the Application Event Log -->
                    <!--<add name="EventLog"/>-->
                </listeners>
            </source>
        </sources>
        <switches>
            <add name="DefaultSwitch" value="Information"/>
        </switches>
        <sharedListeners>
            <add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter"/>
            <!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
            <!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
        </sharedListeners>
    </system.diagnostics>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>

I will also delete the \obj and \bin files as suggested and report back shortly.

Thanks!



rms

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: System.Net.ComNetOS exception error
« Reply #5 on: July 15, 2013, 09:46:04 AM »
OK...I deleted the \obj and \bin files and restated, got a bunch of error screens, rebuilt, then run the program and got the same System.Net.ComNetOS exception error

If you have any other ideas or come up with anything please advise

How about...saving my work (not sure which files that would be...I assume it's the .vb files- anything else??) and then uninstalling VB and AdvancedHMI, installing everything again, build AdvancedHMI, load my files (saved before) and see what happens
Does not get to the root of the problem, but may get me up and running again. Any value in this?

Thanks


Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5261
    • View Profile
    • AdvancedHMI
Re: System.Net.ComNetOS exception error
« Reply #6 on: July 15, 2013, 08:30:28 PM »
Nothing stands out with the config file. What if you start with a blank AdvancedHMI project and try to run it without adding anything? If that fails, then maybe try re-installing the .NET framework.

rms

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: System.Net.ComNetOS exception error
« Reply #7 on: July 16, 2013, 10:09:18 AM »
ok...i'll do that.. I'm not a VB programmer, but am learning as I go... how to I get to a "blank" Advanced HMI project opened???
Right now, when I select AdvancedHMIv3 from recent projects and it opens to my current project which is giving the errors discussed so far
How to I create  a new "project" or "solution" or whatever it's called in AdvancedHMI that does NOT default to my current project. OR How do I open a "blank" project within Advanced HMI
Sorry it's such a basic question, I can't seem to figure out how to do it.
Thanks for your help



Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5261
    • View Profile
    • AdvancedHMI
Re: System.Net.ComNetOS exception error
« Reply #8 on: July 16, 2013, 08:35:50 PM »
The easiest way is to download a fresh copy and extract it into a new folder.

rms

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: System.Net.ComNetOS exception error
« Reply #9 on: July 23, 2013, 01:41:57 PM »
Ok. I tried installing vb 2010 express  - no luck - same problem,.. what's interesting is that it seemed to remember that I had AdvancedHMI loaded as a recent file - so that leads me to believe the VB2010 express did not "fully" uninstall - some files were left behind and recaptured on re-install - that could be part of the problem

Then I download and fresh copy of AdvancedHMI, installed and tried to run (debug)...got same exact error

It's probably some setting or something unique about my PC.

I'm going to  try to run Advanced HMI on another pc, as soon as I can get one, and see what happens. Could be a while.

If you have any other ideas, Like - how to "completely" uninstall and reinstall VB or anything else to try... I'm willing to try anything right now

I really want this to work.   For the few days that AdvancedHMI was working - I really liked it and saw many uses and applications for it.

Thanks for your help

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5261
    • View Profile
    • AdvancedHMI
Re: System.Net.ComNetOS exception error
« Reply #10 on: July 23, 2013, 01:50:35 PM »
I think the problem is more in the .NET framework than in Visual Studio. Try going to Microsoft's download section to re-download and install .NET 4.0

Even when you uninstall and re-install Visual Studio, the .NET framework stays untouched. It really sounds like there was a security update to .NET that is causing the issue.

rms

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: System.Net.ComNetOS exception error
« Reply #11 on: July 23, 2013, 02:09:55 PM »
Ok.. I'll try that... one more thing.. should I uninstall .net 4.0 and then re-install or just re-install right "on top of" the existing installation.  thanks a lot

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5261
    • View Profile
    • AdvancedHMI
Re: System.Net.ComNetOS exception error
« Reply #12 on: July 24, 2013, 08:30:20 PM »
Someone else had some problems after that recent update from Microsoft. You will most likely need to uninstall the framework then reinstall to make sure it does not apply the updates.


rms

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: System.Net.ComNetOS exception error
« Reply #13 on: July 25, 2013, 11:28:57 AM »
OK. Did a complete VB2010 Express Uninstall and a complete .net 4.0 uninstall and then re-installed everything and got it working.
 Now, how to I disable all windows updates or how do I know which ones NOT to apply - right now...I think the updates are automatic when I shut down...no prompt or anything..  I[m asking just so I don't accidentally trigger and update. Thanks

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5261
    • View Profile
    • AdvancedHMI
Re: System.Net.ComNetOS exception error
« Reply #14 on: July 25, 2013, 11:59:00 AM »
If you are on Windows 7, you can click your start button, then type "windows update", click on Windows Update which will take you to a window with an option on the left to Change Settings. From there you can set it to only notify you so you can select which updates to install. Just avoid the security update for .NET 4