The type 'Microsoft.CompactFramework.Design.UnsafeControl' has no property named - compact-framework

I get this error when opening the design view of a form that has a Honeywell DecodeControl on it (for a Honeywell barcode scanner - Dolphin 6100 if anyone is interested).
I've googled this to death and done the following:
added an XMTA file with this in it:
<?xml version="1.0" encoding="utf-16"?>
<Classes xmlns="http://schemas.microsoft.com/VisualStudio/2004/03/SmartDevices/XMTA.xsd">
<Class Name="Honeywell.DataCollection.WinCE.Decoding.DecodeControl">
<Description></Description>
<DesktopCompatible>true</DesktopCompatible>
<DesignTimeVisible>true</DesignTimeVisible>
</Class>
</Classes>
Set said XMTA's Build Action to 'none'
Ignoring the first error still gives me an 'Object reference not set to an instance of an object'.
This didn't help at all.
After some lengthy googling, this appears to be to do with controls that are device-specific, and this error is supposedly to stop anything that might cause instability in the designer...except that this control has been working quite happily in the designer all day at work, then when I get home it throws this at me. Nothing has changed - same dev machine, same device, same project, same code as when I last saved it at work.
I'm not even trying to debug the device on the desktop or an emulator - I have the device plumbed in via USB cradle.
Literally the only thing that's changed is that the dev machine is connected to my home network by wireless instead of the CAT5 to work's network. And I can't see that being even remotely related to this.
On a more related note, the control in question never showed up in the toolbox after I did Choose Items -> check the control. Not sure if this is related.
Can anyone shed any light?
I can post the designer code if necessary.
Thanks

Turns out I was targeting the wrong framework for the device - VS decided of it's own volition that I needed to target 3.5 instead of 2.0. Switched it back and all is well.

I ran into this error but it was caused by my playing around with the MessageBeep API in a form. Even though this form was not related in any way to my user controls or components, just having that reference to the Interop namespace in a form corrupted every control in my application and made it impossible to view them in the designer.
The moral of the story is DON'T USE Interop IN CE (PInvoke).
That was scary. Just a heads up for any other unfortunate soul trying to make a Beep sound.

I've the same problem in VS2102 with WEC2013.
And without P/Invoke but with a custom control, entirely managed .net code.
The problem is the Enum properties of my custom control.
And NO solution yet.

Related

ShowFileDialog1 Freezing

Okay, I have had the most aggravating problem with OpenFileDialog1. I have a program that I've been using for some 8 months, and in the past month, the program has begun to hang randomly when utilizing the OpenFileDialog1.ShowDialog() function. I have already read through all of the other posts about multi-threaded vs single threaded application. This did not fix it. Enabling the "Show Help" button did not fix it. I am mostly at a loss. here is a thorough walkthrough of the bug:
Run the application. I can always use the Open File button a few times with no problems. It freezes randomly after the program has been running for awhile.
The freeze happens after I push the ShowDialog button, and never displays the Open File Dialog window. The entire program locks up and hangs. If I pause it, Visual Studio doesn't show an error. It underlines the OpenFileDialog1.ShowDialog() in green, which is very odd.
I have found a way to break the freeze. Simply run a second instance of the program and use the OpenFileDialog function. As soon as it loads the file in the second instance, the first instance unfreezes. However, this is not a fix.
The only thing I can think of that may be causing this is the program also uses a WebBrowser1 control. It only seems to happen AFTER the WebBrowser control, which is on a seperate form, not the main form, has been initiated and utilized. Does this make any sense at all?
Thank you for anyone who can help me. I am about to tear my hair out.
Debug your program with dnspy, And when the software freezes, you will be able to see within the dnspy the actual code even if it is in a third party DLL.
I have solved this problem. It was quite unsolveable based on my description above, but hopefully I will help someone with this solution. The error is related to using the IE11 Emulation Control (11000) in the WebBrowser1 control. For some reason this interferes with OpenFileDialog and causes it to hang. I have no idea why. I changed my WebBrowser1 to use IE9 Emulation Control (9999) and the error has gone away. Thank you to those who looked into this. This is a registry entry in HKEY_CURRENT_USER.

why does Visual Studio modify "Windows Form Designer generated code" on designer open?

