Windows Workflow Foundation 3


Process is terminated due to StackOverflowException


Hi,
I created a simple console application . any1 tell me wat is the solution and why im getting this error??
The code :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
public int a
{
get { return a + 10; }
set { a = value + 20; }
}
static void Main(string[] args)
{
SendMessage();
}
public static void SendMessage()
{
Program obj = new Program();
obj.a = 100;
Console.WriteLine(obj.a);
}
}
}
Error:Process is terminated due to StackOverflowExceptionsudha496
Hi,
public int a
{
get
{ return a +
10; }
set
{ a = value +
20; }
}
When set the value of a, it call the setter itself, hence stack overflow. You can use code like this:
private int _a;
pubic int a
{
get {return _a+10;}
set {_a=value+20:}
}
Thanks.Leo Tang [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

Related Links

CustomPersistedService
Workflow and Development Modes
My workflow deriving from my own workflow base class - will it work?
Object To Object Map Activity
Distributed Transaction with WWF
MaxInstances WorkflowRuntime
Remote workflow tracking
callback trigger
Question about hosting
Context bindings wsdl generation
Use of HandleExternalEvent result in an IfElse activity
Custom Activity Designer
How to invoke rule set editor independently?
WebService and Persistence
Workflow Designer slow with numerous rules
Replicator w/ ExecutionType=Parallel : How to create dynamic tasks in childactivity

Categories

MSDN
Architecture
DevLabs
Internet Explorer Deve...
SQL Server
Windows Server
Windows Live Developer
Dynamics
Bing
Open Specifications
Bing Ads API: Development
Silverlight
Expression
Archived Forums #
Archived Forums A-B
Archived Forums Visual...
Windows Phone Preview ...
Archived Forums
Announcements for all ...
Off-Topic Posts (Do No...
MSDN and TechNet Profi...
C++ Standards, Extensi...
Visual Studio Tools fo...
Register and Manage Ac...
Payouts and Reporting
AdSDK Integration & Ad...
Media Foundation Devel...
Peer-to-Peer Networkin...
User Interface develop...
Message Analyzer
SharePoint 2013 - Gene...
SharePoint 2013 - Deve...
SharePoint 2013 - Setu...
SharePoint 2010 - Gene...
Cloud Services (Web an...
Azure Multi-Factor Aut...
Azure Pack
Azure Automation
Language Understanding...
Azure DevTest Labs
Azure Disk Encryption
Windows Communication ...
Team Foundation Server...
Visual FoxPro General
BizTalk Server Adapter...
BizTalk ESB Toolkit
ADO.NET Managed Providers
Internet Explorer Exte...
Microsoft Translator H...
SyncFx - Microsoft Syn...
Microsoft Robotics - C...
Microsoft Device Emulator
SQL Server Tools
SQL Server XML
SQL Server Setup & Upg...
SQL Server Data Tools
Standard 7: Embedded E...
Windows Embedded Compa...
SQL Server 2012 PowerP...
SQL Server 2012 Report...
ClickOnce and Setup & ...
Server Virtualization
Live Connect (Archived)
CRM
The Samsung Windows De...
Windows File Sharing P...
Office XML, ODF, and B...
Microsoft Unified Comm...
Silverlight 5
Silverlight Installati...
Silverlight Controls a...
MVVM / ViewModel Patte...
Expression Studio
Windows Performance To...
Reference Source Serve...
.NET Remoting and Runt...
Announcements about pr...
AppFabric Service and ...
Core Coding Experience...
Crystal Reports for Vi...
DNS and Traffic Manager
LightSwitch HTML Clien...
Office Live Small Busi...
Search Server: Federation
Search Server: Known B...
Sharepoint Development...
SyncFx - Microsoft Syn...
SQL Server 2014 In Azu...
SQL Server 2014 Integr...
Visual C++ Express Edi...
Visual Studio 2008 Exp...
Visual Studio Database...
Visual Studio UI Autom...
Visual Studio WPF/SL D...
Windows Developer Prev...
Building Windows Store...
.NET Native Preview

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile