title: Debug Microsoft.AspNet.Identity.Core pdb
body: <p>I try to implement register base on Microsoft.AspNet.Identity.Core.
  </p>
  
  <p><strong>package.config :</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;packages&gt;
    &lt;package id="EntityFramework" version="6.1.3" targetFramework="net451" /&gt;
    &lt;package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net451" /&gt;
    &lt;package id="Microsoft.AspNet.Identity.EntityFramework" version="2.2.1" targetFramework="net451" /&gt;
    &lt;package id="Microsoft.AspNet.Identity.Owin" version="2.2.1" targetFramework="net451" /&gt;
    &lt;package id="Microsoft.Owin" version="3.0.1" targetFramework="net451" /&gt;
    &lt;package id="Microsoft.Owin.Security" version="3.0.1" targetFramework="net451" /&gt;
    &lt;package id="Microsoft.Owin.Security.Cookies" version="3.0.1" targetFramework="net451" /&gt;
    &lt;package id="Microsoft.Owin.Security.OAuth" version="3.0.1" targetFramework="net451" /&gt;
    &lt;package id="Newtonsoft.Json" version="7.0.1" targetFramework="net451" /&gt;
    &lt;package id="Owin" version="1.0" targetFramework="net451" /&gt;
  &lt;/packages&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>My unit test class:</strong></p>
  
  <pre><code>public class register_test
      {
          Mock&lt;IUserStore&lt;ApplicationUser&gt;&gt; _userStore;
          IRegisterService _registerService;
          Mock&lt;ApplicationUserManager&gt; _userManagerMock;
          IDataProtectionProvider _dataProvider;
  
  
          public register_test()
          {
              _dataProvider = new DpapiDataProtectionProvider("paracours");
              _userStore = new Mock&lt;IUserStore&lt;ApplicationUser&gt;&gt;();
              _userManagerMock = new Mock&lt;ApplicationUserManager&gt;(_userStore.Object, _dataProvider);
              _registerService = new RegisterService(_userManagerMock.Object);
          }
          [Fact]
          public async Task register_sucess()
          {
              ApplicationUser user = new ApplicationUser() { Email = "user1@test.fr", UserName = "user1@test.fr" };
              _userManagerMock.Setup(u =&gt; u.CreateAsync(It.IsAny&lt;ApplicationUser&gt;(), It.IsAny&lt;string&gt;()))
                  .ReturnsAsync(IdentityResult.Success)
                  .Callback(() =&gt; user.Id = "0f8fad5b-d9cb-469f-a165-70867728950e");
  
  
              var result = await _registerService.RegisterAsync(user);
  
              _userManagerMock.Verify(x =&gt;
                  x.CreateAsync(
                  It.Is&lt;ApplicationUser&gt;(u =&gt; u.Email == "user1@test.fr"),
                  It.Is&lt;string&gt;(pass =&gt; pass == "P@ssword1")));
  
              Assert.NotNull(result);
              Assert.Equal(user.Id, "0f8fad5b-d9cb-469f-a165-70867728950e");
  
          }
  
          [Fact]
          public void email_token_generation_success()
          {
  
              _userManagerMock.Setup(u =&gt; u.FindByIdAsync(It.IsAny&lt;string&gt;()))
                 .ReturnsAsync(new ApplicationUser() { Email = "user1@test.fr", UserName = "user1@test.fr", EmailConfirmed = false });
              var result = _registerService.EmailToken("0f8fad5b-d9cb-469f-a165-70867728950e");
  
              Assert.NotNull(result);
  
          }
      }
  </code></pre>
  
  <p><br/>
  <strong>My service :</strong></p>
  
  <pre><code>public class RegisterService : IRegisterService
  {
      private readonly ApplicationUserManager _userManager;
  
  
      public RegisterService() { }
  
      public RegisterService(ApplicationUserManager userManager)
      {
          _userManager = userManager;
      }
  
      public virtual async Task&lt;IdentityResult&gt; RegisterAsync(ApplicationUser user)
      {
          return await _userManager.CreateAsync(user, "P@ssword1");
      }
  
      public virtual string EmailToken(string userId)
      {
          return _userManager.GenerateEmailConfirmationToken(userId);
  
      }
  }
  </code></pre>
  
  <p><strong>My Debug configuration:</strong></p>
  
  <ul>
  <li>uncheck Debug only my code </li>
  <li>check activate soupport source server
  
  <strong>Debug Symbol</strong>
  </li>
  <li>Symbols Microsoft Serveur 
  with (http:// before)</li>
  <li>srv.symbolsource.org/pdb/MyGet</li>
  <li>referencesource.microsoft.com/symbols</li>
  <li>msdl.microsoft.com/download/symbols</li>
  <li><p>msdl.microsoft.com/download/symbols </p>
  
  <p><br/>
  <strong>I do this :</strong>
  <br/>
  Put a break point on :
  <br></p>
  
  <p>public virtual string EmailToken(string userId){
  return _userManager.GenerateEmailConfirmationToken(userId);
  }</p></li>
  </ul>
  
  <p><br>
  When I touch F11, it'go to :
  <br></p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Security.Claims;
  
  namespace Microsoft.AspNet.Identity
  {
      /// &lt;summary&gt;
      ///     Extension methods for UserManager
      /// &lt;/summary&gt;
      public static class UserManagerExtensions
      {
          ...
  
          /// &lt;summary&gt;
          ///     Get the confirmation token for the user
          /// &lt;/summary&gt;
          /// &lt;param name="manager"&gt;&lt;/param&gt;
          /// &lt;param name="userId"&gt;&lt;/param&gt;
          /// &lt;returns&gt;&lt;/returns&gt;
          public static string GenerateEmailConfirmationToken&lt;TUser, TKey&gt;(this UserManager&lt;TUser, TKey&gt; manager,
              TKey userId)
              where TKey : IEquatable&lt;TKey&gt;
              where TUser : class, IUser&lt;TKey&gt;
          {
              if (manager == null)
              {
                  throw new ArgumentNullException("manager");
              }
              return AsyncHelper.RunSync(() =&gt; manager.GenerateEmailConfirmationTokenAsync(userId));
          }
          ...
      }
  }
  </code></pre>
  
  <p><br>
  <strong>I don't know how to debug  :</strong>
      manager.GenerateEmailConfirmationTokenAsync(userId) 
  <br>
  inside 
  <br>
      AsyncHelper.RunSync(() => 
  <br>
  Please i need held , it's new for me Task and debug </p>