473,412 Members | 2,027 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

assembly always gets built optimized

I have a c# project as part of a larger VS 2005 solution that always
gets build optimized and I therefore can not evaluate any values while
debugging through the code ("Cannot evaluate expression because the
code of the current method is optimized."). This happens alltough the
checkbock "optimize code" in the project settings is switched off. My
question here is what are possible conditions that would make an
assembly be build as optimized even if the project settings state
otherwise. Do the referenced assemblies play a role here? This is a
Winforms WPF interop assembly that references wpf and windows forms.
The hole WPF UI is build using my own c# code so no wpf msbuild tasks
are needed. I attached the project file. Maybe you see something that
I miss.
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/
developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition="'$(Configuration)'==''">Debug</
Configuration>
<DefaultClrNameSpace>OperationCanvasTest</DefaultClrNameSpace>
<AssemblyName>AIS.VCTC3.OperationEditor</AssemblyName>
<OutputPath>bin\$(Configuration)\</OutputPath>
<ApplicationVersion>1.0.0.*</ApplicationVersion>
<ApplicationRevision>0</ApplicationRevision>
<AlwaysCompileMarkupFilesInSeparateDomain>false</
AlwaysCompileMarkupFilesInSeparateDomain>
<OutputType>Library</OutputType>
<RootNamespace>AIS.VCTC3.OperationEditor</RootNamespace>
<ApplicationIcon>
</ApplicationIcon>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ProjectGuid>{4BDDDA83-1DD1-4C33-8DF3-32B114E046FD}</ProjectGuid>
<StartupObject>
</StartupObject>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>
</DefineConstants>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisRuleAssemblies>C:\Programme\Microso ft Visual Studio
8\Team Tools\Static Analysis Tools\FxCop\\rules</
CodeAnalysisRuleAssemblies>
<CodeAnalysisUseTypeNameInSuppression>true</
CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppress ions.cs</
CodeAnalysisModuleSuppressionsFile>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<UseVSHostingProcess>false</UseVSHostingProcess>
<Optimize>false</Optimize>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.target s" />
<Import Project="$(MSBuildBinPath)\Microsoft.WinFX.targets " />
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="Process.Net, Version=0.0.0.0, Culture=neutral">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Programme\AIS\VACNT-32.42\System\Release\Process.Net.dll</
HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="UIAutomationProvider" />
<Reference Include="WindowsBase" />
<Reference Include="WindowsFormsIntegration" />
<Compile Include="DragDropScrollViewer.cs" />
<Compile Include="OperationCanvas.cs" />
<Compile Include="OperationEdior.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="OperationEdior.Designer.cs">
<DependentUpon>OperationEdior.cs</DependentUpon>
</Compile>
<Compile Include="OperationVisual.cs" />
<Compile Include="Timeline.cs" />
</ItemGroup>
<PropertyGroup>
<PostBuildEvent>xcopy /Y "$(TargetDir)$(TargetName).*" "$(SolutionDir)
\out\$(ConfigurationName)\"</PostBuildEvent>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\AIS.VCTC3.Core\AIS.VCTC3.Core.csproj">
<Project>{C365BE10-1043-4897-8D69-15643306EAE2}</Project>
<Name>AIS.VCTC3.Core</Name>
</ProjectReference>
<ProjectReference Include="..\AIS.VCTC3.Interface
\AIS.VCTC3.Interface.csproj">
<Project>{E5F7E025-164E-4F64-BF06-9AD00301BC1E}</Project>
<Name>AIS.VCTC3.Interface</Name>
</ProjectReference>
<ProjectReference Include="..\AIS.VCTC3.Kit\AIS.VCTC3.Kit.csproj">
<Project>{7BF1753E-853B-40C9-94F2-C943A4399980}</Project>
<Name>AIS.VCTC3.Kit</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="OperationEdior.resx">
<SubType>Designer</SubType>
<DependentUpon>OperationEdior.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
</Project>

Apr 2 '07 #1
7 1803
Bonk,

It's not the optimize flag which causes you to not be able to debug. My
guess is that you have your project configured for release, and that is why
you can't debug it.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"bonk" <sc******************@gmx.dewrote in message
news:11*********************@y80g2000hsf.googlegro ups.com...
>I have a c# project as part of a larger VS 2005 solution that always
gets build optimized and I therefore can not evaluate any values while
debugging through the code ("Cannot evaluate expression because the
code of the current method is optimized."). This happens alltough the
checkbock "optimize code" in the project settings is switched off. My
question here is what are possible conditions that would make an
assembly be build as optimized even if the project settings state
otherwise. Do the referenced assemblies play a role here? This is a
Winforms WPF interop assembly that references wpf and windows forms.
The hole WPF UI is build using my own c# code so no wpf msbuild tasks
are needed. I attached the project file. Maybe you see something that
I miss.
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/
developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition="'$(Configuration)'==''">Debug</
Configuration>
<DefaultClrNameSpace>OperationCanvasTest</DefaultClrNameSpace>
<AssemblyName>AIS.VCTC3.OperationEditor</AssemblyName>
<OutputPath>bin\$(Configuration)\</OutputPath>
<ApplicationVersion>1.0.0.*</ApplicationVersion>
<ApplicationRevision>0</ApplicationRevision>
<AlwaysCompileMarkupFilesInSeparateDomain>false</
AlwaysCompileMarkupFilesInSeparateDomain>
<OutputType>Library</OutputType>
<RootNamespace>AIS.VCTC3.OperationEditor</RootNamespace>
<ApplicationIcon>
</ApplicationIcon>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ProjectGuid>{4BDDDA83-1DD1-4C33-8DF3-32B114E046FD}</ProjectGuid>
<StartupObject>
</StartupObject>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>
</DefineConstants>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisRuleAssemblies>C:\Programme\Microso ft Visual Studio
8\Team Tools\Static Analysis Tools\FxCop\\rules</
CodeAnalysisRuleAssemblies>
<CodeAnalysisUseTypeNameInSuppression>true</
CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppress ions.cs</
CodeAnalysisModuleSuppressionsFile>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<UseVSHostingProcess>false</UseVSHostingProcess>
<Optimize>false</Optimize>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.target s" />
<Import Project="$(MSBuildBinPath)\Microsoft.WinFX.targets " />
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="Process.Net, Version=0.0.0.0, Culture=neutral">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Programme\AIS\VACNT-32.42\System\Release\Process.Net.dll</
HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="UIAutomationProvider" />
<Reference Include="WindowsBase" />
<Reference Include="WindowsFormsIntegration" />
<Compile Include="DragDropScrollViewer.cs" />
<Compile Include="OperationCanvas.cs" />
<Compile Include="OperationEdior.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="OperationEdior.Designer.cs">
<DependentUpon>OperationEdior.cs</DependentUpon>
</Compile>
<Compile Include="OperationVisual.cs" />
<Compile Include="Timeline.cs" />
</ItemGroup>
<PropertyGroup>
<PostBuildEvent>xcopy /Y "$(TargetDir)$(TargetName).*" "$(SolutionDir)
\out\$(ConfigurationName)\"</PostBuildEvent>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\AIS.VCTC3.Core\AIS.VCTC3.Core.csproj">
<Project>{C365BE10-1043-4897-8D69-15643306EAE2}</Project>
<Name>AIS.VCTC3.Core</Name>
</ProjectReference>
<ProjectReference Include="..\AIS.VCTC3.Interface
\AIS.VCTC3.Interface.csproj">
<Project>{E5F7E025-164E-4F64-BF06-9AD00301BC1E}</Project>
<Name>AIS.VCTC3.Interface</Name>
</ProjectReference>
<ProjectReference Include="..\AIS.VCTC3.Kit\AIS.VCTC3.Kit.csproj">
<Project>{7BF1753E-853B-40C9-94F2-C943A4399980}</Project>
<Name>AIS.VCTC3.Kit</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="OperationEdior.resx">
<SubType>Designer</SubType>
<DependentUpon>OperationEdior.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
</Project>

Apr 2 '07 #2
On 2 Apr., 22:53, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
Bonk,

It's not the optimize flag which causes you to not be able to debug. My
guess is that you have your project configured for release, and that is why
you can't debug it.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

"bonk" <schwertfischtromb...@gmx.dewrote in message

news:11*********************@y80g2000hsf.googlegro ups.com...
I have a c# project as part of a larger VS 2005 solution that always
gets build optimized and I therefore can not evaluate any values while
debugging through the code ("Cannot evaluate expression because the
code of the current method is optimized."). This happens alltough the
checkbock "optimize code" in the project settings is switched off. My
question here is what are possible conditions that would make an
assembly be build as optimized even if the project settings state
otherwise. Do the referenced assemblies play a role here? This is a
Winforms WPF interop assembly that references wpf and windows forms.
The hole WPF UI is build using my own c# code so no wpf msbuild tasks
are needed. I attached the project file. Maybe you see something that
I miss.
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/
developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition="'$(Configuration)'==''">Debug</
Configuration>
<DefaultClrNameSpace>OperationCanvasTest</DefaultClrNameSpace>
<AssemblyName>AIS.VCTC3.OperationEditor</AssemblyName>
<OutputPath>bin\$(Configuration)\</OutputPath>
<ApplicationVersion>1.0.0.*</ApplicationVersion>
<ApplicationRevision>0</ApplicationRevision>
<AlwaysCompileMarkupFilesInSeparateDomain>false</
AlwaysCompileMarkupFilesInSeparateDomain>
<OutputType>Library</OutputType>
<RootNamespace>AIS.VCTC3.OperationEditor</RootNamespace>
<ApplicationIcon>
</ApplicationIcon>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ProjectGuid>{4BDDDA83-1DD1-4C33-8DF3-32B114E046FD}</ProjectGuid>
<StartupObject>
</StartupObject>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>
</DefineConstants>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisRuleAssemblies>C:\Programme\Microso ft Visual Studio
8\Team Tools\Static Analysis Tools\FxCop\\rules</
CodeAnalysisRuleAssemblies>
<CodeAnalysisUseTypeNameInSuppression>true</
CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppress ions.cs</
CodeAnalysisModuleSuppressionsFile>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<UseVSHostingProcess>false</UseVSHostingProcess>
<Optimize>false</Optimize>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.target s" />
<Import Project="$(MSBuildBinPath)\Microsoft.WinFX.targets " />
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="Process.Net, Version=0.0.0.0, Culture=neutral">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Programme\AIS\VACNT-32.42\System\Release\Process.Net.dll</
HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="UIAutomationProvider" />
<Reference Include="WindowsBase" />
<Reference Include="WindowsFormsIntegration" />
<Compile Include="DragDropScrollViewer.cs" />
<Compile Include="OperationCanvas.cs" />
<Compile Include="OperationEdior.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="OperationEdior.Designer.cs">
<DependentUpon>OperationEdior.cs</DependentUpon>
</Compile>
<Compile Include="OperationVisual.cs" />
<Compile Include="Timeline.cs" />
</ItemGroup>
<PropertyGroup>
<PostBuildEvent>xcopy /Y "$(TargetDir)$(TargetName).*" "$(SolutionDir)
\out\$(ConfigurationName)\"</PostBuildEvent>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\AIS.VCTC3.Core\AIS.VCTC3.Core.csproj">
<Project>{C365BE10-1043-4897-8D69-15643306EAE2}</Project>
<Name>AIS.VCTC3.Core</Name>
</ProjectReference>
<ProjectReference Include="..\AIS.VCTC3.Interface
\AIS.VCTC3.Interface.csproj">
<Project>{E5F7E025-164E-4F64-BF06-9AD00301BC1E}</Project>
<Name>AIS.VCTC3.Interface</Name>
</ProjectReference>
<ProjectReference Include="..\AIS.VCTC3.Kit\AIS.VCTC3.Kit.csproj">
<Project>{7BF1753E-853B-40C9-94F2-C943A4399980}</Project>
<Name>AIS.VCTC3.Kit</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="OperationEdior.resx">
<SubType>Designer</SubType>
<DependentUpon>OperationEdior.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
</Project>- Zitierten Text ausblenden -

- Zitierten Text anzeigen -
What do you mean by "configured for release"? The active configuration
that I use when I hit F5 is Debug|AnyCPU. What settings actually make
a project configured for release ? Just DEBUG not being defined ?
That'd be strange since I can debug other projects in release mode
(without DEBUG being defined but with debug symbols loaded) just fine.

Apr 2 '07 #3
"Robert Ludig" <sc******************@gmx.dewrote in message
news:11**********************@y80g2000hsf.googlegr oups.com...
On 2 Apr., 22:53, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
>Bonk,

It's not the optimize flag which causes you to not be able to debug. My
guess is that you have your project configured for release, and that is why
you can't debug it.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

"bonk" <schwertfischtromb...@gmx.dewrote in message

news:11*********************@y80g2000hsf.googlegr oups.com...
>I have a c# project as part of a larger VS 2005 solution that always
gets build optimized and I therefore can not evaluate any values while
debugging through the code ("Cannot evaluate expression because the
code of the current method is optimized."). This happens alltough the
checkbock "optimize code" in the project settings is switched off. My
question here is what are possible conditions that would make an
assembly be build as optimized even if the project settings state
otherwise. Do the referenced assemblies play a role here? This is a
Winforms WPF interop assembly that references wpf and windows forms.
The hole WPF UI is build using my own c# code so no wpf msbuild tasks
are needed. I attached the project file. Maybe you see something that
I miss.
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/
developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition="'$(Configuration)'==''">Debug</
Configuration>
<DefaultClrNameSpace>OperationCanvasTest</DefaultClrNameSpace>
<AssemblyName>AIS.VCTC3.OperationEditor</AssemblyName>
<OutputPath>bin\$(Configuration)\</OutputPath>
<ApplicationVersion>1.0.0.*</ApplicationVersion>
<ApplicationRevision>0</ApplicationRevision>
<AlwaysCompileMarkupFilesInSeparateDomain>false</
AlwaysCompileMarkupFilesInSeparateDomain>
<OutputType>Library</OutputType>
<RootNamespace>AIS.VCTC3.OperationEditor</RootNamespace>
<ApplicationIcon>
</ApplicationIcon>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ProjectGuid>{4BDDDA83-1DD1-4C33-8DF3-32B114E046FD}</ProjectGuid>
<StartupObject>
</StartupObject>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>
</DefineConstants>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisRuleAssemblies>C:\Programme\Microso ft Visual Studio
8\Team Tools\Static Analysis Tools\FxCop\\rules</
CodeAnalysisRuleAssemblies>
<CodeAnalysisUseTypeNameInSuppression>true</
CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppress ions.cs</
CodeAnalysisModuleSuppressionsFile>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<UseVSHostingProcess>false</UseVSHostingProcess>
<Optimize>false</Optimize>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.target s" />
<Import Project="$(MSBuildBinPath)\Microsoft.WinFX.targets " />
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="Process.Net, Version=0.0.0.0, Culture=neutral">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Programme\AIS\VACNT-32.42\System\Release\Process.Net.dll</
HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="UIAutomationProvider" />
<Reference Include="WindowsBase" />
<Reference Include="WindowsFormsIntegration" />
<Compile Include="DragDropScrollViewer.cs" />
<Compile Include="OperationCanvas.cs" />
<Compile Include="OperationEdior.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="OperationEdior.Designer.cs">
<DependentUpon>OperationEdior.cs</DependentUpon>
</Compile>
<Compile Include="OperationVisual.cs" />
<Compile Include="Timeline.cs" />
</ItemGroup>
<PropertyGroup>
<PostBuildEvent>xcopy /Y "$(TargetDir)$(TargetName).*" "$(SolutionDir)
\out\$(ConfigurationName)\"</PostBuildEvent>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\AIS.VCTC3.Core\AIS.VCTC3.Core.csproj">
<Project>{C365BE10-1043-4897-8D69-15643306EAE2}</Project>
<Name>AIS.VCTC3.Core</Name>
</ProjectReference>
<ProjectReference Include="..\AIS.VCTC3.Interface
\AIS.VCTC3.Interface.csproj">
<Project>{E5F7E025-164E-4F64-BF06-9AD00301BC1E}</Project>
<Name>AIS.VCTC3.Interface</Name>
</ProjectReference>
<ProjectReference Include="..\AIS.VCTC3.Kit\AIS.VCTC3.Kit.csproj">
<Project>{7BF1753E-853B-40C9-94F2-C943A4399980}</Project>
<Name>AIS.VCTC3.Kit</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="OperationEdior.resx">
<SubType>Designer</SubType>
<DependentUpon>OperationEdior.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
</Project>- Zitierten Text ausblenden -

- Zitierten Text anzeigen -

What do you mean by "configured for release"? The active configuration
that I use when I hit F5 is Debug|AnyCPU. What settings actually make
a project configured for release ? Just DEBUG not being defined ?
That'd be strange since I can debug other projects in release mode
(without DEBUG being defined but with debug symbols loaded) just fine.

What's the current method?
..... "of the current method is optimized"...
Seems like you are evaluating an expression from a method that is part of an optimized
assembly.
Willy.

Apr 2 '07 #4
Robert,

DEBUG being defined is a by-product of the project properties. The
project, when you tell it to compile in debug mode, will define the debug
constant. When you compile in release mode, the constant will not be there.
In order to access this, you basically go to the configuration manager in
Visual Studio and set which projects are in release mode, and which are in
debug mode.

The only other thing I can guess would be the issue is that you are not
referencing the project, but rather, the compiled dll itself, which I think
would disable debugging as well.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Robert Ludig" <sc******************@gmx.dewrote in message
news:11**********************@y80g2000hsf.googlegr oups.com...
On 2 Apr., 22:53, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
>Bonk,

It's not the optimize flag which causes you to not be able to debug.
My
guess is that you have your project configured for release, and that is
why
you can't debug it.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

"bonk" <schwertfischtromb...@gmx.dewrote in message

news:11*********************@y80g2000hsf.googlegr oups.com...
>I have a c# project as part of a larger VS 2005 solution that always
gets build optimized and I therefore can not evaluate any values while
debugging through the code ("Cannot evaluate expression because the
code of the current method is optimized."). This happens alltough the
checkbock "optimize code" in the project settings is switched off. My
question here is what are possible conditions that would make an
assembly be build as optimized even if the project settings state
otherwise. Do the referenced assemblies play a role here? This is a
Winforms WPF interop assembly that references wpf and windows forms.
The hole WPF UI is build using my own c# code so no wpf msbuild tasks
are needed. I attached the project file. Maybe you see something that
I miss.
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/
developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition="'$(Configuration)'==''">Debug</
Configuration>
<DefaultClrNameSpace>OperationCanvasTest</DefaultClrNameSpace>
<AssemblyName>AIS.VCTC3.OperationEditor</AssemblyName>
<OutputPath>bin\$(Configuration)\</OutputPath>
<ApplicationVersion>1.0.0.*</ApplicationVersion>
<ApplicationRevision>0</ApplicationRevision>
<AlwaysCompileMarkupFilesInSeparateDomain>false</
AlwaysCompileMarkupFilesInSeparateDomain>
<OutputType>Library</OutputType>
<RootNamespace>AIS.VCTC3.OperationEditor</RootNamespace>
<ApplicationIcon>
</ApplicationIcon>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ProjectGuid>{4BDDDA83-1DD1-4C33-8DF3-32B114E046FD}</ProjectGuid>
<StartupObject>
</StartupObject>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>
</DefineConstants>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisRuleAssemblies>C:\Programme\Microso ft Visual Studio
8\Team Tools\Static Analysis Tools\FxCop\\rules</
CodeAnalysisRuleAssemblies>
<CodeAnalysisUseTypeNameInSuppression>true</
CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppress ions.cs</
CodeAnalysisModuleSuppressionsFile>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<UseVSHostingProcess>false</UseVSHostingProcess>
<Optimize>false</Optimize>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.target s" />
<Import Project="$(MSBuildBinPath)\Microsoft.WinFX.targets " />
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="Process.Net, Version=0.0.0.0, Culture=neutral">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Programme\AIS\VACNT-32.42\System\Release\Process.Net.dll</
HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="UIAutomationProvider" />
<Reference Include="WindowsBase" />
<Reference Include="WindowsFormsIntegration" />
<Compile Include="DragDropScrollViewer.cs" />
<Compile Include="OperationCanvas.cs" />
<Compile Include="OperationEdior.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="OperationEdior.Designer.cs">
<DependentUpon>OperationEdior.cs</DependentUpon>
</Compile>
<Compile Include="OperationVisual.cs" />
<Compile Include="Timeline.cs" />
</ItemGroup>
<PropertyGroup>
<PostBuildEvent>xcopy /Y "$(TargetDir)$(TargetName).*" "$(SolutionDir)
\out\$(ConfigurationName)\"</PostBuildEvent>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\AIS.VCTC3.Core\AIS.VCTC3.Core.csproj">
<Project>{C365BE10-1043-4897-8D69-15643306EAE2}</Project>
<Name>AIS.VCTC3.Core</Name>
</ProjectReference>
<ProjectReference Include="..\AIS.VCTC3.Interface
\AIS.VCTC3.Interface.csproj">
<Project>{E5F7E025-164E-4F64-BF06-9AD00301BC1E}</Project>
<Name>AIS.VCTC3.Interface</Name>
</ProjectReference>
<ProjectReference Include="..\AIS.VCTC3.Kit\AIS.VCTC3.Kit.csproj">
<Project>{7BF1753E-853B-40C9-94F2-C943A4399980}</Project>
<Name>AIS.VCTC3.Kit</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="OperationEdior.resx">
<SubType>Designer</SubType>
<DependentUpon>OperationEdior.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
</Project>- Zitierten Text ausblenden -

- Zitierten Text anzeigen -

What do you mean by "configured for release"? The active configuration
that I use when I hit F5 is Debug|AnyCPU. What settings actually make
a project configured for release ? Just DEBUG not being defined ?
That'd be strange since I can debug other projects in release mode
(without DEBUG being defined but with debug symbols loaded) just fine.

Apr 2 '07 #5
I did not mention an important detail (since I didn't think that it
matters). I attach to the process that references my assembly after
the process is started. When I do not attach visual studio to the
process but instead start the process directly from vs by hitting F5 I
infact am able to debug. Also note that the probelm with "Cannot
evaluate expression because the code of the current method is
optimized." only happens with the one project. The sourcecode of all
other projects in the same solution can be debugged just fine no
matter if I attach later or start the process with F5.
What does this hint? How could I narrow the source of this evil down?
Does it have to do something with the visual studio hosting process
(wich only is used when starting the process with F5) ? Or could it
have to do with the working folder or the loaded symbols?

Apr 3 '07 #6
Another interesting thing to note:

When I attach to the process later. The dll of the project in question
is infact optimized. That's what it says in the Modules windows
("Optimized" column says "Yes"). But when I start the process with F5
the dll of that project is not optimized ("Optimized" column says
"No"). All other projects always are not optimized. How can that
happen?

Apr 3 '07 #7

"Robert Ludig" <sc******************@gmx.dewrote in message
news:11**********************@p15g2000hsd.googlegr oups.com...
Another interesting thing to note:

When I attach to the process later. The dll of the project in question
is infact optimized. That's what it says in the Modules windows
("Optimized" column says "Yes"). But when I start the process with F5
the dll of that project is not optimized ("Optimized" column says
"No"). All other projects always are not optimized. How can that
happen?
The framework detects the debugger during startup, and changes a bunch of
settings. Thus to really debug production code, you have to attach and not
start in debugger.
Apr 4 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

26
by: nospam | last post by:
Just wondering, What do you think the difference in performance would be between (1.) Compiled C# (2.) Compiled C++ (3.) and Assembly Language And how would the mix be if some if any of...
6
by: James | last post by:
I have two question regarding the version resource that is generated for a satellite assembly. 1) I have a file in my C# console app project called StringResources.en-US.resx. When I build the...
6
by: RoSsIaCrIiLoIA | last post by:
d_0=32.000000 d_1=38.000000 Test success d_0=34.000000 d_1=42.000000 Test success d_0=1.000000 d_1=0.000000 Test success
14
by: Teis Draiby | last post by:
I am about to move my C++ application to C#. Parts of my previous application consisted of inline SSE2 assembly code optimized for the P4 processor. What options do I have to integrate that part...
2
by: Henrik de Jong | last post by:
I'm using a sort of plugin mechanism in combination with a commandfactory (pluginfactory). This factory looks in a special dir when it's starting. Each assembly(*.dll) will be loaded with...
3
by: Richard Lewis Haggard | last post by:
We are having a lot of trouble with problems relating to failures relating to 'The located assembly's manifest definition with name 'xxx' does not match the assembly reference" but none of us here...
2
by: CK | last post by:
Good Morning All, What the best way to use references? Reference a project in another project or reference a DLL. We are developing C# Sharp Web Apps in VS 2003. We are getting warnings like the...
2
by: Chen Zhuo | last post by:
Hi all experts, We are having a problem with the exact time when a C# dll gets loaded in managed C++. The scenario is like: In managed.cpp: #using MyCSharp.dll
7
by: bonk | last post by:
I have a c# project as part of a larger VS 2005 solution that always gets build optimized and I therefore can not evaluate any values while debugging through the code ("Cannot evaluate expression...
13
by: Robert Cloud | last post by:
Is it possible to include assembly language routines in C if I'm using a compiler which has an assembler such as gcc? could I include them in a main function or would I have to write a seperate...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.