Author Topic: System.AccessViolationException was unhandled  (Read 6519 times)

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3070
  • Karma: 1000
    • Wireless Communication Libraries
Re: System.AccessViolationException was unhandled
« Reply #15 on: June 02, 2015, 02:06:11 PM »
Hello,

All the code looks absolutely correct (at first look). I will try to write test app around your Adapter and reproduce the issue. I will keep you updated.

Offline zach.green

  • Newbie
  • *
  • Posts: 11
  • Karma: 0
Re: System.AccessViolationException was unhandled
« Reply #16 on: June 02, 2015, 04:00:15 PM »
I was able to extract as little of the code as possible to create a similar project with the same error. The app doesn't do much, but if you run the app and then try to close app, you should get the error.

Thanks again for all of your help.
Zach

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3070
  • Karma: 1000
    • Wireless Communication Libraries
Re: System.AccessViolationException was unhandled
« Reply #17 on: June 02, 2015, 04:10:31 PM »
WclAdapter.Shutdown has never called, so wclAPI.Unload has never called. That causes AV

Offline zach.green

  • Newbie
  • *
  • Posts: 11
  • Karma: 0
Re: System.AccessViolationException was unhandled
« Reply #18 on: June 02, 2015, 04:11:35 PM »
Found the problem using the simplified project. Just a dumb mistake. I had an extra instance of the WclAdapter that isn't used and it wasn't being closed out.


Line 17 in WclAdapter: protected static WclAdapter Instance = new WclAdapter();

Deleted the line, and no more error.


Edit: Shutdown is being called in the simplified project from MainWindow's closing event. My original Zip was missing that, but I updated it.

Offline zach.green

  • Newbie
  • *
  • Posts: 11
  • Karma: 0
Re: System.AccessViolationException was unhandled
« Reply #19 on: June 02, 2015, 04:14:24 PM »
Thanks again for all of your help. Great service.

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3070
  • Karma: 1000
    • Wireless Communication Libraries
Re: System.AccessViolationException was unhandled
« Reply #20 on: June 02, 2015, 04:18:08 PM »
Yes, just found that too. Any way, great that now all works as expected.

You are very welcome.

 

Sitemap 1 2 3 4 5 6 7 8 9