Profiling Silverlight 4 - silverlight-4.0

I have a Silverlight page that displays100+ user controls in a ScrollViewer (around 50% of the controls are visible at once, depending on browser resolution).
When I scroll using the ScrollViewer, scrolling is sluggish and one of my 4 CPU cores goes to 100% (and stays there as long as I keep moving a scrollbar).
I wanted to profile the application to better understand where the time is being spent following the instructions on this MSDN Blog. Like one of the commenters, I get the error
No Call Tree Data Is Available.
when I open the .vsp file.
I run my profiling session with this batch file:
call vsperfclrenv /sampleon
set CORECLR_ENABLE_PROFILING=1
set CORECLR_PROFILER=%COR_PROFILER%
call vsperfcmd /start:sample /output:myProfile.vsp
call vsperfcmd /launch:"c:\Program Files (x86)\Internet Explorer\iexplore.exe" /timer:100000
echo Browse to http://localhost:9567/MyTestPage.aspx#/Home
call vsperfcmd /shutdown
Echo Before viewing, turn on the symbols server in VS2010 through: Tools-->Options-->Debugging-->Symbols-->check microsoft symbols server.
Echo Open .vsp file in VS2010
One blog commentor suggested the problem is due to a 64-bit version of vsperfcmd. While I'm running Windows 7 64-bit, vsperfcmd suggests that it's an x86 build:
vsperfcmd
Microsoft (R) VSPerf Command Version 10.0.40219 x86
What am I missing to profile my user code?

Have you tried running this in an administrator console window - I have recently noticed that I can't profile (code coverage) silverlight applications unless I am running under an Administrator account i.e. starting a console window with "run as administrator"

Related

Cannot see XAML live visual tree

