for some reason, my visual studio 2010 is not loading debug symbols on my own code.
i am using a default WPF application solution. with a sample WPF app i am working on, and running in Debug mode.
when i go into debug, i can step through my code.
BUT
when exception happens in my code (i.e. throw new Exception("test")), visual studio gives me the blue blank screen with "No Source Available. No symbols are loaded blah blah.."
AND
i can actually "view" exception details, where it will tell me the line of code my exception occured on.
so it does know what happened.. it seems.
it seems to think that PDB files are not loaded.
my setup:
options > Deubg > "Enable just my code (managed only)" is checked.
application properties : 1 project running in Debug x86
Loading symbols should be configured on : Tools -> Options -> Debugging -> Symbols where you can choose to Automatically load symbols for: "All modules" or "Only specified modules". This should be set to all modules. If you get "no source available" for exceptions in the .NET framework like I did you should hit the "empty symbol cache" button. This worked for me.
I was also facing this issue and luckily find out following solution.
If you do not want to debug .NET assembly, a quick fix to avoid "No source available to current location" problem is to uncheck "Require source files to exactly match the original version" check-box under Tool -> Options -> Debugging -> General
Please let me know, if it solves your problem.
Thanks
Shilpa
Tried Debugging answer and didn't have any luck. What I think happened, in my case...
I renamed some files/namespaces/etc during a cleanup and my App.xaml was pointing to a now non-existant namespace.
This is what I had in my code:
<Application x:Class="Patcom.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="SomethingElse.xaml"
xmlns:p="clr-namespace:Patcom.Properties">
....
</Application>
This is what I needed in my code (Notice the changed StartupUri in my case):
<Application x:Class="Patcom.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="Patcom.xaml"
xmlns:p="clr-namespace:Patcom.Properties" >
....
</Application>
No clue if this is remotely your case. I'm still very noobish and there isn't a whole lotta information in your post... but i found this while searching for the same problem on my code.
Further Notes:
After more research... I found another post claiming that the problem really lies with date-stamps on objects in the Bin & Obj directories becoming out of sync between multiple "projects" in the same solution.
I don't have the link anymore, but what I've ended up doing is deleting Bin & Obj directories. We'll see shortly if I have the same problems on my work computer that I had on my home computer.
This worked for me:
Just reset your objects
Like you are using dataset ds=new dataset();
A common dataset for many results or tables then reset it using ds.reset();
Before using the dataset again.
Related
I'm attempting to follow the instructions to create a reusable modal window in LightSwitch from Jan Van der Haegen's blog. However after I click to add a new Silverlight User Control to the Client, and input the xaml I'm met with errors. I reduced the code to the shortest section that gives me an error:
HRESULT E_FAIL has been returned from a call to a COM component.
From the following xaml:
<shellUtils:ScreenChildWindow
xmlns:shellUtils="clr-namespace:Microsoft.LightSwitch.Runtime.Shell.Framework;assembly=Microsoft.LightSwitch.Client">
</shellUtils:ScreenChildWindow>
I just installed Visual Studio 2012 in a virtual machine, created a new project, new Client Silverlight User Control, and tried the same code and received the same error.
I also receive it with this code and others referencing Microsoft.LightSwitch.Client:
<Framework:GroupBox
xmlns:Framework="clr-namespace:Microsoft.LightSwitch.Presentation.Framework;assembly=Microsoft.LightSwitch.Client">
</Framework:GroupBox>
Comments on the blog seem to indicate others have this error but I haven't found a solution anywhere yet. I also see the same/similar on Stackoverflow here, but unanswered.
Yes that's correct, just close the preview window. The XAML designer has a hard time rendering the control when referencing the LS assemblies. You can ignore these errors.
If you're seeing these errors elsewhwere please let me know and we can investigate.
After scouring the internet for the slightest related issue, I discovered at least in my case the design view errors can be entirely ignored.
Even with the other errors I didn't mention:
Undefined CLR namespace. The 'clr-namespace' URI refers to a namespace
Microsoft.LightSwitch.Cosmopolitan.Presentation.Controls' that could
not be found.
The type 'ctls:OverflowControl' was not found. Verify that you are not
missing an assembly reference and that all referenced assemblies have
been built.
An error occurred while finding the resource dictionary
/Microsoft.LightSwitch.Cosmopolitan.Client;component/Presentation/Shells/BasicStyles.xaml"
The control works perfectly. All the assembly preferences are present, so I'm not sure why the designer claims otherwise.
I have a winform usercontrol than I want to add to wpf project.
I added the relevant references (WindowsFormsIntegration, SystemWindowsForms and my user control dll) and added this row in my XAML:
xmlns:MyControl="clr-namespace:xx.xx.xx;assembly=xx.xx"
And then this:
<WindowsFormsHost><MyControl:control></MyControl:control></WindowsFormsHost>
When I write "MyControl:" the "control" is automated show up that mean VS recognize the control and all references added ok... but when I compile the project this give me the error in the title.
Edit
Its very strange when I'm compile the all project i've got error "The type or namespace name "xx' could not be found..."
but I added all the refernces and the VS recognize the namespace so why the compiler don't found them? If this problem will be solved I beleive the other problem also will disappear.
The solution is: Go to your project properties and change the Target Framework from Client Profile to the full version of the .Net you are using, see the image below. This problem happens if your DLL targets the full .NET Framework, and your WPF Application (main project) targets .Net Client Profile.
This happened to me when I included the assembly name in the namespace definition, but both controls were in the same assembly. Just removing the assembly part of the namespace declaration solved it.
Visual Studio will load the reference only for reflection so it will show correct intellisense correctly. But in order to compile, compiler will need all the dlls that your referenced dll is dependent on. So visual studio will show intellisense for mycontrol as it can find it in reference. But your myontrol may reference other dlls which you may not have added. You will have to add dependent references of mycontrol in your project too.
It could also be that the target framework is different between your projects. We host a class library dll with the WPF pages, and it was targeted to 'Any CPU', but the host application was targeted to 'x86'. Once they matched, the problem went away.
I ran into the same "The type or namespace name 'xx' could not be found..." issue.
It disappears when I moved my Visual Studio files on a local drive. They were stored on a shared network directory before. I dont know the root cause of this, but at least I can have my designer running now.
I've encountered this problem before and replacing <MyControl:control></MyControl:control> with just <MyControl:control/> fixed it for me.
No idea why though. It seems like the first form is only for controls which can contain other controls.
I am using using VS2010 and if I have a form open in designer mode and run my application the designer tab will no longer show the form designer but instead an error will be displayed (and it is only fixed by restarting the IDE) saying:
"To prevent possible data loss before loading the designer, the
following errors must be resolved:"
1 Error:
"The designer could not be shown for this file because none of the
classes within it can be designed. The designer inspected the
following classes in the file: ##### --- The base class ##### could
not be loaded. Ensure the assembly has been referenced and that all
projects have been built"
I then shows the following call stack:
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.EnsureDocument(IDesignerSerializationManager manager)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host)
Any help is greatly appreciated this is really annoying.
Thanks,
Joel.
I get this visual studio bug too now and then, and I deeply ignore the error text, instead I do the following:
Close the Design-tab
Reopens the Design mode by double click in Solution Explorer, or by right clicking Source code tab and select View Designer
Suddenly everything works again!
If not helping, you may have to change bullet 2 into:
Close and restart Visual Studio.
Maybe this can help you out.
I usually close the visual form, rebuild the solution, right-click then select "view designer" in the form code.
Very, very annoying. I am thinking of dropping back to VS2008.
Close the form. Clean the solution. Rebuild the solution. Reopen the form. Worked for me when nothing else would.
I had this same issue and I was able to resolve this by creating new project and then compiled and run the project and then I imported all the files and ran the project again and automatically it was working again did nothing extra.
I'm able to avoid restarting VS by doing the following
Add a new user control
Drag and drop some of your custom user controls on to it (If it gives you an error, build the solution again).
Reopen your control.
In my case, I have a winforms project with several custom controls that are used by other custom controls. Whenever I open some of those custom controls, I get a the "The base class ..." error. Adding a new custom control, building the project and then adding some custom controls from my project to the new custom control allowed me to open the custom controls that were giving me the "The base class ..." error.
UPDATE: I think I found the problem. My controls were not 'added' properly to the csproj file. In the csproj file, the files for partial classes of UI controls/components need the 'DependentUpon' attribute.
E.x.:
before:
<Compile Include="Windows\Forms\DataGridView.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Windows\Forms\DataGridView.Designer.cs" />
after:
<Compile Include="Windows\Forms\DataGridView.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Windows\Forms\DataGridView.Designer.cs">
<DependentUpon>DataGridView.cs</DependentUpon>
</Compile>
I had a situation where a custom user control appeared to be creating the error (not sure why) so I removed references to the user control from the form and the error went away.
It seems that after installing SP1 the problem has gone away.
Thanks for your help everyone.
I had the same problem using A control With Generics
MvpUserControl<Presenter,IViewMode> : UserControl
what I do it's Remove the Reference and Add again, Clean and Rebuild the Solution I Hope this can be useful for anybody else
I had the same problem with VS2010 SP1. Finally using Windows Update I saw some updates for Visual Studio and .Net, I installed them and is not happening any more.
Old post, but for those whom may find this...
Just ran in to this error and for me it was relatively simple fix.
Found that it may have something to do with the names of your classes, and renaming the problematic class to a higher order. That is the alphabetical order it appears in the assembly (Where A is higher than Z).
MSDN Article
Good luck.
This error occur if the Form class is not a first class in the file, for example if there is some helper class at the beginning of the file.
To solve this issue, move all other classes except Form class to the bottom of the file.
Don't code in Form1.Designer.cs. Move your logic to Form1.cs (hit F7 on Form1.cs [Design] tab).
"In the project file (.vcxproj), locate the entry for the target
Framework version. For example, if your project is designed to use the
.NET Framework 4.5, locate
v4.5 in the
element of the element. "
(Microsoft)
In my case the "v4.5" didn't exist so I add it, and everything is good now.
I tried clean solution and re-build solution and worked for me.
Hope this help!
This solution works fine, please follow these steps below to solve your problem:
Check the reference if load correctly
Clean the solution and rebuild again
Clean the project and rebuild again
Clean your project and open it again
I was login as administrator in visual studio . I just close my visual studio and again open it without run as administrator and my problem is solved
I ran into this today after upgrading VS2019. I went to properties, configuration tab, and set the projects to Configuration = Debug, Platform = Any CPU. Then it worked.
I faced this issue.
To prevent possible data loss before loading the designer, the following errors must be resolved:
I found solution for this problem:
Close all open tabs, and refresh (sync active documents) the solution.
For more information, you can see this video : https://youtu.be/Q3x2HBd7BDs
I'm trying to open the sample Solution for the Microsoft Ribbon for WPF, but I get this error about being unable to load metadata. The solution on that site, and the one linked in the error, is How to: Use an Assembly from the Web in Visual Studio. However, I don't see any 'Unblock' option when I check the Properties dialog for RibbonControlsLibrary.dll in C:\Program Files (x86)\Microsoft Ribbon for WPF\v3.5.40729.1. This may be because when I downloaded the Ribbon stuff, it wasn't the library directly, but rather an installer for the library. How can I get rid of this error so I can actually see the design view of the sample XAML files for the Ribbon WPF?
Here is the full error message:
Unable to load the metadata for assembly 'RibbonWindowSample'. This assembly may have been downloaded from the web. See http://go.microsoft.com/fwlink/?LinkId=179545. The following error was encountered during load: Could not load file or assembly 'RibbonWindowSample' or one of its dependencies. The system cannot find the file specified.
According to the error message, it's not RibbonControlsLibrary.dll that's at fault, it's RibbonWindowSample. Have you unbolocked the solution file and files that form the project? If RibbonWindowSample came pre-compiled, you may need to re-build the solution to generate compiled assemblies that don't have the "web mark" on them.
Did you download a zip file? You need to unblock the zip before unzipping it. Once it's unzipped you won't be able to unblock the individual files that were in it.
Here's what to look for at the bottom of the properties dialog.
I was seeing the metadata error before building the Solution--it shows up when I first load the Solution. I tried building it just now and it built fine, plus the design view shows the XAML window. I don't know why I see the metadata error when it first loads but it goes away upon building.
I am using a base Window class in a WPF project. In the code behind C# file the assembly to the base type is referenced and fine. In the XAML is looks like this:
<MyNamespace:WindowBase x:Class="MyNamespace.Applications.UserInterface.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:MyNamespace="clr-namespace:MyNamespace.Somewhere;assembly=MyNamespace.Common"
Title="MainWindow" Height="350" Width="525">
<Grid>
</Grid>
The solution compiles fine and I can run it. I just can't use the designer in VS 2010. It throws the following exception: The type'MyNameSpace:WindowBase' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.
Well. they have been. I can't understand what this issue is. This particular base class is used in other projects just fine. I grabbed it for a new project and I can't use the designer. Very frustrating.
Found this problem just recently (this answer upgraded from a comment).
If you copy the dll from a network path, you must right click on the file in Windows Explorer, select Properties, then 'unblock'; there is a hidden NTFS stream associated with the file, and many files when you download from the 'net or copy from a network path, for security reasons.
Only the designer complains, yet the project builds and runs fine: weird isn't it?!
Whenever the designer is acting up against me - the first thing I do is clear the obj-folders in the project and rebuild. Sometimes they seem to go out of sync for some reason (usually when I'm drag-dropping a lot of files and renaming visual items).
I dont't know if its the same issue but in VS2008 I tried to make abstract UserControls but had to change this because the designer didnt't support any abstract base classes (however the solution was compilable and also worked as excpected).
Fixed. The library that contained my base class resided on a drive on the network that I did not have permissions to. That seemed to have no affect on VS 2008 as it worked, but VS 2010 apparently took exception to that when the designer tried to load it. Weird.