When working w/ a WinForm project in VS.NET 2015, our team has noticed that the mere act of opening a .VB form in the designer view (default action when double-clicking the file in Solution Explorer) will cause VS to modify many object properties in the "Windows Form Designer generated code" section of the actual .VB code-behind. It seems to be limited to the .Size and .Location properties for sometimes dozens or more of UI objects, always changing their X,Y coords just slightly.
Mind you we don't perform any action to drive this -- simply open the file (obtained from source-control and residing in the local solution/project) in VS.NET's form designer by double-clicking the file in Solution Explorer, and bam -- it has the "unsaved" asterisk and if you save it and compare to source control version you can see the modifications already made.
I couldn't find much on this. Is this a known behavior? Any idea why it does this? Kind of reminds me of the old days w/ MS FrontPage's designer view, and even the early days of ASP.NET in VS which would apply some HTML changes if you opened a WebForm in designer view, until they gave the option to disable that on a later release.
thanks for any input.
UPDATE: this appears to be continuing even with myself as the only editor of the .VB form in designer. various form elements are shifting their position very slightly. Here's a diff screenshot between my last check in and today, and I know I'm the only one editing:
...there are many like that. Always these two properties, always just a few pixels difference.
I don't have an specific answer for this, but since this drove us crazy a bit a few months ago with my team, while working on a WinForms project, I am glad to share my experience!
Every time someone opened any form on VS2015, it would ask other people who has the same solution open at that time to reload the code. We first thought the third party controls (at that time it was both DevExpress and Infragistics) we are using were re-generated on designed initialization - because they tend to do that a lot but then we realised this kept happening on forms that only contains .NET controls.
Now the funny part. This only happened to us on VS2015. We were using VS2013 before, without this annoying problem.
Long story short, then we realized the screens we are using have different DPIs, just like Cody Gray said. I am not absolutely sure if this was the reason, but since we started using TFS, obviously we don't have the problem anymore... Hope this helps somehow lol.

Member <> is not recognized or is not accessible, while F12 brings me to the definition

To get a head start on a new UWP project, I copy a sample (NavigationMenu from https://github.com/Microsoft/Windows-universal-samples.git) into my own project, learning in the same time.
I am being very careful, and everything looks OK. But I get the above error a few times, while I can jump to the unrecognized member with F12 or actually have intellisense finding that member while typing in XAML.
I am at a lost about what to do to solve this, as I don't see what to "fix".
Is there any way to "debug" XAML in design time?
Thanks for your help!
Bernard
Solved!
The least that I can say is that the errors triggered had NOTHING to do with the real cause!
For whatever reason, I opened the project in Blend. There I saw that I had inadvertently created a click event on a list item (in XAML), so it was not handled in code behind. I just deleted that click event, and everything finally compiled!
Lost quite a bunch of time chasing for false errors in Visual Studio...
If it may help someone else.....

Windows-8 & Internet Explorer-10 broke my ActiveX control drawing?

I am experiencing a very weird behavior while running my Active-X control on “Windows 8” OS, and browser “Microsoft Internet-Explorer 10”.
The control:
My Active-X control is very stable product that my company is already distributing for several years between hundreds of happy customers. The control is an ATL custom-draw control, written in C++, and built with “Visual Studio 2008”.
The problem – the drawing disappears:
While I press the link that opens my control for the first time, I can see that my control is being painted gradually (as my data loading is sometimes slow), but eventually all the drawing disappears, leaving a blank white background color where the controls is located.
Using ‘Spy++’ I can see that my control is really there, but all its painting disappear.
If I move the browser or change its size the control will be re-painted, but otherwise it is simply not visible.
I tried to debug this problem and find out who is erasing my drawing.
I came up with the following technique:
Using WinDBG I added breakpoints at ‘user32.dll’ DLL on the following methods: user32!InvalidateRect, user32!InvalidateRgn, user32!FillRect,
I defined these methods to only show stack and continue with to run,
I ran the above problematic scenario,
When the problem happens I am trying to view who called ‘Invalidate’ or ‘FillRect’,
Since all this happens very quickly I am using the ‘Print Screen’ button to freeze the moment
After doing this several times I find that exactly at the time my control disappears the following stack calls ‘user32!FillRect’:
user32!FillRect
MSHTML!memcpy+0x9805
MSHTML!COmWindowProxy::SwitchMarkup+0x468
MSHTML!CMarkup::SetInteractiveInternal+0x428
MSHTML!CMarkup::RequestReadystateInteractive+0x98
MSHTML!CMarkup::BlockScriptExecutionHelper+0xde
MSHTML!CHtmPost::Exec+0x794
MSHTML!CHtmPost::Run+0x1c
MSHTML!PostManExecute+0x5f
MSHTML!PostManResume+0x7b
MSHTML!CHtmPost::OnDwnChanCallback+0x3a
MSHTML!CDwnChan::OnMethodCall+0x19
MSHTML!GlobalWndOnMethodCall+0x169
MSHTML!GlobalWndProc+0xd7
user32!InternalCallWinProc+0x23
user32!UserCallWinProcCheckWow+0x100
user32!DispatchMessageWorker+0x3ef
user32!DispatchMessageW+0x10
IEFRAME!CTabWindow::_TabWindowThreadProc+0x981
IEFRAME!LCIETab_ThreadProc+0x378
iertutil!CIsoWinMsg::PostQueuedMessagesToComponent+0x4b
IEShims!NS_CreateThread::DesktopIE_ThreadProc+0x66
KERNEL32!BaseThreadInitThunk+0xe
ntdll!__RtlUserThreadStart+0x72
ntdll!_RtlUserThreadStart+0x1b
This is consistent.
When examining this stack I found that this message belongs to a window of class Internet Explorer_Hidden, which is window of size zero (0x0), but with a WS_VISIBLE style. This window belongs to the browser.
Does anyone know this phenomenon?
Is it possible that the browser hidden window is causing this problem?
Could you recommend on other approach to try and hunt the stack that is erasing my drawing?
Many thanks for any hint!
Paz Offer
Conclusion:
The bug was in Microsoft Internet Explorer 10
I used Microsoft Support service to farther investigate this problem. Enclosed here are the findings:
Microsoft Support viewed the version of my IE (Internet Explorer) and suggested to first upgrade IE to its latest patch.
As it happens, the machine I was working on was not setup to be automatically updated by the Windows Update service for some time. As part of upgrading IE I had to first update windows using Windows Update service to its latest patches.
During the process of Windows Update the Microsoft Internet Explorer 10 was automatically updated to its latest patch.
Once IE updated the problem disappeared.
In addition, the ActiveX GUI load process became much faster.
The old version of Microsoft Internet Explorer 10, which caused the problem:
Version: 10.0.9200.16384
Update Versions: RTM (KB2718695)
The new version of Microsoft Internet Explorer 10, which solved the problem:
Version: 10.0.9200.16635
Update Versions: 10.0.7 (KB2846071)
Now all is working as expected.
Thanks, Pazo

Commands not executing after a statements

I have some code in Form Load event. It is doing fine. But when it reaches to pick data from database, no commands are executing after that. There is no error at all but it just goes silent.
I tested it as follows:
MsgBox("1")
vrStudentName = DsGetPprStatusfromEnrSummary.tblPaperEnrSummary.Rows(0).Item("StudentName")
MsgBox("2")
Please advise.
Thanks
Furqan
Message Box one is showing data but not the message box two. In fact, the second message box statement is not showing any response at all.
This is a nasty problem on 64-bit operating systems. Any exception raised in code that's run from a form's Load event is swallowed without a diagnostic. This is an old problem that is not getting solved because the DevDiv and the Windows groups at Microsoft are pointing fingers at each other. My finger is pointing at the Windows group but that doesn't help either.
Two basic ways to solve this problem:
Project + Properties, Compile tab, scroll down, Advanced Compile Options, change the Target CPU option from x86 to AnyCPU. This disables the Wow64 emulation layer that swallows the exception.
Debug + Exceptions, tick the Thrown box for "Common Language Runtime Exceptions". The debugger stops as soon as the exception is thrown.
Also keep in mind that it is very rarely necessary to use the OnLoad method or Load event. Only code that requires the Size or Location or Handle of the form to be accurate needs it. Anything else belongs in the constructor of the form. That Load is used so often is a VB6 anachronism, carried over in the designer design which made the Load event the default event for a Form. Add a constructor by typing "Sub New".
Well, it seems pretty obvious that the call to DsGetPprStatusfromEnrSummary.tblPaperEnrSummary is never returning; which means the problem is IN THERE somewhere.
So what on eath is it? I'm guessing it's a DataSet, yes?
But you've referenced it staticly, which is YuckyPooPoo(TM) IMHO, because it's a complex artifact, and you've rendered EVERYTHING which references it unisolatable, and therefore fundamentally untestable!
Received answer on Codeproject
In the dialog that comes up, put a tick in every checkbox under both "Thrown" and "Unhandled". Press OK.
Now, when you run your app though the debugger, it will break for any exception, even if you have an active handler. This should help you track down the problem.
Issue RESOLVED