Before reporting to Microsoft I want to ask here. I have a problem that I cannot see Live Visual Tree of my WinUI 3 application. I cannot even see the in-app toolbar. I can see both in WPF and UWP application, no problems. I have these options for hot reload, that should be fine.
I am using VS2022 17.3.1 and Windows App SDK in version 1.1.4. Weird is that it was functioning without problems, but one restart of application just broke that. I also tried adding the ENABLE_XAML_DIAGNOSTICS_SOURCE_INFO to environment variables manually, but no luck there.
It seems that 32-bit WinUI 3 app is working fine, it only affects 64-bit WinUI 3 applications. Even the new and blank ones. Packaged/unpacked type doesn't affect the problem.
I tried uninstall and install VS again, no changes.
So I did finally find a solution (more of a workaround) to this.
Run following commands in elevated cmd, where you replace WindowsAppRuntime version with version you currently have (for me it is Microsoft.WindowsAppRuntime.1.1_1004.584.2120.0_x64__8wekyb3d8bbwe):
takeown /f "C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.1_1004.584.2120.0_x64__8wekyb3d8bbwe" /r /d y
icacls.exe "C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.1_1004.584.2120.0_x64__8wekyb3d8bbwe" /grant Users:(RD,R,REA,RX) /t
Don't know what it does, but it is working. This solution is taken over from Developer Community
UPDATE:
You have to repeat this procedure when you update Windows App SDK to a new version.
Here is a PowerShell command that loops over all WindowsAppRuntime folders and applies the fixes on #benderto's answer.
Get-ChildItem -Path 'C:\Program Files\WindowsApps\' -Filter 'Microsoft.WindowsAppRuntime*' | Foreach {
takeown /f "C:\Program Files\WindowsApps\$_" /r /d y
icacls.exe "C:\Program Files\WindowsApps\$_" /grant "Users:(RD,R,REA,RX)" /t
}
You don't need to restart Visual Studio for this to take effect. Restarting the debugging session is enough.
After lots of reinstallion, 100+?, I came across with this information then problem solved.
It is very frustrating the recent quality of Visual Studio 2022 after 17.2. Each update gets me reinstall loops again, again and again, just because something broken.
This time, MAUI (WinUI 3) XAML Hot Reload won't work.
XAML Hot Reload
So I created 3 VMs and installed with different detail of workloads, and tried to figure out "What's wrong". But I failed.
The error seems random. However, I did get some thing strange.
The Hot Reload was "working" after installaion and I left the VM on. After awhile back, I stopped debugging and restarted to debug, the working one became "not working" somehow over time, so I compared two snapshot, one work, one did not. After comparing installion configuration, run with user, run with admin, MAUI App with .net 6.0, MAUI App with template 7.0, both registry, both disk contain (entire C:). I found nothing, all identical as they should be.
Checking Logs:
Event Log, AppData\Local\Temp\VSLogs, AppData\Local\Xamarin\Logs\17.0, the Output of VS
However, the Output: debug. Did make me tracing the component binding process, also found nothing.
The One "Not Wotking":
The One "Not Wotking"
The One "Working":
The One "Working"
Huge data but no luck:
Assembly binding log
Windows Policy, no luck: Audit Access Deny
I have to say the error logs are well hidden.
After lots of google thing, I came across with this information then problem solved. It is a Permission problem.
And then I dig a little further, here i found:
VS Output:
WindowsAppRuntime, installed at first run, may be update after
C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.1_1005.616.1651.0_x64__8wekyb3d8bbwe
The list of files that Permissions are different (Not Working vs. Working):
CoreMessagingXP.dll
dcompi.dll
dwmcorei.dll
DwmSceneI.dll
DWriteCore.dll
marshal.dll
Microsoft.DirectManipulation.dll
Microsoft.Foundation.winmd
Microsoft.Graphics.winmd
Microsoft.InputStateManager.dll
Microsoft.Internal.FrameworkUdk.dll
Microsoft.UI.Composition.OSSupport.dll
Microsoft.UI.Input.dll
Microsoft.UI.Windowing.Core.dll
Microsoft.UI.winmd
Microsoft.Web.WebView2.Core.dll
Microsoft.Web.WebView2.Core.winmd
resources.pri
WindowsAppRuntime.png
WindowsAppSdk.AppxDeploymentExtensions.Desktop.dll
wuceffectsi.dll
en-GB\Microsoft.ui.xaml.dll.mui
en-GB\Microsoft.UI.Xaml.Phone.dll.mui
Microsoft.UI.Xaml\Assets\NoiseAsset_256x256_PNG.png
Conclution:
The "Microsoft.WindowsAppRuntime" will get installed on first run and will not get uninstalled with Visual Studio uninstallation.
The "Microsoft.WindowsAppRuntime" may get updated and permission also get changed.
The ACL permission of Microsoft.WindowsAppRuntime folder and files in it may change somehow after some time, same version (Did not go this far to see why).
Manipulate the Permission manually does the trick
Simple Rest (SYSTEM access right is required, PsExec):
psexec64 -i -s cmd.exe /k icacls.exe "C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.1_1005.616.1651.0_x64__8wekyb3d8bbwe\*.*" /reset /t
Minimun Reset (for my case, as soon as this reset done, the hot reload shows up when debug, remember to restart debug):
psexec64 -i -s cmd.exe /k icacls.exe "C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.1_1005.616.1651.0_x64__8wekyb3d8bbwe\Microsoft.Internal.FrameworkUdk.dll" /reset

vb.net CLR/SHIM error: This application could not be started. --> Unable to find a version of the runtime to use

Getting an unexpected, "This application cannot be started" popup error that is suggesting SHIM_NOVERSION_FOUND error in .NET CLR. Here's what's going on...
I have two vb.net applications:
1- MyApp.exe -- Windows Forms App
2- Launcher.exe -- Windows Service
Both are .NET framework 4.5 applications, and Launcher.exe is embedded inside MyApp.exe. Both are configured for AnyCPU, and neither use an app.config file. The reason being that the delivery tool can only deliver a single file, so I can't include any extras. The executable must be self-contained, and you can't embed an app.config file.
The execution runs in the following layers:
Layer 1: Delivery tool
Native C++ application
Elevated, running as Local System Account
Layer 2: MyApp.exe
.NET 4.5 application
Elevated, running as Local System Account
It runs fine, and installs Launcher.exe as a new Windows Service.
Layer 3: Launcher.exe
.NET 4.5 Windows Service
Elevated, running as Local System Account
Uses Windows API calls to enable the following privileges: SE_INCREASE_QUOTA_NAME, SE_ASSIGNPRIMARYTOKEN_NAME, SE_TCB_NAME
In summary, it uses elevated privileges to search for Explorer.exe processes, open them, duplicate the user's security token, and call the CreateProcessAsUser() API, using the user's token, in order to launch a second copy of MyApp.exe, running on the user's desktop.
Layer 4: MyApp.exe
.NET 4.5 application
Fails to launch with popup error --> This application could not be started.
It's A COPY of MyApp.exe, same as layer 2.
I've enabled .NET CLR debugging to compare the loading of MyApp.exe at layers 2 and 4:
Layer 2:
6172,1589.119,Parsing config file: C:...\MyApp.exe.config
6172,1589.119,Config File (Open). Result:80070002
6172,1589.119,UseLegacyV2RuntimeActivationPolicy is set to 0
6172,1589.119,LegacyFunctionCall: GetFileVersion. Filename: C:...\MyApp.exe
6172,1589.119,LegacyFunctionCall: GetFileVersion. Filename: C:...\MyApp.exe
6172,1589.119,C:...\MyApp.exe was built with version: v4.0.30319
6172,1589.166,Decided on runtime: v4.0.30319
Layer 4:
6552,1594.704,Parsing config file: C:\windows\TEMP\MyApp.exe.config
6552,1594.704,Config File (Open). Result:80070002
6552,1594.704,UseLegacyV2RuntimeActivationPolicy is set to 0
6552,1594.704,LegacyFunctionCall: GetFileVersion. Filename: C:\windows\TEMP\MyApp.exe
6552,1594.704,ERROR: Unable to find a version of the runtime to use.
6552,1594.704,SEM_FAILCRITICALERRORS is set to 5
6552,1688.055,FunctionCall: RealDllMain. Reason: 0
6552,1688.055,FunctionCall: OnShimDllMainCalled. Reason: 0
Random facts:
This doesn't happen on all computers targeted.
Disabling the antivirus doesn't resolve on affected systems.
On some computers, the error only happens once, and subsequent executions do not reproduce the popup error.
Looking for any help in understanding or debugging WHY .NET CLR is unable to determine the runtime version to use, when that very same application has already launched successfully!
I had the same issue with a Windows service running as LocalSystem and a WPF application that I was trying to run using CreateProcessAsUser by duplicating the user token pertaining to the active session (WTSQueryUserToken). When running the .exe manually it worked, but when the service was trying to create the process I kept receiving "This application could not be started". I also got the same CLR logs as you with "ERROR: Unable to find a version of the runtime to use.".
These are the things I've done:
Set OnlyUseLatestCLR registry value to 1
Use UNC paths for mapped drives (I am running inside a Windows VM and for some reason the system could not find the path for the config file after loading the app)
Check firstly if the path you are passing to CreateProcessAsUser is correct.

PDFCreator installation crash

I am currently trying to install PDFCreator 1.6.2 on my computer (Windows 7 64bits).
I have to use this specific version and not another one due to compatibility issues with another program.
I launch the setup in administrator mode, check "Expert settings"
I accept the agreements
I choose the Server Installation
I Click on "next", let the default printer's name "PDFCreator"
I do not check the box "Windows 2000/XP/2003 - 32bit" and click next
I choose the directory in which I want to install it (C:...\PDFCreator)
I just uncheck "PDFArchitect" and let everything else by default
I let the program's shortcut name in the start ùmenu folder by default (PDFCreator)
At the next page I also let everything by default (create a desktop icon for all users, create an entry in the Windows Explorer context menu)
Click on next, the summary of the installation is displayed, click on Install
The bar goes through the end, then "Create an entry in the Windows Explorer context menu" is displayed and a error pop-up appears which says "During the printer installation errors have occured. A detailed description can be found in the file "SetupLog.txt" in application path.
I click on "OK", and the last setup page is displayed. I uncheck all the boxes (launch PDFCreator, SetupLog.txt, show help), click finish and the setup crashes.
PDFCreator does not appear in the printers and if I try to add one manually by clicking on "add a printer", select "add a local printer", "create a new port", port type : "pdfcmon", I can click on "next" but it has no effect so I am a bit stuck.
Do you have an idea why does the installation crashes ?
Is there a workaround ?
The content of the file "SetupLog.txt" is available here :
SetupLog.txt
I've so far been unable to reproduce your problem despite numerous test installs (and uninstalls) of v1.6.2 on a Win7 64-bit box. Your posted log indicates that the process successfully created the pdfcmon port, but then apparently lost it afterwards (or else never created it, but misread its own return status):
Install printerport:
Portname : pdfcmon
Result: Success
[...]
InstallPrinter:
Printername: PDFCreator
Drivername : PDFCreator
Portname : pdfcmon
Result: Error 1796 = Le port spécifié est inconnu
It's reasonable to assume that nothing useful will occur beyond that point, so you'll need to address error 1796 first. A quick Google of that error code leads to a number of queries at PDFForge.org about it:
http://forums.pdfforge.org/search?Search=1796
Not all received replies, but one involving 2003 Server in particular did:
you need the latest service pack for Server 2003, then it should work.
Elsewhere in your log file I see references to some older software (e.g. Internet Explorer version: 9?) which leads me to think that you might want to doublecheck that all your relevant service packs and software are up to date first, then try your installation again.
Nevermind, I gave up installing PDFCreator, I have a server on which I could install it without any problem so the problem is kinda fixed
I still don't know why it crashed but that's not relevant anymore.
Sorry for making some of you wasting their time

Exported RCP application does not run

Current situation:
One of our products exported via the Eclipse Product export wizard does no longer run, if the produced .exe is run directly. Unfortunately no error message is shown, the program just stops. I assume that no plug-in is loaded at all.
Interestingly the product runs in the following cases:
the created .exe is executed in the developer mode:
in cmd with MyApplication.exe -dev
in Eclipse with Launch an Eclipse application
my colleague, who uses the same code, can export the product and run it directly
the .exe, created by me, can be run on my colleague's PC and another PC
Furthermore I can build and run the other product as usual. Win 7 and Java 7 are installed on the three PCs.
Log:
There is a Log file in \configuration:
!SESSION 2015-02-05 18:03:17.765 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.7.0_65
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_DE
Command-line arguments: -os win32 -ws win32 -arch x86
!ENTRY org.eclipse.equinox.ds 1 0 2015-02-05 18:03:19.481
!MESSAGE Could not bind a reference of component com.company.common.utils.Zipper.
The reference is: Reference[name = LogModelProvider, interface = com.company.common.service.ILogModelProvider,
policy = dynamic, cardinality = 0..1, target = null, bind = setLogModelProvider, unbind = unsetLogModelProvider]
I am not sure what the message means, but it also appears when the application is running in Eclipse. Therefore I ignored it.
There is no log file in \workspace. The folder .metadata does not exists.
What might have gone wrong:
The PDE build and export used to work, till I wanted to use Tycho as build system. Therefore I made the needed changes and finally I could build the two projects. Although the projects showed the same symptoms as described above (one worked, the other not). Therefore I created a SVN branch, committed every change and switched back to the trunk, to be back in the starting position. But the symptoms were not gone. Therefore I assume that I must have changed some setting, which causes the problem.
What I tried:
Basically I checked if the code and settings were back in the original state. I also switched the Eclipse workspace and imported the necessary plug-ins again. I also rebooted the PC once or twice.
Question:
Did anybody already have a similar behavior? Any hint is welcome.
(I know that my problem description is vague, sorry for that.)

Task Scheduler + Intermittantly failing + How do you debug or get a dump + windows7

I have 5 scheduled tasks that are scheduled to run every day at 9.30am. The schedule is basically a vbs script that opens an excel workbook and runs a macro. These 5 schedules can run fine if i run them seperately and 9 times out of 10 they run fine if I simulataneously run them from task scheduler. I do this by highlighting them all and then pressing run.
But sometimes when the task scheduler is doing its schedule they will fail. Sometimes all of them fail, sometimes some of them fail, but most of the time they all succeed.
Once I okay the errors(will post this next time it occurs) I can see the excel.exe in my Processes in TaskManager they are left hanging. I cannot see them in Applications because I run them in the background. Whilst here I know I can right click on the excel.exe and do a Create Dump file, but not sure what to do with this.
What I am interested here is discovering why they are failing? How do I debug it? Can I get a dump? how do i do this? I am sure the code is not perfect but the fact that they run fine seperately and most of the time fine together I am wondering is some memory resource getting used up at this time. This is what I would like to find out.
I know that i could space them out to run every minute, and this is something I might do but I would like to answer my questions above first.
Note: The vbs script in question can be found here in a previous question I asked.
EDIT1 Some useful links I have come accross following Noodles answer:
WinDBG: The very basics
question re: reading dump file
EDIT2
If i right click on check for a solution I can click on View Technical Details and that gives me:
`
Description
Faulting Application Path: C:\Program Files (x86)\Microsoft Office\Office14\EXCEL.EXE
Problem signature
Problem Event Name: APPCRASH
Application Name: EXCEL.EXE
Application Version: 14.0.7128.5000
Application Timestamp: 5398dfdc
Fault Module Name: EXCEL.EXE
Fault Module Version: 14.0.7128.5000
Fault Module Timestamp: 5398dfdc
Exception Code: c0000005
Exception Offset: 0023e751
OS Version: 6.1.7601.2.1.0.256.4
Locale ID: 5129
Additional Information 1: 8bde
Additional Information 2: 8bdedbea09a2027adb218b0e009eebf2
Additional Information 3: d4c1
Additional Information 4: d4c17b47443511f18e75ae920aa444bd
Extra information about the problem
Bucket ID: 361665432
`
EDIT3 : A useful walkthough example with commands
Crash Dumps
Load in Windbg. Then File menu - Open Crash Dump. Type !analyze (note wrong spelling)
Debugging
You can also start in a debugger.
windbg or ntsd (ntsd is a console program and maybe installed). Both are also from Debugging Tools For Windows.
Download and install Debugging Tools for Windows
http://msdn.microsoft.com/en-us/windows/hardware/hh852363
Install the Windows SDK but just choose the debugging tools.
Create a folder called Symbols in C:\
Start Windbg. File menu - Symbol File Path and enter
srv*C:\symbols*http://msdl.microsoft.com/download/symbols
then
windbg -o -g -G c:\windows\system32\cmd.exe /k batfile.bat
You can press F12 to stop it and kb will show the call stack (g continues the program). If there's errors it will also stop and show them.
Type lm to list loaded modules, x ! to list the symbols and bp symbolname to set a breakpoint
If programming in VB6 then this environmental variable link=/pdb:none stores the symbols in the dll rather than seperate files. Make sure you compile the program with No Optimisations and tick the box for Create Symbolic Debug Info. Both on the Compile tab in the Project's Properties.
Also CoClassSyms (microsoft.com/msj/0399/hood/hood0399.aspx) can make symbols from type libraries.
You can schedule this command line instead.
Autostarting Programs in Debugger
You can also make windbg attach to any specific program when started. See gflags.exe. Only in GUI mode.
Errors
Also get the error number. TS keeps a history of runs and their errors. TS has a history tab.
.